2009/1/23 Richard Quadling <rquadl...@googlemail.com>: > Hi. > > 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 > } > }); > Element.addMethods(); > > > 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). > > Regards, > > 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!" >
This works ... $$('.tabC').each( function(el) { el.addSheet = addSheet.methodize(); }); but this doesn't ... $$('.tabC').invoke('writeAttribute', 'addSheet', addSheet.methodize()); Should it? -- ----- 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 prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---