-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add a test for CustomElementRegistry.initialize upgrading custom elements per https://github.com/whatwg/html/pull/11913. #56034
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
Conversation
annevk
left a comment
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.
Looks good, but console.log issue needs to be addressed.
| <body> | ||
| <script> | ||
|
|
||
| function runTest(title, makeDocument, makeCustomElementRegistry) { |
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.
Nit: we don't need makeCustomElementRegistry it seems as it's always the same.
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.
Sure, removed.
|
|
||
| const registry2 = makeCustomElementRegistry(); | ||
| undefinedElement2 = doc1.createElementNS(htmlNS, 'a-b', {customElementRegistry: registry2}); | ||
| console.log(undefinedElement2); |
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.
console.log should be removed.
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.
Oops, removed.
8c2b5ba to
10333de
Compare
| registry.define('a-b', class ABElement extends HTMLElement { }); | ||
| assert_equals(element.customElementRegistry, null); | ||
| registry.initialize(element); | ||
| assert_equals(element.customElementRegistry, registry); |
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.
Do we also want to assert that element is an instance of ABElement here?
|
Like mentioned in whatwg/html#11913 (comment), we probably want to add a test to verify that the descendant with the same registry also gets upgraded in the initialize call. |
CustomElementRegistry's upgrade() wasn't adjusted for scoped registries and we decided that initialize() should upgrade as well (but not into shadow trees as upgrade() does). The initialize() design here favors a single tree traversal for setting the registry and then upgrading the element. Tests: - web-platform-tests/wpt#56034 - web-platform-tests/wpt#56132 Fixes #11858 and fixes #11908.
No description provided.