4 <script src=
"../../resources/js-test.js"></script>
7 description("Ensure that extending a selection to trailing spaces does not cause exceptions.");
9 var div
= document
.getElementById('test');
10 var selection
= window
.getSelection();
12 function testIt(text
) {
13 var len
= text
.length
;
14 div
.textContent
= text
;
15 selection
.collapse(div
.firstChild
, 0);
17 selection
.extend(div
.firstChild
, len
);
19 testFailed(div
.outerHTML
+ ': ' + String(e
.toString()));
23 selection
.extend(div
.firstChild
, len
+ 1);
24 testFailed(div
.outerHTML
+ ': ' + String(e
.toString()));
28 testPassed(div
.outerHTML
);