Re: [DOM4] EventTarget as first class citizen

On Sat, Mar 3, 2012 at 15:40, Jonas Sicking <jonas@sicking.cc> wrote:
> Note, I don't think that anyone is suggesting to add
> .parentNode/.eventTargetParent to the EventTarget interface. But
> rather just to objects instantiated through the constructor described
> in this thread.

FWIW, some JS libraries have custom EventTarget implementations and
they use parentEventTarget as a way to determine how to do the
propagation.

One problem with only allowing the parent in the constructor is that
it becomes read only. Most use cases for custom EventTargets that
involve propagation also requires being able to reparent that objects.

> We can either do that by inserting another interface which just
> contains this new property. Or by adding the property on the instances
> themselves. I don't have a strong opinion either way, but it would
> seem nice if we can still call the constructor 'EventTarget'.

Another option is to allow manual propagation. It still requires that
the EventTarget is extended so maybe it is just simple to have a new
property?

-- 
erik

Received on Monday, 5 March 2012 18:27:25 UTC