RESOLVED FIXED 26578
event.currentTarget for listener registered on window should point to the window object like in Firefox
https://bugs.webkit.org/show_bug.cgi?id=26578
Summary event.currentTarget for listener registered on window should point to the win...
Michael A. Puls II
Reported 2009-06-20 18:13:31 PDT
Safari 4 530.17 with WebKit-r44837 When you register an event listener on the window object, event.currentTarget and 'this' in the callback function should point to the window object. In Firefox, this is true. In Safari, 'this' points to the window, but event.currentTarget points to the document instead. In Opera, they both point to the document. Firefox's behavior makes the most sense to me. I asked for clarification at <http://lists.w3.org/Archives/Public/public-html/2009Jun/0566.html>. This affect the 'input' and 'change' events for example.
Attachments
TC that uses the 'input' event (1.33 KB, text/html)
2009-06-20 18:14 PDT, Michael A. Puls II
no flags
patch (7.13 KB, patch)
2009-06-21 13:28 PDT, Sam Weinig
eric: review+
Michael A. Puls II
Comment 1 2009-06-20 18:14:07 PDT
Created attachment 31604 [details] TC that uses the 'input' event
Sam Weinig
Comment 2 2009-06-20 19:02:26 PDT
This is possible now that DOMWindow inherits from EventTarget. The fix should be in Node.cpp: 2487: event->setCurrentTarget(targetForWindowEvents->document()); // FIXME: targetForWindowEvents should be the event target. 2525: event->setCurrentTarget(targetForWindowEvents->document()); // FIXME: targetForWindowEvents should be the event target.
Sam Weinig
Comment 3 2009-06-21 13:28:44 PDT
Eric Seidel (no email)
Comment 4 2009-06-21 13:30:44 PDT
Comment on attachment 31619 [details] patch Looks good.
Sam Weinig
Comment 5 2009-06-21 13:48:40 PDT
Fixed in r44913.
Note You need to log in before you can comment on or make changes to this bug.