In a web component, can this throw? class MyComponent extends HTMLElement { constructor() { super(); this.constructed = true; } connectedCallback() { if (!this.constructed) throw 'Lifecycle design is important' } }
-
-
Right, but I think sync-calling connectedCallback post sync-calling the constructor would be fine. Like 2 lines var element = elementFactory() element.connectedCallback();
-
Having a hard time seeing how this could happen. super() should call into https://html.spec.whatwg.org/#htmlconstructor … but I can't see how that would call connectedCallback. Full repro case? In general this stuff is hard because given `new CustomElement()` we can't run code after that, only in super
- 3 more replies
New conversation -
-
-
So to answer the original question, I think that if somewhere in the constructor, `upgrade()` is called, you might see a synchronous call to `connectedCallback`. Looking for other ways for this to happen.
-
This is the relevant section: https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions …
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.
