Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / getElementById-consistency.html
blob1fce622dc995435fffa7e4c28f57e97d298cac8b
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <div id=container>
4 </div>
5 <span id=el>
6 </span>
7 <script>
8 description('Test that DOMSubtreeModified listeners cannot cause inDocument to be incorrect');
10 var counter = 0;
11 var container = document.getElementById('container');
12 var el = document.getElementById('el');
13 function broken() {
14 if (++counter > 2) {
15 document.removeEventListener('DOMSubtreeModified', broken, true);
16 return;
18 container.appendChild(el);
21 document.addEventListener("DOMSubtreeModified", broken, true);
22 broken();
23 shouldBeTrue("document.contains(document.getElementById('el'))");
24 el.parentNode.removeChild(el);
25 el = null;
26 gc();
27 shouldBeNull("document.getElementById('el')");
28 </script>