Re: [w3c/webcomponents] Is there a way to detect if a custom element was constructed during parsing? (#789)

`this.isConnected` and `this.parentNode` seems to be enough signal for elements created from parsing a fragment, e.g., run this in the console:

```
class Foo extends HTMLElement {
    constructor() {
        super();
        console.log(this.isConnected, this.parentNode);
    }
}
customElements.define('x-foo', Foo);
> undefined
new Foo()
> VM298:4 false null
> <x-foo>​</x-foo>​
document.body.innerHTML = '<x-foo></x-foo>'
> VM298:4 true <body class=​"logged-in env-production emoji-size-boost intent-mouse">​…​</body>​
> "<x-foo></x-foo>"
```

-- 
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/789#issuecomment-459437217

Received on Thursday, 31 January 2019 17:43:14 UTC