Re: [DOM4] EventTarget as first class citizen

On Wednesday, February 29, 2012 at 2:24 PM, Anne van Kesteren wrote:

> On Mon, 27 Feb 2012 15:18:55 +0100, Marcos Caceres <w3c@marcosc.com (mailto:w3c@marcosc.com)> wrote:
> > On Thursday, February 23, 2012 at 3:18 PM, Jonas Sicking wrote:
> > > I think the way we should do this is to enable instantiating
> > > EventTarget objects using an EventTarget ctor. This won't give you a
> > > neato extension syntax, but I think we'll have to rely on ES.next for
> > > that. Before ecma-script has a better solution you can always
> > > monkeypatch the object.
> > > 
> > > So something like:
> > > a = new EventTarget();
> > > b = new EventTarget(a); // a is the parent in the target chain
> > > 
> > > should be doable. I don't know if we need a way to modify the parent
> > > chain after construction. It's somewhat complex to allow this while
> > > still preventing cycles from being created.
> > 
> > 
> > 
> > It would be great to see something like the above.
> 
> Unless someone explains how that graph model applies to the tree model we 
> have now and what the processing model around it will, I'm not sure this 
> will go anywhere.

It's exactly the same as we have now. It's just a tree with no nodes (i.e., they don't participate in a tree, initially at least). This works fine in the example I gave, the only difference being that one would not need to create a fake HTML element to get the desired behavior. 



-- 
Marcos Caceres

Received on Wednesday, 29 February 2012 14:34:53 UTC