3 testRunner
.dumpEditingCallbacks();
8 var li
= document
.createElement("li");
9 li
.appendChild(document
.createTextNode(str
));
10 var console
= document
.getElementById("console");
11 console
.appendChild(li
);
14 function assert(bool
) {
21 <p>This tests the endpoints of a DOM Range object made from a selection around certain types elements. These endpoints shouldn't be at offsets inside nodes that aren't containers or text nodes.
</p>
22 <div id=
"test">Hello
<img src=
"../resources/abe.png"><object width=
"100"></object>world!
<br>Hello World!
</div>
23 <ul id=
"console"></ul>
26 var s
= window
.getSelection();
27 var e
= document
.getElementById("test");
30 if (window
.testRunner
)
31 window
.testRunner
.dumpAsText();
34 s
.setBaseAndExtent(e
, 0, e
, 1);
36 assert(r
.startContainer
== e
.childNodes
[0]);
37 assert(r
.startOffset
== 0);
38 assert(r
.endContainer
== e
.childNodes
[0]);
39 assert(r
.endOffset
== r
.endContainer
.length
);
42 s
.setBaseAndExtent(e
, 1, e
, 2);
44 assert(r
.startContainer
== e
);
45 assert(r
.startOffset
== 1);
46 assert(r
.endContainer
== e
);
47 assert(r
.endOffset
== 2);
50 s
.setBaseAndExtent(e
, 2, e
, 3);
52 assert(r
.startContainer
== e
);
53 assert(r
.startOffset
== 2);
54 assert(r
.endContainer
== e
);
55 assert(r
.endOffset
== 3);
58 s
.setBaseAndExtent(e
, 4, e
, 5);
60 assert(r
.startContainer
== e
);
61 assert(r
.startOffset
== 4);
62 assert(r
.endContainer
== e
);
63 assert(r
.endOffset
== 5);