layout/reftests/webcomponents/cross-tree-selection-1.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html class="reftest-wait">
michael@0 3 <head>
michael@0 4 <script>
michael@0 5 function tweak() {
michael@0 6 var host = document.getElementById("host");
michael@0 7 var shadow = host.createShadowRoot();
michael@0 8
michael@0 9 var textNode = document.createTextNode(" World");
michael@0 10 shadow.appendChild(textNode);
michael@0 11
michael@0 12 // Create a selection with focus preceeding anchor
michael@0 13 var selection = window.getSelection();
michael@0 14 var range = document.createRange();
michael@0 15 range.setStart(shadow, 1);
michael@0 16 range.setEnd(shadow, 1);
michael@0 17 selection.addRange(range);
michael@0 18 selection.extend(shadow, 0);
michael@0 19
michael@0 20 // Extend selection into a different node tree
michael@0 21 // (from ShadowRoot into the previous node in the parent node tree).
michael@0 22 setTimeout(function() {
michael@0 23 selection.extend(document.getElementById("previous"), 0);
michael@0 24 document.documentElement.className = '';
michael@0 25 }, 100);
michael@0 26 }
michael@0 27 </script>
michael@0 28 </head>
michael@0 29 <body onload="tweak()">
michael@0 30 <span id="previous">Hello</span><span id="host"></span>
michael@0 31 </body>
michael@0 32 </html>

mercurial