Event#element returns the target, not the the currentTarget.
On Jan 10, 6:50 pm, kangax <[email protected]> wrote:
> On Jan 10, 11:12 am, "Varga-Háli Dániel" <[email protected]> wrote:
>
>
>
> > Hello everybody,
>
> > I have spent a few hours this day to work around the missing
> > currentTarget property of event in IE.
> > I modified therefore the core lib around line 4000 (v1.6.0)
>
> > observe: function(element, eventName, handler) {
> > element = $(element);
> > var name = getDOMEventName(eventName);
>
> > var wrapper = createWrapper(element, eventName, handler);
> > if (!wrapper) return element;
>
> > if (element.addEventListener) {
> > element.addEventListener(name, wrapper, false);
> > } else {
> > // instead of:
> > // element.attachEvent("on" + name, wrapper);
> > element.attachEvent("on" + name, function(e){
> > e.currentTarget = element;
> > wrapper(e);
> > });
> > }
>
> > return element;
> > },
>
> > I hope some of you will find is as useful as myself...
>
> Doesn't prototype's `Event.element` return `currentTarget` equivalent
> in IE?
> On the other hand, extending host objects often gets one in trouble
> (especially in IE). Why don't you try a "wrapper" approach?
>
> --
> kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---