summaryrefslogtreecommitdiffstats
path: root/layout/reftests/webcomponents/cross-tree-selection-1.html
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/webcomponents/cross-tree-selection-1.html')
-rw-r--r--layout/reftests/webcomponents/cross-tree-selection-1.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/layout/reftests/webcomponents/cross-tree-selection-1.html b/layout/reftests/webcomponents/cross-tree-selection-1.html
new file mode 100644
index 000000000..1e4f02747
--- /dev/null
+++ b/layout/reftests/webcomponents/cross-tree-selection-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+ <script>
+ function tweak() {
+ var host = document.getElementById("host");
+ var shadow = host.createShadowRoot();
+
+ var textNode = document.createTextNode(" World");
+ shadow.appendChild(textNode);
+
+ // Create a selection with focus preceeding anchor
+ var selection = window.getSelection();
+ var range = document.createRange();
+ range.setStart(shadow, 1);
+ range.setEnd(shadow, 1);
+ selection.addRange(range);
+ selection.extend(shadow, 0);
+
+ // Extend selection into a different node tree
+ // (from ShadowRoot into the previous node in the parent node tree).
+ setTimeout(function() {
+ selection.extend(document.getElementById("previous"), 0);
+ document.documentElement.className = '';
+ }, 100);
+ }
+ </script>
+</head>
+<body onload="tweak()">
+<span id="previous">Hello</span><span id="host"></span>
+</body>
+</html>