OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../js/resources/js-test-pre.js"></script> | 2 <script src="../js/resources/js-test-pre.js"></script> |
3 <div id=container> | 3 <div id=container> |
4 </div> | 4 </div> |
5 <span id=el> | 5 <span id=el> |
6 </span> | 6 </span> |
7 <script> | 7 <script> |
8 description('Test that DOMSubtreeModified listeners cannot cause DocumentOrdered
Map to be incorrect'); | 8 description('Test that DOMSubtreeModified listeners cannot cause DocumentOrdered
Map to be incorrect'); |
9 | 9 |
10 var counter = 0; | 10 var counter = 0; |
11 var container = document.getElementById('container'); | 11 var container = document.getElementById('container'); |
12 var el = document.getElementById('el'); | 12 var el = document.getElementById('el'); |
13 function broken() { | 13 function broken() { |
14 if (++counter > 2) { | 14 if (++counter > 2) { |
15 document.removeEventListener('DOMSubtreeModified', broken, true); | 15 document.removeEventListener('DOMSubtreeModified', broken, true); |
16 return; | 16 return; |
17 } | 17 } |
18 container.appendChild(el); | 18 container.appendChild(el); |
19 } | 19 } |
20 | 20 |
21 document.addEventListener("DOMSubtreeModified", broken, true); | 21 document.addEventListener("DOMSubtreeModified", broken, true); |
22 broken(); | 22 broken(); |
23 shouldBeTrue("document.contains(el)"); | 23 shouldBeTrue("document.contains(el)"); |
24 el.parentNode.removeChild(el); | 24 el.parentNode.removeChild(el); |
25 el = null; | 25 el = null; |
26 gc(); | 26 gc(); |
27 shouldBeNull("document.getElementById('el')"); | 27 shouldBeNull("document.getElementById('el')"); |
28 </script> | 28 </script> |
29 <script src="../js/resources/js-test-post.js"></script> | 29 <script src="../js/resources/js-test-post.js"></script> |
OLD | NEW |