Distill
Change the way you handle events with "Distill". Don't bind your events to domnodes. Let them bubble.
Update: Distill 1.2
Changelog 1.2: (by Mikko Wuokko 28/02/2008)
- configurable which attribute to use for the match
- configurable which attribute value to use (now the com_ prefix)
- follow attribute which is handy with a tags and click event when you dont wan't to follow the link, but do your own stuff instead
Advantages
Distill's advantages above normal event binding are the following
- Very fast
- Easy to implement
- No more memory leaks!
How to use Distill
Below you will find an example. This example needs the jQuery library.
HTML:
<button class="com_eventhandler">click me</button>
JS:
myhandlers.eventhandler.click = function() {
alert("ok");
}
window.onload = function () {
$.distill("click", myhandlers);
}
