blob: 560052f600961e0475b8002cdba613fe3c3d91ac [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<body>
<iframe src="about:blank"></iframe>
<script>
description("Test whether Range.selectNode and Range.selectNodeContents work across documents");
var otherDocument = document.implementation.createDocument(null, "doc", null);
var elem = otherDocument.createElement("elem");
otherDocument.documentElement.appendChild(elem);
var selectNodeRange = document.createRange();
selectNodeRange.selectNode(elem);
shouldBeTrue("selectNodeRange.startContainer === otherDocument.documentElement");
shouldBeTrue("selectNodeRange.endContainer === otherDocument.documentElement");
shouldBeTrue("selectNodeRange.startContainer.ownerDocument === otherDocument");
shouldBeTrue("selectNodeRange.endContainer.ownerDocument === otherDocument");
shouldBeTrue("selectNodeRange.cloneContents().ownerDocument === otherDocument");
var selectNodeContentsRange = document.createRange();
selectNodeContentsRange.selectNodeContents(elem);
shouldBeTrue("selectNodeRange.startContainer === otherDocument.documentElement");
shouldBeTrue("selectNodeRange.endContainer === otherDocument.documentElement");
shouldBeTrue("selectNodeContentsRange.startContainer.ownerDocument === otherDocument");
shouldBeTrue("selectNodeContentsRange.endContainer.ownerDocument === otherDocument");
shouldBeTrue("selectNodeRange.cloneContents().ownerDocument === otherDocument");
</script>
</body>
</html>