Skip to content
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

Merged
merged 8 commits into from
Jun 30, 2023

Conversation

keithamus
Copy link
Contributor

@keithamus keithamus commented Apr 21, 2023

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.

(See WHATWG Working Mode: Changes for more details.)


/acknowledgements.html ( diff )
/custom-elements.html ( diff )

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.
source Show resolved Hide resolved
webkit-commit-queue pushed a commit to rniwa/WebKit that referenced this pull request Apr 22, 2023
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
source Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
webkit-commit-queue pushed a commit to rniwa/WebKit that referenced this pull request Jun 7, 2023
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
@keithamus keithamus marked this pull request as ready for review June 8, 2023 22:12
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 17, 2023
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
aarongable pushed a commit to chromium/chromium that referenced this pull request Jun 20, 2023
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2023
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2023
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}
@keithamus
Copy link
Contributor Author

@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?

mnutt pushed a commit to movableink/webkit that referenced this pull request Jun 28, 2023
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
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 28, 2023
…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
Copy link
Member

@zcorpan zcorpan left a 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

@zcorpan zcorpan merged commit 76204f7 into whatwg:main Jun 30, 2023
1 check passed
@keithamus keithamus deleted the add-customelements-getname-constructor branch June 30, 2023 13:55
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jul 1, 2023
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jul 1, 2023
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jul 1, 2023
…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
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jul 5, 2023
…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
foolip added a commit to web-platform-tests/wpt that referenced this pull request May 16, 2024
This test was made tentative in #40606 because the spec change hadn't landed, but it now has:
whatwg/html#9195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants