28 lines
860 B
HTML
28 lines
860 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="newParent"></div>
|
|
<iframe href="#" id="target"></iframe>
|
|
<script>
|
|
description("Test that adoptNode fails safely if prevented by a DOM mutation.");
|
|
|
|
function run() {
|
|
newParent = document.getElementById("newParent");
|
|
target = document.getElementById("target");
|
|
target.contentWindow.addEventListener("unload", function () { newParent.appendChild(target); }, false);
|
|
target.focus();
|
|
var anotherDocument = document.implementation.createDocument("", "", null);
|
|
|
|
try { anotherDocument.adoptNode(target); } catch(e) {}
|
|
shouldBe("target.ownerDocument.location", "document.location");
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", run, false);
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|