[uf-discuss] Tutorial on AHAH (such a cool technology!)

Paul Wilkins pmw57 at xtra.co.nz
Mon Mar 5 14:26:53 PST 2007


From: "Paul Wilkins" <pmw57 at xtra.co.nz>

If I have some time I'll get a fully tested version of this fleshed out.

// beware, untested code, dragons may be lurking
ahah = {
  init : function() {
    var els = document.getElementsByTagName('a');
    Array.forEach(els, function(el) {
      if ('ahah' == el.getAttribute('rel')) {
        var href = el.getAttribute('href');
        var id = 'ahah-' + el.getAttribute('id');
        addEvent(el, 'click', 'function(){ahah.get("'+href+'", 
"'+'ahah-'+id+'")');
      }
    });
  },
  get : function(url, target, delay) {
   // code as per normal
  }
};

How close would something like this get to cleaning things up?



More information about the microformats-discuss mailing list