Automating JS Behavior Registration
Written by on May 18th, 2007 in Ajax News.
Gabriel Handford has created a behavior.js script that allows you to unobtrusively automate Event.observe’tion.
Magic is in naming conventions, so that:
HTML:
-
-
<a class=”bvr-observe-click-xhrTheFunction” href=”/the/href”>The link</a>
-
takes care of:
JAVASCRIPT:
-
-
Event.observe(theLinkElement, “click”, function(event) { xhrTheFunction(event) });
-
Source: Ajaxian
Original Article: http://ajaxian.com/archives/automating-js-behavior-registration