Bonsai HTML Event helpers
These are convenience functions, if you use an event handler A LOT, you should call on with a top level function. See explanation in Bonsai.EventDecoder
Re-exports from Bonsai.
newtype Property msg
When using HTML and JS, there are two ways to specify parts of a DOM node.
Attributes — You can set things in HTML itself. So the
<div class="greeting"></div>is called an attribute.
Properties — You can also set things in JS. So the
div.className = 'greeting'is called a property.
class attribute corresponds to the
className property. At first
glance, perhaps this distinction is defensible, but it gets much crazier.
There is not always a one-to-one mapping between attributes and properties!
Yes, that is a true fact. Sometimes an attribute exists, but there is no
corresponding property. Sometimes changing an attribute does not change the
underlying property. For example, as of this writing, the
attribute can be used in HTML, but there is no corresponding property!
Options for an event listener. If
stopPropagation is true, it means the
event stops traveling through the DOM so it will not trigger any other event
preventDefault is true, any built-in browser behavior related
to the event is prevented. For example, this is used with touch events when you
want to treat them as gestures of your own, not as scrolls.