On Jan 23, 10:29 am, Richard Quadling <rquadl...@googlemail.com>
> 2009/1/23 Richard Quadling <rquadl...@googlemail.com>:


> This works ...
> $$('.tabC').each(       function(el)    {
>         el.addSheet = addSheet.methodize();
> });

I wouldn't suggest doing this. You are burdening all of those elements
with a "methodized" function instead of "putting" that function
(once!) and *sharing* it on `Element.prototype` or
`HTMLElement.prototype` or `HTMLDivElement.prototype` or whatever it
would end up on when using prototype's `Element.addMethods`. Granted,
you have no choice but to "extend" each element in IE which doesn't
support element extensions, but why cripple "normal" browsers? : )

Is it really necessary to have such precise control of which methods
end up on which elements? If the elements you want to extend are of
the same type, then extend just that type; If not - extend elements
generically and check for `className` explicitly. This will save you
tons of memory and remove chances of leaks in IE:

  foo: function(el, ...) {
    if (el.hasClassName('bar')) { bar(); }
    else { baz(); }

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