Skip to content

Commit e3c923f

Browse files
domfarolinosadym-chromium
authored andcommitted
DOM: Move moveBefore() returns undefined
See discussion in whatwg/dom#1335. [email protected] Bug: 40150299 Change-Id: I50aeafb913abb4b63480be4532254f367abf37b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097561 Reviewed-by: Noam Rosenthal <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1397950}
1 parent 8a89bf8 commit e3c923f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

dom/nodes/moveBefore/tentative/Node-moveBefore.html

+14-3
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,22 @@
221221
a.append(b);
222222
a.append(c);
223223
assert_array_equals(a.childNodes, [b, c]);
224-
assert_equals(a.moveBefore(b, b), b);
224+
assert_equals(a.moveBefore(c, b), undefined, "moveBefore() returns undefined");
225+
assert_array_equals(a.childNodes, [c, b]);
226+
}, "moveBefore() returns undefined");
227+
228+
test(() => {
229+
const a = document.body.appendChild(document.createElement("div"));
230+
const b = document.createElement("div");
231+
const c = document.createElement("div");
232+
a.append(b);
233+
a.append(c);
234+
assert_array_equals(a.childNodes, [b, c]);
235+
a.moveBefore(b, b);
225236
assert_array_equals(a.childNodes, [b, c]);
226-
assert_equals(a.moveBefore(c, c), c);
237+
a.moveBefore(c, c);
227238
assert_array_equals(a.childNodes, [b, c]);
228-
}, "Inserting a node before itself should not move the node");
239+
}, "Moving a node before itself should not move the node");
229240

230241
test(() => {
231242
const disconnectedOrigin = document.createElement('div');

0 commit comments

Comments
 (0)