Re: [DOM4] EventTarget as first class citizen

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 UTC