-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add tests for microtask checkpoints and custom element constructors #5208
Conversation
Firefox (nightly channel)Testing web-platform-tests at revision 1c31f4d All results1 test ran/custom-elements/microtasks-and-constructors.html
|
Chrome (unstable channel)Testing web-platform-tests at revision 1c31f4d All results1 test ran/custom-elements/microtasks-and-constructors.html
|
Notifying @alsemenov, @deepak-sa, @dominiccooney, @hayatoito, @kojiishi, @rniwa, @sgrekhov, and @TakayoshiKochi. (Learn how reviewing works.) |
These tests are now available on w3c-test.org |
Firefox (nightly channel)Testing web-platform-tests at revision 8db354b All results1 test ran/custom-elements/microtasks-and-constructors.html
|
Chrome (unstable channel)Testing web-platform-tests at revision 8db354b All results1 test ran/custom-elements/microtasks-and-constructors.html
|
Fixes part of whatwg/html#2381. The other part is covered by whatwg/html#2457. Tests: web-platform-tests/wpt#5208
This fixes part of #2381 (the other part is in DOM's "create an element"). Note this has two consequences, as discussed there: * Properly managing the entry and incumbent concepts. This is technically unobservable in the current spec landscape. * Ensuring microtasks are run, if the construct is initiated with an empty stack (such as during the parser). Tests: web-platform-tests/wpt#5208
const xBad = document.querySelector("x-bad"); | ||
assert_false(xBad.hasAttribute("attribute"), "The attribute must not be present"); | ||
assert_true(xBad instanceof HTMLUnknownElement, "The element must be a HTMLUnknownElement"); | ||
}, "Microtasks evaluate immediately when the stack is empty inside the parser, causing the " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this description, is it in reference to a check somewhere in https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element?
AFAICT, the test is either asserting that the doMicrotasks
bit above hasn't run yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's referring to the last step in https://html.spec.whatwg.org/#clean-up-after-running-script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so the microtask is in fact run, the attribute is added, then there's some "checks on no attributes" that I guess happens as part of the upgrade. I couldn't find an explicit attribute-related check anywhere.
I played a bit with the test and figured out that I don't understand custom elements. The this
in in this.setAttribute
isn't the same thing as xBad
is later. I suppose that's only natural, one can't turn an instance of HTMLUnknownElement into an instance of something else.
Some links to help guide the less familiar reader (me) might be nice, but I'll merge this and that can be an optional follow-up.
d6b5696
to
8f933fe
Compare
LintPassed |
This fixes part of whatwg#2381 (the other part is in DOM's "create an element"). Note this has two consequences, as discussed there: * Properly managing the entry and incumbent concepts. This is technically unobservable in the current spec landscape. * Ensuring microtasks are run, if the construct is initiated with an empty stack (such as during the parser). Tests: web-platform-tests/wpt#5208
Follows whatwg/html#2457 and whatwg/dom#430.
/cc @rniwa
This change is