Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset=utf-8>
<title>Node.childNodes caching bug</title>
<link rel=author title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<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>