Categorized | Web 2.0

Automating JS Behavior Registration

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:
  1.  
  2. <a class="bvr-observe-click-xhrTheFunction" href="/the/href">The link</a>
  3.  

takes care of:

JAVASCRIPT:
  1.  
  2. Event.observe(theLinkElement, "click", function(event) { xhrTheFunction(event) });
  3.  

2 Responses to “Automating JS Behavior Registration”

Trackbacks/Pingbacks

  1. … [Trackback]…

    [...] Informations on that Topic: utropicmedia.net/blog/automating-js-behavior-registration [...]…

  2. Trackback…

    Find more infos here…


Leave a Reply