From e1141b2acd5e3ae3335984d060430b7dbc57841f Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 18 Dec 2024 22:42:25 +0000 Subject: [PATCH] Bug 1938060 [wpt PR 49758] - DOM: Move moveBefore() returns undefined, a=testonly Automatic update from web-platform-tests DOM: Move moveBefore() returns undefined See discussion in https://github.com/whatwg/dom/issues/1335. R=nrosenthal@chromium.org Bug: 40150299 Change-Id: I50aeafb913abb4b63480be4532254f367abf37b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097561 Reviewed-by: Noam Rosenthal Commit-Queue: Dominic Farolino Cr-Commit-Position: refs/heads/main@{#1397950} -- wpt-commits: 37cad0c49e62655850799c6f6ee165b3ceacebdd wpt-pr: 49758 --- .../moveBefore/tentative/Node-moveBefore.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/testing/web-platform/tests/dom/nodes/moveBefore/tentative/Node-moveBefore.html b/testing/web-platform/tests/dom/nodes/moveBefore/tentative/Node-moveBefore.html index a23678082669..64a76602d264 100644 --- a/testing/web-platform/tests/dom/nodes/moveBefore/tentative/Node-moveBefore.html +++ b/testing/web-platform/tests/dom/nodes/moveBefore/tentative/Node-moveBefore.html @@ -221,11 +221,22 @@ a.append(b); a.append(c); assert_array_equals(a.childNodes, [b, c]); - assert_equals(a.moveBefore(b, b), b); + assert_equals(a.moveBefore(c, b), undefined, "moveBefore() returns undefined"); + assert_array_equals(a.childNodes, [c, b]); +}, "moveBefore() returns undefined"); + +test(() => { + const a = document.body.appendChild(document.createElement("div")); + const b = document.createElement("div"); + const c = document.createElement("div"); + a.append(b); + a.append(c); + assert_array_equals(a.childNodes, [b, c]); + a.moveBefore(b, b); assert_array_equals(a.childNodes, [b, c]); - assert_equals(a.moveBefore(c, c), c); + a.moveBefore(c, c); assert_array_equals(a.childNodes, [b, c]); -}, "Inserting a node before itself should not move the node"); +}, "Moving a node before itself should not move the node"); test(() => { const disconnectedOrigin = document.createElement('div');