-
Notifications
You must be signed in to change notification settings - Fork 6
/
35.html
32 lines (28 loc) · 1007 Bytes
/
35.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<title>IE 9 Range test</title>
<script>
window.onload = function() {
var range = document.createRange();
var div = document.getElementById("test");
var endTextNode = div.lastChild;
var startTextNode = div.firstChild.firstChild;
range.setStart(startTextNode, 1);
var endContainer = endTextNode, endOffset = 4;
range.setEnd(endContainer, endOffset);
alert(range.endContainer == endContainer && range.endOffset == endOffset);
endTextNode.splitText(4);
alert(range.endContainer == endContainer && range.endOffset == endOffset);
var startContainer = startTextNode.splitText(1);
alert(range.endContainer == endContainer && range.endOffset == endOffset);
range.setStart(startContainer, 0);
//range.setEnd(endContainer, endOffset);
alert(range.endContainer == endContainer && range.endOffset == endOffset);
};
</script>
</head>
<body>
<div id="test"><b>One</b> two three</div>
</body>
</html>