Closed Bug 2053628 Opened 8 days ago Closed 4 days ago

[wpt-sync] Sync PR 61154 - Allow replaceChildren() to replace a Document's children

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 61154 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/61154
Details from upstream follow.

Anne van Kesteren <annevk@annevk.nl> wrote:

Allow replaceChildren() to replace a Document's children

replaceChildren() removes the parent's existing children before inserting, so the "ensure pre-insert validity" checks must not count them. Previously the shared hierarchy-validation helper asserted that replaceChildren() on a Document that already has an element/doctype throws, which is wrong.

This updates the tests:

  • pre-insertion-validation-hierarchy.js: skip the cases that depend on pre-existing children for replaceChildren (mirroring the existing prepend skip). These remain asserted for append, prepend, insertBefore, and moveBefore, which do not remove the existing children.
  • ParentNode-replaceChildren.html: add coverage for Document parents — replaceChildren() with an element, a single-element DocumentFragment, a doctype, and no arguments all succeed; two elements and text still throw.

Spec change: a corresponding whatwg/dom PR generalizes the "ensure pre-insert validity" childToExclude into a list of children to exclude, which replaceChildren populates with all of the parent's children.

See https://github.com/whatwg/dom/issues/1045.

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 340 tests and 1 subtests

Status Summary

Firefox

