Skip to content

Commit

Permalink
DOM: Move moveBefore() returns undefined
Browse files Browse the repository at this point in the history
See discussion in whatwg/dom#1335.

[email protected]

Bug: 40150299
Change-Id: I50aeafb913abb4b63480be4532254f367abf37b7
  • Loading branch information
domfarolino authored and chromium-wpt-export-bot committed Dec 18, 2024
1 parent 16fab63 commit a6dbd13
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions dom/nodes/moveBefore/tentative/Node-moveBefore.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit a6dbd13

Please sign in to comment.