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

Re: [DOM4] EventTarget as first class citizen

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 29 Feb 2012 14:11:13 -0500
Message-ID: <4F4E7851.5030907@mit.edu>
To: Marcos Caceres <w3c@marcosc.com>
CC: www-dom@w3.org
On 2/29/12 1:37 PM, Marcos Caceres wrote:
> In the sense that say:
>    1. given  "var a = { }"
>    2. … some magic… e.g.,  EventListener.create( a );
>    3. would have .addEventListener(), .removeEventListener(), .dispatchEvent() as properties attached.

How is this different from just doing |new EventListener()| exactly?

> (I won't pretend to use the right ECMAScript terminology here… be it the prototype chain or whatever)

Well, that's the part that matters, now isn't it?

> So, you get an Object that has a __proto__ with properties:
>
>   constructor: function Object() { [native code] }
>   hasOwnProperty: function hasOwnProperty() { [native code] }
>   isPrototypeOf: function isPrototypeOf() { [native code] }
>   propertyIsEnumerable: function propertyIsEnumerable() { [native code] }
>   toLocaleString: function toLocaleString() { [native code] }
>   toString: function toString() { [native code] }
>   valueOf: function valueOf() { [native code] }
>   addEventListener: function addEventListener() { [native code] }
>
>   removeEventListener: function removeEventListener() { [native code] }
>
>
>   dispatchEvent: function dispatchEvent() { [native code] }

OK, so that looks like EventListener.prototype.  Where does |a| come in?

> or something… Hopefully you can understand what I mean from the above.

I can't sorry.

-Boris
Received on Wednesday, 29 February 2012 19:11:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:09 GMT