Index: LayoutTests/fast/dom/Range/selectNode-for-detached-node.html |
diff --git a/LayoutTests/fast/dom/Range/selectNode-for-detached-node.html b/LayoutTests/fast/dom/Range/selectNode-for-detached-node.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b19d637d81852a9a624762859dc83d8c863f762d |
--- /dev/null |
+++ b/LayoutTests/fast/dom/Range/selectNode-for-detached-node.html |
@@ -0,0 +1,20 @@ |
+<div id="container"> |
+<p id="description"></p> |
+<div id="sample">0123456789</div> |
+</div> |
+<div id="console"></div> |
+<script src="../../js/resources/js-test-pre.js"></script> |
+<script> |
+description('Range.selectNode() should not throw exception for detached node.'); |
+function $(id) { return document.getElementById(id); } |
+ |
+var sample = $('sample').cloneNode(true); |
+var range = document.createRange(); |
+ |
+shouldBe('range.selectNode(sample.firstChild); range.startContainer', 'sample'); |
+shouldThrow('range.selectNode(sample); range.startContainer', '"InvalidNodeTypeError: The supplied node is invalid or has an invalid ancestor for this operation."'); |
+ |
+if (window.testRunner) |
+ $('container').outerHTML = ''; |
+</script> |
+<script src="../../js/resources/js-test-post.js"></script> |