blob: dc1cf3ad041f07346185085d596f42df01837f2e [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/js-test-pre.js"></script>
<div id=container>
</div>
<span id=el>
</span>
<script>
description('Test that DOMSubtreeModified listeners cannot cause inDocument to be incorrect');
var counter = 0;
var container = document.getElementById('container');
var el = document.getElementById('el');
function broken() {
if (++counter > 2) {
document.removeEventListener('DOMSubtreeModified', broken, true);
return;
}
container.appendChild(el);
}
document.addEventListener("DOMSubtreeModified", broken, true);
broken();
shouldBeTrue("document.contains(document.getElementById('el'))");
el.parentNode.removeChild(el);
el = null;
gc();
shouldBeNull("document.getElementById('el')");
</script>
<script src="../../resources/js-test-post.js"></script>