Should I add the method using (A)...

$$('.css').invoke('addMethod', function(el, args){
  // Payload

Or should I use (B) ...

Element.addMethods(function(el, args) {
  if (el.hasClass('css')) {
    // Payload

Using (A) directly attaches to any current elements, but (B) will work
on existing and new elements.

I suppose, based upon my own assumptions above, (B) would be the way to go.

Unless there is a way to attach behaviour based upon style (so attach
the method to the style which is then applied to the element when the
style is).


Richard Quadling.
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to