Skip to content

Commit

Permalink
Fix last child check.
Browse files Browse the repository at this point in the history
Ugh

Differential Revision: https://phabricator.services.mozilla.com/D224302

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1919031
gecko-commit: d8b7f10eb81d003d51523bbaea87ccc6b0b36abf
gecko-reviewers: smaug
  • Loading branch information
emilio authored and moz-wptsync-bot committed Oct 3, 2024
1 parent 947f66f commit db4fbbb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions dom/nodes/Node-childNodes-cache.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Node.childNodes caching bug</title>
<link rel=help href="https://bugzilla.mozilla.org/show_bug.cgi?id=1919031">
<link rel=author title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<link rel=author title="Mozilla" href="https://mozilla.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="target"><div id="first"></div><div id="second"></div><div id="third"></div><div id="last"></div></div>
<script>
test(function() {
let target = document.getElementById("target");
let second = target.childNodes[1];
assert_equals(second.id, "second");
second.remove();
assert_equals(target.childNodes[4], undefined, "Out of bounds elements are undefined");
assert_equals(target.childNodes[3], undefined, "Out of bounds elements are undefined");
assert_equals(target.childNodes.length, 3);
assert_equals(target.childNodes[0].id, "first");
assert_equals(target.childNodes[1].id, "third");
assert_equals(target.childNodes[2].id, "last");
});
</script>

0 comments on commit db4fbbb

Please sign in to comment.