I've recently come to the conclusion that it'd be a really nice addition to the language to declare an event with the from clause to be dynamic to DOM changes.
For example:
<body _="on click from <button /> call alert('a button was clicked')">
<!-- ...content -->
</body>
Now, the above will only react to button clicks for the buttons that existed at the time the <body /> loads. It would be nice to be able to dynamically add event listeners as elements are added and removed from the DOM, as long as they match the selector. Perhaps something like:
<body _="on click from all <button /> call alert('a button was clicked')">
<!-- ...content -->
</body>
Here I introduced the all modifier, which would opt-in to this behavior.
I've recently come to the conclusion that it'd be a really nice addition to the language to declare an event with the
from
clause to be dynamic to DOM changes.For example:
Now, the above will only react to button clicks for the buttons that existed at the time the
<body />
loads. It would be nice to be able to dynamically add event listeners as elements are added and removed from the DOM, as long as they match the selector. Perhaps something like:Here I introduced the
all
modifier, which would opt-in to this behavior.Any thoughts on this?