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 <[EMAIL PROTECTED]> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to