install FeatureThe install feature attaches a previously-defined behavior to
an element, applying its event handlers and other features as if they had been written
directly on the element.
<script type="text/hyperscript">
behavior Removable
on click remove me
end
</script>
<div _="install Removable">Click to remove me</div>
If the behavior takes parameters, pass them as named arguments:
<script type="text/hyperscript">
behavior Removable(removeButton)
on click from removeButton remove me
end
</script>
<div class="banner" _="install Removable(removeButton: #close-banner)">
<button id="close-banner">×</button>
Banner content
</div>
Behaviors can be defined under a dotted path, and install uses the same path:
behavior My.UI.Removable
on click remove me
end
<div _="install My.UI.Removable">...</div>
You can install multiple behaviors on the same element by using install more than once:
<div _="install Removable
install Draggable(dragHandle: .titlebar in me)">
...
</div>
install <name>[(<named-argument-list>)]