W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

Re: [DOM4] EventTarget as first class citizen

From: Marcos Caceres <w3c@marcosc.com>
Date: Wed, 29 Feb 2012 23:00:52 +0000
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-dom@w3.org
Message-ID: <695D32E274A448FFA46B201BB55507AB@marcosc.com>

On Wednesday, 29 February 2012 at 21:26, Boris Zbarsky wrote:

> On 2/29/12 2:35 PM, Marcos Caceres wrote:
> > "a" now has "addEventListener" in its prototype chain. So:
> Yes, but _where_?
This is a good question, maybe just bind the properties transparently to Object?  

Sounds like blasphemy, I know... but consider that DOM Elements already do this kind of thing. In Chrome, for example:

var a = document.createElement("a")


a.__proto__ is "HTMLAnchorElement", whose __proto__ is "HTMLElement", whose __proto__ is "Element", whose __proto__ is "Node", whose __proto__ is "Object".  

But DOM4 says:  
interface Node : EventTarget {…}  

So I would have expected Node's __proto__ to be "EventTarget". But it is not… Node somehow transparently/silently inherits EventTarget.  

So maybe it could be the same with Object?… just sayin' there is precedence for doing this "silent" inheritance (though it ain't pretty).  

Marcos Caceres
Received on Wednesday, 29 February 2012 23:01:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC