| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <div id="sandbox" style="display:none"></div> | 2 <div id="sandbox" style="display:none"></div> |
| 3 <script src="../../js/resources/js-test-pre.js"></script> | 3 <script src="../../js/resources/js-test-pre.js"></script> |
| 4 <script> | 4 <script> |
| 5 description("Test MutationEvents interfering with MutationObservers: removing no
des 'out of order'"); | 5 description("Test MutationEvents interfering with MutationObservers: removing no
des 'out of order'"); |
| 6 var sandbox = document.getElementById('sandbox'); | 6 var sandbox = document.getElementById('sandbox'); |
| 7 var removed = false; | 7 var removed = false; |
| 8 sandbox.addEventListener('DOMNodeInserted', function() { | 8 sandbox.addEventListener('DOMNodeInserted', function() { |
| 9 if (!removed) { | 9 if (!removed) { |
| 10 sandbox.removeChild(sandbox.firstChild); | 10 sandbox.removeChild(sandbox.firstChild); |
| 11 removed = true; | 11 removed = true; |
| 12 } | 12 } |
| 13 }); | 13 }); |
| 14 var observer = new WebKitMutationObserver(function(){}); | 14 var observer = new MutationObserver(function(){}); |
| 15 observer.observe(sandbox, {childList: true}); | 15 observer.observe(sandbox, {childList: true}); |
| 16 sandbox.innerHTML = '<b></b><i></i>'; | 16 sandbox.innerHTML = '<b></b><i></i>'; |
| 17 | 17 |
| 18 var mutations = observer.takeRecords(); | 18 var mutations = observer.takeRecords(); |
| 19 shouldBe("mutations.length", "2"); | 19 shouldBe("mutations.length", "2"); |
| 20 shouldBe("mutations[0].addedNodes.length", "1"); | 20 shouldBe("mutations[0].addedNodes.length", "1"); |
| 21 shouldBe("mutations[0].removedNodes.length", "0"); | 21 shouldBe("mutations[0].removedNodes.length", "0"); |
| 22 shouldBe("mutations[0].addedNodes[0].tagName", "'B'"); | 22 shouldBe("mutations[0].addedNodes[0].tagName", "'B'"); |
| 23 shouldBe("mutations[1].addedNodes.length", "1"); | 23 shouldBe("mutations[1].addedNodes.length", "1"); |
| 24 shouldBe("mutations[1].removedNodes.length", "1"); | 24 shouldBe("mutations[1].removedNodes.length", "1"); |
| 25 shouldBe("mutations[1].removedNodes[0].tagName", "'B'"); | 25 shouldBe("mutations[1].removedNodes[0].tagName", "'B'"); |
| 26 shouldBe("mutations[1].addedNodes[0].tagName", "'I'"); | 26 shouldBe("mutations[1].addedNodes[0].tagName", "'I'"); |
| 27 </script> | 27 </script> |
| 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 |