W3C home > Mailing lists > Public > public-html@w3.org > June 2009

event.currentTarget and 'this' for listeners registered on the window object

From: Michael A. Puls II <shadow2531@gmail.com>
Date: Sat, 20 Jun 2009 05:21:55 -0400
To: public-html@w3.org
Message-ID: <op.uvtgarvr1ejg13@sandra-svwliu01>
window.addEventListener("input", function(e) {
     alert(e.currentTarget)
}, false);

Should e.currentTarget and 'this' be equivalent to e.target.ownerDocument  
or e.target.ownerDocument.defaultView?

In Opera and Safari, it's the former (the document). In Firefox it's the  
latter (the window).

Same thing for the 'change' event.

I think Firefox's behavior makes more sense, but I'm not sure what the  
spec says. I see  
<http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#events-and-the-window-object>  
and  
<http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-object>,  
but still not sure.

-- 
Michael
Received on Saturday, 20 June 2009 09:22:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:38 GMT