Greetings MooToolers,

I have some new plugins for your holiday enjoyment because you've all
been so good this year.

First, a new suite of StickyWin plugins that provide a tool-tip layout
that points in whatever direction you choose (it's cooler than it
sounds). This is integrated into a StickyWin class
(StickyWin.PointyTip), the MooTools Tips class (Tips.Pointy), and
FormValidator (FormValidator.Tips). You can read about it all here:

http://www.clientcide.com/code-releases/loads-of-new-plugins-pointytips-formvalidatortips-eventdelegation-and-more/

Secondly I have a new Element extension for event delegation. Event
delegation is a common practice where by you attach an event listener
to a parent object to monitor its children rather than attach events
to all the children. It’s far more efficient when you have numerous
items on a page that you want to interact with.

Instead of doing

$$('a').each(function(el) {
   el.addEvent('click', function(){
      alert('you clicked a link!');
   });
});

which can have a big startup cost on a page full of links, you
delegate the event to the parent:

$(document.body).delegate('click', 'a', function(){
   alert('you clicked a link!');
});

Only one event gets attached and it's far more efficient. Check out
the longer article here:

http://www.clientcide.com/code-releases/event-delegation-for-mootools/

And examples in action here:

http://www.clientcide.com/wiki/cnet-libraries/04-element/0.1-element.delegate

Reply via email to