You probably need Function#wrap [1]
Element.addMethods({
setStyle: Element.Methods.setStyle.wrap(function(proceed, element,
styles) {
console.log(''setStyle is called'');
return proceed(element, styles);
})
})
[1] http://www.prototypejs.org/api/function/wrap
- kangax
On Apr 23, 4:54 am, kalle
<kalle.s...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:> Hey,
> i would like to override the setStyle method, so that i don''t need
to
> touch the prototype.js file and still call the method like this
> $(''some_element'').setStyle({...})
> i tried sth like. this but it (obviously) didn''t work:
> var MyPrototype = Class.create(Element, {
> setStyle: function(element, styles) {
> alert(''cs'')
> }
>
> });
>
> thx for tipps
> kalle
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---