-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CustomElements: upgrade runs connectedCallback on an element with a throwing constructor #563
Comments
Agree that running |
Indeed, we should make sure we only invoke reactions on a "defined" custom element. It just doesn't make much sense to invoke callback when it failed to construct/upgrade. |
Agreed that it should not run. These were moved early in the algorithm by whatwg/html#1366 for the reasons explained there. Given those reasons, I am not sure there is an elegant patch here where we avoid queuing in this sort of scenario. Probably the best solution is to just insert a "is not failed" check inside "invoke custom element reactions". Hmm. Or maybe whenever we set the state to failed, we empty the element's custom element reaction queue. |
It would be no problem to drain the queue of these failed elements. FWIW I think there may always be elements running around whose constructors threw, though; they can be created with 'new' which calls super(), discloses 'this', and then throws. We must continue to run callbacks for them because there's no effective way to detect them, that I know of. |
Fixes WICG/webcomponents#563, and an analogous issue when the constructor uses return-override, by ensuring that all exceptions go through the same path, which both sets the custom element state to "failed", and clears the custom element reaction queue.
Yeah. Such elements aren't failed; they're just elements with weird constructors, I guess. This is an inevitable consequence of us handing the constructor over to developers instead of using a createdCallback design. |
Fixes WICG/webcomponents#563, and an analogous issue when the constructor uses return-override, by ensuring that all exceptions go through the same path, which both sets the custom element state to "failed", and clears the custom element reaction queue.
Fixes WICG/webcomponents#563, and an analogous issue when the constructor uses return-override, by ensuring that all exceptions go through the same path, which both sets the custom element state to "failed", and clears the custom element reaction queue.
Upgrade runs connectedCallback on an element with a throwing constructor. After executing the following code
log
contains'connected'
.https://html.spec.whatwg.org/#concept-upgrade-an-element
enqueueing attributeChangedCallback, connectedCallback after custom element
s state check in Step 2 is not enough when the the element
s state is changed in Step 9.The text was updated successfully, but these errors were encountered: