On Jan 14, 6:29 am, Mona Remlawi <mona.reml...@gmail.com> wrote:
> hello prototypers,
> for some reason, i need to wrap getStyle method by a try/catch.

Is `getStyle` throwing errors? If so, it might be a bug which needs to
be fixed/documented.

> obviously, best way would be the wrap method (doh!)
> but doesn't seem to work here. i can use another pair of eyes for help
>
> --------------
> // wrap getStyle function with try/catch
> // as IE6 throws errors
> Element.Methods.getStyle = Element.Methods.getStyle.wrap(
>     function(proceed, element, style) {
>         try {return proceed(element, style) }
>         catch(e) {return null}
>     }
> );
> --------------
>
> thanks a milllion

You need to call `addMethods`. Simple method overwriting doesn't
actually change much:

Element.addMethods({
  getStyle: Element.Methods.getStyle.wrap(
    function($p, element, style){
      try { return $p(element, style) }
      catch(e) { return null }
    }
  )
});

--
kangax
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to