Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>moveBefore() changing selector matching for moved elements</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#new_parent #target { color: green; }
</style>
<div id="new_parent"></div>
<div>
<div id="mv">
<div id="target">This text should be green</div>
</div>
</div>
<script>
test(() => {
document.body.offsetTop;
new_parent.moveBefore(mv, null);
assert_equals(getComputedStyle(target).color, "rgb(0, 128, 0)");
}, "moveBefore() should invalidate target when descendant selector changes");
</script>