Re: [whatwg/dom] Make it possible to observe connected-ness of a node (#533)

Just want to add my use case:

```html
<template>
  <p>My Custom Element with a menu</p>
  <button onclick="toggleMenu">Toggle</button>
  <x-menu>...</x-menu>
</template>
```

That template gets used in a Custom Element where I also call a utility function that takes the custom element as its one param, searches all its children looking for any `onevent` attributes which came from the template, and replaces them by registering an event listener - `element.addEventListener('click', e => this.toggleMenu(e))` - and removes the event property.

I'd like this utility function to also remove the listeners when the custom element is disconnected.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/533#issuecomment-1888452654
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/533/1888452654@github.com>

Received on Friday, 12 January 2024 05:20:21 UTC