1 description("Test to make sure shadow nodes are not exposed.");
3 var container = document.createElement("p");
4 document.body.appendChild(container);
6 container.appendChild(document.createTextNode("Some text: "));
8 shouldBe("getSelection().anchorNode", "null");
9 shouldBe("getSelection().anchorOffset", "0");
10 shouldBe("getSelection().focusNode", "null");
11 shouldBe("getSelection().focusOffset", "0");
12 shouldBe("getSelection().isCollapsed", "true");
13 shouldBe("getSelection().rangeCount", "0");
15 shouldBe("getSelection().baseNode", "null");
16 shouldBe("getSelection().baseOffset", "0");
17 shouldBe("getSelection().extentNode", "null");
18 shouldBe("getSelection().extentOffset", "0");
19 shouldBe("getSelection().type", "'None'");
21 debug("\nAdd an input element.\n");
23 var input = document.createElement("input");
24 container.appendChild(input);
29 shouldBe("getSelection().anchorNode", "container");
30 shouldBe("getSelection().anchorOffset", "1");
31 shouldBe("getSelection().focusNode", "container");
32 shouldBe("getSelection().focusOffset", "1");
33 shouldBe("getSelection().isCollapsed", "true");
34 shouldBe("getSelection().rangeCount", "1");
35 shouldBe("getSelection().getRangeAt(0).startContainer", "container");
36 shouldBe("getSelection().getRangeAt(0).startOffset", "1");
37 shouldBe("getSelection().getRangeAt(0).endContainer", "container");
38 shouldBe("getSelection().getRangeAt(0).endOffset", "1");
40 shouldBe("getSelection().baseNode", "container");
41 shouldBe("getSelection().baseOffset", "1");
42 shouldBe("getSelection().extentNode", "container");
43 shouldBe("getSelection().extentOffset", "1");
44 shouldBe("getSelection().type", "'Range'");
46 debug("\nAdd a textarea element.\n");
48 var textarea = document.createElement("textarea");
49 container.appendChild(textarea);
50 textarea.value = "text";
54 shouldBe("getSelection().anchorNode", "container");
55 shouldBe("getSelection().anchorOffset", "2");
56 shouldBe("getSelection().focusNode", "container");
57 shouldBe("getSelection().focusOffset", "2");
58 shouldBe("getSelection().isCollapsed", "true");
59 shouldBe("getSelection().rangeCount", "1");
60 shouldBe("getSelection().getRangeAt(0).startContainer", "container");
61 shouldBe("getSelection().getRangeAt(0).startOffset", "2");
62 shouldBe("getSelection().getRangeAt(0).endContainer", "container");
63 shouldBe("getSelection().getRangeAt(0).endOffset", "2");
65 shouldBe("getSelection().baseNode", "container");
66 shouldBe("getSelection().baseOffset", "2");
67 shouldBe("getSelection().extentNode", "container");
68 shouldBe("getSelection().extentOffset", "2");
69 shouldBe("getSelection().type", "'Range'");
71 document.body.removeChild(container);