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