W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2015

Re: Callback when an event handler has been added to a custom element

From: Jonas Sicking <jonas@sicking.cc>
Date: Fri, 6 Nov 2015 14:02:28 -0800
Message-ID: <CA+c2ei98m3tQyV6zFiHzR+GvdZNnf0yLr+Vf9eBmQO_UAy-Fbw@mail.gmail.com>
To: Olli Pettay <olli@pettay.fi>
Cc: Justin Fagnani <justinfagnani@google.com>, Travis Leithead <travis.leithead@microsoft.com>, Mitar <mmitar@gmail.com>, public-webapps <public-webapps@w3.org>
On Fri, Nov 6, 2015 at 12:44 PM, Olli Pettay <olli@pettay.fi> wrote:
> On 11/06/2015 09:28 PM, Justin Fagnani wrote:
>> You can also override addEventListener/removeEventListener on your
>> element. My concern with that, and possibly an event listener change
>> callback, is
>> that it only works reliably for non-bubbling events.
> How even with those? One could just add capturing event listener higher up
> in the tree.
> You need to override addEventListener on EventTarget, and also relevant
> onfoo EventHandler setters on Window and Document and *Element prototypes,
> but unfortunately even that doesn't catch onfoo content attributes (<div
> onclick="doSomething">). But one could use MutationObserver then to
> observe changes to DOM.

This problem also applies to the original proposal in this thread.

Even if we add the ability to detect when an eventlistener is added to
a custom element, what happens if an eventlistener is added to an
ancestor node? Or if the custom element is moved into a new element
which already has an ancestor with such an event listener.

/ Jonas
Received on Friday, 6 November 2015 22:03:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:58 UTC