blob: edd90934f165f59b71ad225c5a59be22ed24b910 [file] [log] [blame]
<!DOCTYPE html>
<body>
<script src="../../../resources/js-test-pre.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var observer = new MutationObserver(function(mutations, observer) {
window.mutations = mutations;
});
observer.observe(document.body, {childList: true, subtree:true});
</script>
<p>
Mutation records should be delivered for all parser mutations after the above script.
</p>
<!-- Test parserRemoveChild and takeAllChildrenFrom doing the adoption agency algorithm. -->
<a><figure><iframe></iframe></a>
<!-- Test parserInsertBefore doing hoisting of elements from tables. -->
<table>
<div></div>
</table>
<script>
shouldBe('mutations.length', '22');
for (var i = 0; i < mutations.length; i++)
shouldBeEqualToString('mutations[' + i + '].type', 'childList');
shouldBeEqualToString('mutations[1].target.tagName', 'BODY');
shouldBe('mutations[1].addedNodes.length', '1');
shouldBeEqualToString('mutations[1].addedNodes[0].tagName', 'P');
shouldBeEqualToString('mutations[9].target.tagName', 'A');
shouldBeEqualToString('mutations[9].removedNodes[0].tagName', 'FIGURE');
shouldBe('mutations[9].removedNodes.length', '1');
shouldBe('mutations[9].addedNodes.length', '0');
shouldBeEqualToString('mutations[18].target.tagName', 'FIGURE');
shouldBe('mutations[18].addedNodes.length', '1');
shouldBe('mutations[18].removedNodes.length', '0');
shouldBeEqualToString('mutations[18].addedNodes[0].tagName', 'DIV');
</script>
</body>