Re: [w3c/webcomponents] How to avoid memory leaks when detecting custom elements? (#674)

@tomalec Yes, exactly, something like that. It just seems dirty not to have a way to clean up.

To paint a small picture of the problem:

> Suppose a lib has a custom element that needs to detect if certain child elements are `instanceof ACertainClass` regardless of what name the _end user_ of the library assigned the constructor to. 
> 
> The custom element would have to call `whenDefined(elementName)` of every child's name just to detect if _only some of them_ are instances of a constructor of interest.
> 
> So, if an application has thousands of nodes, this can lead to many Promises leaked inside of `customElements` which the HTML engine is waiting to `resolve()` but will never resolve them.

This problem still applies with @rniwa's [`whenDefined(elementInstance)` idea](https://github.com/w3c/webcomponents/issues/671#issuecomment-333006549).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/674#issuecomment-361034599

Received on Sunday, 28 January 2018 03:08:43 UTC