-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 customElements.getName(constructor) #9195
Add customElements.getName(constructor) #9195
Conversation
In CustomElements v0 you could use the `.name` field to get the defined tag name, but CustomElements v1 does not offer such a field. `localName` can be used within an instance but this prohibits use in, for example, static methods. This was discussed in the WCCG F2F, tracked in WICG/webcomponents#566. The conclusion of the F2F was to write up a spec change and WPT tests.
https://bugs.webkit.org/show_bug.cgi?id=255778 Reviewed by Alexey Shvayka and Chris Dumez. Implement whatwg/html#9195 with test cases added in web-platform-tests/wpt#39640. * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry.html: * Source/WebCore/dom/CustomElementRegistry.cpp: (WebCore::CustomElementRegistry::getName): Added. * Source/WebCore/dom/CustomElementRegistry.h: * Source/WebCore/dom/CustomElementRegistry.idl: Canonical link: https://commits.webkit.org/263281@main
https://bugs.webkit.org/show_bug.cgi?id=257759 Reviewed by Chris Dumez. Update the implementation of CustomElementsRegistry.prototype.getName to match the latest PR. Namely, it now returns DOMString? instead of (DOMString or undefined): whatwg/html#9195 web-platform-tests/wpt#39640 * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry.html: * Source/WebCore/dom/CustomElementRegistry.cpp: (WebCore::CustomElementRegistry::getName): * Source/WebCore/dom/CustomElementRegistry.h: * Source/WebCore/dom/CustomElementRegistry.idl: Canonical link: https://commits.webkit.org/264916@main
The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1
The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <[email protected]> Reviewed-by: Mason Freed <[email protected]> Commit-Queue: Xiaocheng Hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160209}
The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <[email protected]> Reviewed-by: Mason Freed <[email protected]> Commit-Queue: Xiaocheng Hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160209}
The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <[email protected]> Reviewed-by: Mason Freed <[email protected]> Commit-Queue: Xiaocheng Hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160209}
@annevk @rniwa @zcorpan how happy are we to merge this? Is there a gate before doing so? I2S on Chrome has been posted: https://groups.google.com/a/chromium.org/g/blink-dev/c/vOadD_Up5B0/m/3Ezs2SxRDAAJ and Safari TP includes it. Is there anything more I can do? |
https://bugs.webkit.org/show_bug.cgi?id=257759 Reviewed by Chris Dumez. Update the implementation of CustomElementsRegistry.prototype.getName to match the latest PR. Namely, it now returns DOMString? instead of (DOMString or undefined): whatwg/html#9195 web-platform-tests/wpt#39640 * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/CustomElementRegistry.html: * Source/WebCore/dom/CustomElementRegistry.cpp: (WebCore::CustomElementRegistry::getName): * Source/WebCore/dom/CustomElementRegistry.h: * Source/WebCore/dom/CustomElementRegistry.idl: Canonical link: https://commits.webkit.org/264916@main
…ts to a tentative test file, a=testonly Automatic update from web-platform-tests Move CustomElementRegistry.getName() tests to a tentative test file The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <[email protected]> Reviewed-by: Mason Freed <[email protected]> Commit-Queue: Xiaocheng Hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160209} -- wpt-commits: 99ee1f53f877610adf1f29399ea9660905e6d7a9 wpt-pr: 40606
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've fixed wrapping. LGTM
…ts to a tentative test file, a=testonly Automatic update from web-platform-tests Move CustomElementRegistry.getName() tests to a tentative test file The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <xiaochenghchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Commit-Queue: Xiaocheng Hu <xiaochenghchromium.org> Cr-Commit-Position: refs/heads/main{#1160209} -- wpt-commits: 99ee1f53f877610adf1f29399ea9660905e6d7a9 wpt-pr: 40606 UltraBlame original commit: ff55e5770af6e99f114c0593f02f296318fa584f
…ts to a tentative test file, a=testonly Automatic update from web-platform-tests Move CustomElementRegistry.getName() tests to a tentative test file The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <xiaochenghchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Commit-Queue: Xiaocheng Hu <xiaochenghchromium.org> Cr-Commit-Position: refs/heads/main{#1160209} -- wpt-commits: 99ee1f53f877610adf1f29399ea9660905e6d7a9 wpt-pr: 40606 UltraBlame original commit: ff55e5770af6e99f114c0593f02f296318fa584f
…ts to a tentative test file, a=testonly Automatic update from web-platform-tests Move CustomElementRegistry.getName() tests to a tentative test file The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <xiaochenghchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Commit-Queue: Xiaocheng Hu <xiaochenghchromium.org> Cr-Commit-Position: refs/heads/main{#1160209} -- wpt-commits: 99ee1f53f877610adf1f29399ea9660905e6d7a9 wpt-pr: 40606 UltraBlame original commit: ff55e5770af6e99f114c0593f02f296318fa584f
…ts to a tentative test file, a=testonly Automatic update from web-platform-tests Move CustomElementRegistry.getName() tests to a tentative test file The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] whatwg/html#9195 [2] web-platform-tests/interop#358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu <[email protected]> Reviewed-by: Mason Freed <[email protected]> Commit-Queue: Xiaocheng Hu <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160209} -- wpt-commits: 99ee1f53f877610adf1f29399ea9660905e6d7a9 wpt-pr: 40606
This test was made tentative in #40606 because the spec change hadn't landed, but it now has: whatwg/html#9195
In CustomElements v0 you could use the
.name
field to get the defined tag name, but CustomElements v1 does not offer such a field.localName
can be used within an instance but this prohibits use in, for example, static methods.This was discussed in the WCCG F2F, tracked in
WICG/webcomponents#566. The conclusion of the F2F was to write up a spec change and WPT tests.
Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): …Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): …(See WHATWG Working Mode: Changes for more details.)
/acknowledgements.html ( diff )
/custom-elements.html ( diff )