[webkit-changes] [WebKit/WebKit] 7ef666: Fix createElement[NS]'s customElements handling

Anne van Kesteren noreply at github.com
Tue Feb 25 22:02:58 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7ef6667167291a0e18a54bc2b6e48242e6a4963d
      https://github.com/WebKit/WebKit/commit/7ef6667167291a0e18a54bc2b6e48242e6a4963d
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2025-02-25 (Tue, 25 Feb 2025)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElement.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElement.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElementNS.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/Document-createElementNS.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/revamped-scoped-registry/w3c-import.log
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Document.idl

  Log Message:
  -----------
  Fix createElement[NS]'s customElements handling
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:
https://github.com/web-platform-tests/wpt/pull/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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list