OK : 5[GitHub] 316[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS : 19[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 147[GitHub] 14879[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 14881[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 14882[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 14888[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]
FAIL : 3[GitHub] 40[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 41[Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PRECONDITION_FAILED: 6
TIMEOUT : 1

Chrome

OK : 5
PASS : 147
FAIL : 3

Safari

OK : 5
PASS : 118
FAIL : 32

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /dom/nodes/crashtests/multiple-append-mutated-in-unload.https.html [wpt.fyi]: TIMEOUT
  • /dom/nodes/remove-from-shadow-host-and-adopt-into-iframe.html [wpt.fyi]: FAIL [Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt], PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt]
  • /dom/nodes/Document-contentType/contentType/contenttype_bmp.html [wpt.fyi]: SKIP
  • /dom/nodes/Document-createEvent.https.html [wpt.fyi]
    • TouchEvent should be an alias for TouchEvent.: PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview], PRECONDITION_FAILED [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
    • createEvent('TouchEvent') should be initialized correctly.: PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview], PRECONDITION_FAILED [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
    • touchevent should be an alias for TouchEvent.: PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview], PRECONDITION_FAILED [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
    • createEvent('touchevent') should be initialized correctly.: PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview], PRECONDITION_FAILED [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
    • TOUCHEVENT should be an alias for TouchEvent.: PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview], PRECONDITION_FAILED [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
    • createEvent('TOUCHEVENT') should be initialized correctly.: PASS [Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview], PRECONDITION_FAILED [Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
  • /dom/nodes/Node-lookupNamespaceURI.html [wpt.fyi]
    • Element has namespace URI matching prefix: FAIL
    • Comment should inherit namespace URI matching prefix: FAIL
    • Child element should inherit baz namespace: FAIL
    • Child element should have null namespace: FAIL
    • Child element has namespace URI matching prefix: FAIL
    • baz namespace is default for child: FAIL
    • childNamespace is default for child: FAIL
    • Document should have xhtml namespace, prefix null: FAIL
    • Document should have xhtml namespace, prefix "": FAIL
    • For document, baz namespace is not default: FAIL
    • For document, xhtml namespace is default: FAIL
  • /dom/nodes/Node-mutation-adoptNode.html [wpt.fyi]
    • Adopting an element into a different document update's the element's owner doc as well as the owner docs of it's attributes: FAIL
  • /dom/nodes/ParentNode-replaceChildren.html [wpt.fyi]
    • Document.replaceChildren() with an element, replacing an existing doctype and element.: FAIL (Chrome: FAIL, Safari: FAIL)
    • Document.replaceChildren() with a DocumentFragment containing a single element, replacing an existing doctype and element.: FAIL (Chrome: FAIL, Safari: FAIL)
    • Document.replaceChildren() with a doctype, replacing an existing doctype and element.: FAIL (Chrome: FAIL, Safari: FAIL)
  • /dom/nodes/adoption.window.html [wpt.fyi]
    • adoptNode() and DocumentFragment with host: FAIL
  • /dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.html [wpt.fyi]
    • <meta name=referrer> gets processed and applied in the post-insertion steps: FAIL
  • /dom/nodes/insertion-removing-steps/Node-appendChild-script-and-default-style-meta-from-fragment.html [wpt.fyi]
    • Inserting <meta> that uses alternate stylesheets, applies the style during DOM post-insertion steps: FAIL
  • /dom/nodes/insertion-removing-steps/Node-appendChild-script-and-iframe.html [wpt.fyi]
    • A script inserted atomically before an iframe (using a div) does not observe the iframe's contentWindow, since the 'script running' and 'iframe setup' both happen in order, after DOM insertion completes: FAIL
    • A script inserted atomically before an iframe (using a DocumentFragment) does not observe the iframe's contentWindow, since the 'script running' and 'iframe setup' both happen in order, after DOM insertion completes: FAIL
    • A script inserted atomically before an iframe (using a append() with multiple arguments) does not observe the iframe's contentWindow, since the 'script running' and 'iframe setup' both happen in order, after DOM insertion completes: FAIL
  • /dom/nodes/insertion-removing-steps/Node-appendChild-script-and-style.html [wpt.fyi]
    • An earlier-inserted <script> synchronously observes a later-inserted <style> (via a div) being applied: FAIL
    • An earlier-inserted <script> synchronously observes a later-inserted <style> (via a DocumentFragment) being applied: FAIL
    • Earlier-inserted <script> (via a DocumentFragment) synchronously observes a later-inserted <link rel=stylesheet>'s CSSStyleSheet creation: FAIL
    • Earlier-inserted <script> (via a div) synchronously observes a later-inserted <link rel=stylesheet>'s CSSStyleSheet creation: FAIL
    • Earlier-inserted <script> (via a append()) synchronously observes a later-inserted <link rel=stylesheet>'s CSSStyleSheet creation: FAIL
  • /dom/nodes/insertion-removing-steps/Node-appendChild-script-in-script.html [wpt.fyi]
    • An outer script whose preparation/execution gets triggered by the insertion of a 'nested'/'inner' script, executes before the inner script executes: FAIL
  • /dom/nodes/insertion-removing-steps/insertion-removing-steps-iframe.window.html [wpt.fyi]
    • Insertion steps: load event fires synchronously after iframe DOM insertion, as part of the iframe element's insertion steps: FAIL
    • Removing steps (innerHTML): script does not run synchronously during iframe destruction: FAIL
    • Removing steps (replaceChildren): script does not run synchronously during iframe destruction: FAIL
    • Removing steps (remove): script does not run synchronously during iframe destruction: FAIL
  • /dom/nodes/insertion-removing-steps/later-script-removed-by-earlier-script.html [wpt.fyi]
    • A later-inserted script removed by an earlier-inserted script in the same document fragment should not run: FAIL
    • A later-inserted script removed by an earlier-inserted script in the same append() call should not run: FAIL
  • /dom/nodes/moveBefore/preserve-render-blocking-script.html [wpt.fyi]
    • A moved script should keep its render-blocking state: FAIL
  • /dom/nodes/moveBefore/preserve-render-blocking-style.html [wpt.fyi]
    • A moved script should keep its render-blocking state: FAIL
  • /dom/nodes/moveBefore/selection-preserve.html [wpt.fyi]
    • moveBefore should not reset selection with preceding text: FAIL
    • moveBefore resets selection that enters a subtree, when the whole selection is moved: FAIL
    • moveBefore anchor node moved up to expand selection and absorb nodes: FAIL
    • moveBefore focus node moved up to shrink selection and exclude nodes; focus node gets reset: FAIL
    • moveBefore selection is not preserved, especially when underlying range gets inverted: FAIL

Tests Disabled in Gecko Infrastructure

Status: NEW → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
You need to log in before you can comment on or make changes to this bug.