-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
DOM: createElement and createElementNS with scoped registries #50925
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
annevk
added a commit
to annevk/WebKit
that referenced
this pull request
Feb 25, 2025
https://bugs.webkit.org/show_bug.cgi?id=288473 rdar://145557562 Reviewed by NOBODY (OOPS!). This makes a variety of changes to align ourselves with the latest Scoped Custom Element Registries proposal: 1. Accept DOMString in addition to ElementCreationOptions. This was already part of the DOM standard and is needed for compatibility. (Although to be fair the need has not been proven recently, but now does not seem like the time to find out.) 2. Have createElementNS take the same argument as createElementForBindings. 3. createHTMLElementWithNameValidation no longer needs both TreeScope and Document as they are once again the same. 4. Given that createHTMLElementWithNameValidation defaults registry to document.customElementRegistry it does not seem unlikely that registry is non-null so remove UNLIKELY there. 5. addToScopedCustomElementRegistryMap needs to be called by createElementForBindings and createElementNS as it's relevant for all elements. Since we only need to call it for scoped registries, we don't have to move the registry defaulting to document.customElementRegistry logic to these methods. Tests are upstreamed here: web-platform-tests/wpt#50925 * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElement.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElement.tentative.html: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElementNS.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElementNS.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/w3c-import.log: * Source/WebCore/dom/Document.cpp: (WebCore::createHTMLElementWithNameValidation): (WebCore::Document::createElementForBindings): (WebCore::Document::createElementNS): * Source/WebCore/dom/Document.h: * Source/WebCore/dom/Document.idl:
rniwa
approved these changes
Feb 25, 2025
webkit-commit-queue
pushed a commit
to annevk/WebKit
that referenced
this pull request
Feb 26, 2025
https://bugs.webkit.org/show_bug.cgi?id=288473 rdar://145557562 Reviewed by Ryosuke Niwa. This makes a variety of changes to align ourselves with the latest Scoped Custom Element Registries proposal: 1. Accept DOMString in addition to ElementCreationOptions. This was already part of the DOM standard and is needed for compatibility. (Although to be fair the need has not been proven recently, but now does not seem like the time to find out.) 2. Have createElementNS take the same argument as createElementForBindings. 3. createHTMLElementWithNameValidation no longer needs both TreeScope and Document as they are once again the same. 4. Given that createHTMLElementWithNameValidation defaults registry to document.customElementRegistry it does not seem unlikely that registry is non-null so remove UNLIKELY there. 5. addToScopedCustomElementRegistryMap needs to be called by createElementForBindings and createElementNS as it's relevant for all elements. Since we only need to call it for scoped registries, we don't have to move the registry defaulting to document.customElementRegistry logic to these methods. Tests are upstreamed here: web-platform-tests/wpt#50925 * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElement.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElement.tentative.html: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElementNS.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElementNS.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/w3c-import.log: * Source/WebCore/dom/Document.cpp: (WebCore::createHTMLElementWithNameValidation): (WebCore::Document::createElementForBindings): (WebCore::Document::createElementNS): * Source/WebCore/dom/Document.h: * Source/WebCore/dom/Document.idl: Canonical link: https://commits.webkit.org/291093@main
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For whatwg/dom#1341.