1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description("Test to make sure shadow nodes are not exposed.");
12 var container
= document
.createElement("p");
13 document
.body
.appendChild(container
);
15 container
.appendChild(document
.createTextNode("Some text: "));
17 shouldBe("getSelection().anchorNode", "null");
18 shouldBe("getSelection().anchorOffset", "0");
19 shouldBe("getSelection().focusNode", "null");
20 shouldBe("getSelection().focusOffset", "0");
21 shouldBe("getSelection().isCollapsed", "true");
22 shouldBe("getSelection().rangeCount", "0");
24 shouldBe("getSelection().baseNode", "null");
25 shouldBe("getSelection().baseOffset", "0");
26 shouldBe("getSelection().extentNode", "null");
27 shouldBe("getSelection().extentOffset", "0");
28 shouldBe("getSelection().type", "'None'");
30 debug("\nAdd an input element.\n");
32 var input
= document
.createElement("input");
33 container
.appendChild(input
);
38 shouldBe("getSelection().anchorNode", "container");
39 shouldBe("getSelection().anchorOffset", "1");
40 shouldBe("getSelection().focusNode", "container");
41 shouldBe("getSelection().focusOffset", "1");
42 shouldBe("getSelection().isCollapsed", "true");
43 shouldBe("getSelection().rangeCount", "1");
44 shouldBe("getSelection().getRangeAt(0).startContainer", "container");
45 shouldBe("getSelection().getRangeAt(0).startOffset", "1");
46 shouldBe("getSelection().getRangeAt(0).endContainer", "container");
47 shouldBe("getSelection().getRangeAt(0).endOffset", "1");
49 shouldBe("getSelection().baseNode", "container");
50 shouldBe("getSelection().baseOffset", "1");
51 shouldBe("getSelection().extentNode", "container");
52 shouldBe("getSelection().extentOffset", "1");
53 shouldBe("getSelection().type", "'Range'");
55 debug("\nAdd a textarea element.\n");
57 var textarea
= document
.createElement("textarea");
58 container
.appendChild(textarea
);
59 textarea
.value
= "text";
63 shouldBe("getSelection().anchorNode", "container");
64 shouldBe("getSelection().anchorOffset", "2");
65 shouldBe("getSelection().focusNode", "container");
66 shouldBe("getSelection().focusOffset", "2");
67 shouldBe("getSelection().isCollapsed", "true");
68 shouldBe("getSelection().rangeCount", "1");
69 shouldBe("getSelection().getRangeAt(0).startContainer", "container");
70 shouldBe("getSelection().getRangeAt(0).startOffset", "2");
71 shouldBe("getSelection().getRangeAt(0).endContainer", "container");
72 shouldBe("getSelection().getRangeAt(0).endOffset", "2");
74 shouldBe("getSelection().baseNode", "container");
75 shouldBe("getSelection().baseOffset", "2");
76 shouldBe("getSelection().extentNode", "container");
77 shouldBe("getSelection().extentOffset", "2");
78 shouldBe("getSelection().type", "'Range'");
80 document
.body
.removeChild(container
);