2 <p id=
"description"></p>
3 <div id=
"sample">foobarbaz
</div>
5 <script src=
"../../resources/js-test.js"></script>
7 description('Check selection updated after splitText.');
8 function $(id
) { return document
.getElementById(id
); }
9 var range
= document
.createRange();
10 range
.setStart($('sample').firstChild
, 6);
11 range
.setEnd($('sample').firstChild
, $('sample').firstChild
.length
);
12 var selection
= getSelection();
13 selection
.removeAllRanges();
14 selection
.addRange(range
);
15 var newText
= range
.startContainer
.splitText(3);
16 shouldBeEqualToString('selection.type', 'Range');
17 shouldBe('selection.anchorNode', 'newText');
18 shouldBe('selection.anchorOffset', '3');
19 shouldBe('selection.focusNode', 'newText');
20 shouldBe('selection.focusOffset', '6');
21 shouldBeEqualToString('selection.toString()', 'baz');
22 if (window
.testRunner
)
23 $('container').outerHTML
= '';
25 <script src=
"../../resources/js-test.js"></script>