blob: 888f4e584e60311e8505e6402d7f296f661c03e7 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.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>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>