Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a2af12e3970773ee05a85ed0ffa09939df2510b7
      
https://github.com/WebKit/WebKit/commit/a2af12e3970773ee05a85ed0ffa09939df2510b7
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-26 (Sun, 26 Jul 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-xhtml-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-xhtml.xhtml
    M Source/WebCore/editing/markup.cpp

  Log Message:
  -----------
  createContextualFragment() leaves nested <head>/<body> behind when stripping 
a stray <html> element
https://bugs.webkit.org/show_bug.cgi?id=320228
rdar://183163523

Reviewed by Chris Dumez.

This patch aligns WebKit with Blink / Chromium.

collectElementsToRemoveFromFragment() recurses into a stray <html>
element to find any nested <head>/<body> elements that also need to
be stripped, but discarded the recursive call's return value, so
those nested elements were never added to the removal list and
survived fragment sanitization.

Fold the recursive result into the outer list instead of discarding it.

Test: 
imported/w3c/web-platform-tests/domparsing/createContextualFragment-xhtml.xhtml

* 
LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-xhtml-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-xhtml.xhtml:
 Added.
* Source/WebCore/editing/markup.cpp:
(WebCore::collectElementsToRemoveFromFragment):

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



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

Reply via email to