2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></script>
4 <div id=
"shadowHost"></div>
7 var shadowRoot
= shadowHost
.createShadowRoot();
8 shadowRoot
.innerHTML
= '<div id="editable" contenteditable>Test</div>';
9 var textNode
= shadowRoot
.querySelector("#editable").firstChild
;
10 var selection
= shadowRoot
.getSelection();
11 selection
.collapse(textNode
, textNode
.textContent
.length
);
13 var range
= selection
.getRangeAt(0);
14 assert_equals(range
.startContainer
, textNode
);
15 assert_equals(range
.startOffset
, textNode
.textContent
.length
);
16 assert_true(range
.collapsed
);
19 selection
.collapse(textNode
, 0);
20 selection
.extend(textNode
, 2);
22 var range
= selection
.getRangeAt(0);
23 assert_equals(range
.startContainer
, textNode
);
24 assert_equals(range
.startOffset
, 0);
25 assert_equals(range
.endContainer
, textNode
);
26 assert_equals(range
.endOffset
, 2);
27 assert_false(range
.collapsed
);
31 assert_not_equals(window
.getSelection().getRangeAt(0).anchorNode
, textNode
);
32 }, "Nodes in Shadow should not be exposed to window.getSelection()");