Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e02b5154b40cd2aa151b02eba109400a6dfed69a
      
https://github.com/WebKit/WebKit/commit/e02b5154b40cd2aa151b02eba109400a6dfed69a
  Author: Ryosuke Niwa <[email protected]>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/custom-elements/registries/Element-innerHTML-expected.txt
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/editing/markup.cpp

  Log Message:
  -----------
  Fix two remaining failures in 
custom-elements/registries/Element-innerHTML.html
https://bugs.webkit.org/show_bug.cgi?id=319547

Reviewed by Anne van Kesteren.

The failures are caused by not respecting null custom element registry flag set 
in context nodes:

1. insertAdjacentHTML (afterend into a null-registry shadow root): For 
beforebegin/afterend,
   the context node is the parent - here a shadow root created with 
shadowrootcustomelementregistry
   (null registry). Since a shadow root isn't an Element, 
contextElementForInsertion synthesizes
   an HTMLBodyElement for parsing, but that fresh body didn't carry the 
null-registry flag, so
   registryForElement erroneously returned the window registry.
2. createContextualFragment on a range inside a template: The context element 
is the template
   element itself, so registryForElement(template) returned the template's 
scoped registry. But
   parsing goes into the template contents owner document (which uses a null 
registry), so the
   fragment should use the contents' registry, not the template element's.

Test: 
imported/w3c/web-platform-tests/custom-elements/registries/Element-innerHTML.html

* 
LayoutTests/imported/w3c/web-platform-tests/custom-elements/registries/Element-innerHTML-expected.txt:
* Source/WebCore/dom/Element.cpp:
(WebCore::contextElementForInsertion):
* Source/WebCore/editing/markup.cpp:
(WebCore::createContextualFragment):

Canonical link: https://commits.webkit.org/317332@main



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

Reply via email to