OLD | NEW |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script> | 9 <script> |
10 description("Test to make sure shadow nodes are not exposed."); | 10 description("Test to make sure shadow nodes are not exposed."); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 shouldBe("getSelection().rangeCount", "1"); | 43 shouldBe("getSelection().rangeCount", "1"); |
44 shouldBe("getSelection().getRangeAt(0).startContainer", "container"); | 44 shouldBe("getSelection().getRangeAt(0).startContainer", "container"); |
45 shouldBe("getSelection().getRangeAt(0).startOffset", "1"); | 45 shouldBe("getSelection().getRangeAt(0).startOffset", "1"); |
46 shouldBe("getSelection().getRangeAt(0).endContainer", "container"); | 46 shouldBe("getSelection().getRangeAt(0).endContainer", "container"); |
47 shouldBe("getSelection().getRangeAt(0).endOffset", "1"); | 47 shouldBe("getSelection().getRangeAt(0).endOffset", "1"); |
48 | 48 |
49 shouldBe("getSelection().baseNode", "container"); | 49 shouldBe("getSelection().baseNode", "container"); |
50 shouldBe("getSelection().baseOffset", "1"); | 50 shouldBe("getSelection().baseOffset", "1"); |
51 shouldBe("getSelection().extentNode", "container"); | 51 shouldBe("getSelection().extentNode", "container"); |
52 shouldBe("getSelection().extentOffset", "1"); | 52 shouldBe("getSelection().extentOffset", "1"); |
53 shouldBe("getSelection().type", "'Range'"); | 53 shouldBe("getSelection().type", "'Caret'"); |
yosin_UTC9
2017/02/14 04:52:21
Nice, finally, we get correct value of Selection#t
| |
54 | 54 |
55 debug("\nAdd a textarea element.\n"); | 55 debug("\nAdd a textarea element.\n"); |
56 | 56 |
57 var textarea = document.createElement("textarea"); | 57 var textarea = document.createElement("textarea"); |
58 container.appendChild(textarea); | 58 container.appendChild(textarea); |
59 textarea.value = "text"; | 59 textarea.value = "text"; |
60 textarea.focus(); | 60 textarea.focus(); |
61 textarea.select(); | 61 textarea.select(); |
62 | 62 |
63 shouldBe("getSelection().anchorNode", "container"); | 63 shouldBe("getSelection().anchorNode", "container"); |
64 shouldBe("getSelection().anchorOffset", "2"); | 64 shouldBe("getSelection().anchorOffset", "2"); |
65 shouldBe("getSelection().focusNode", "container"); | 65 shouldBe("getSelection().focusNode", "container"); |
66 shouldBe("getSelection().focusOffset", "2"); | 66 shouldBe("getSelection().focusOffset", "2"); |
67 shouldBe("getSelection().isCollapsed", "true"); | 67 shouldBe("getSelection().isCollapsed", "true"); |
68 shouldBe("getSelection().rangeCount", "1"); | 68 shouldBe("getSelection().rangeCount", "1"); |
69 shouldBe("getSelection().getRangeAt(0).startContainer", "container"); | 69 shouldBe("getSelection().getRangeAt(0).startContainer", "container"); |
70 shouldBe("getSelection().getRangeAt(0).startOffset", "2"); | 70 shouldBe("getSelection().getRangeAt(0).startOffset", "2"); |
71 shouldBe("getSelection().getRangeAt(0).endContainer", "container"); | 71 shouldBe("getSelection().getRangeAt(0).endContainer", "container"); |
72 shouldBe("getSelection().getRangeAt(0).endOffset", "2"); | 72 shouldBe("getSelection().getRangeAt(0).endOffset", "2"); |
73 | 73 |
74 shouldBe("getSelection().baseNode", "container"); | 74 shouldBe("getSelection().baseNode", "container"); |
75 shouldBe("getSelection().baseOffset", "2"); | 75 shouldBe("getSelection().baseOffset", "2"); |
76 shouldBe("getSelection().extentNode", "container"); | 76 shouldBe("getSelection().extentNode", "container"); |
77 shouldBe("getSelection().extentOffset", "2"); | 77 shouldBe("getSelection().extentOffset", "2"); |
78 shouldBe("getSelection().type", "'Range'"); | 78 shouldBe("getSelection().type", "'Caret'"); |
79 | 79 |
80 document.body.removeChild(container); | 80 document.body.removeChild(container); |
81 | 81 |
82 debug(""); | 82 debug(""); |
83 </script> | 83 </script> |
84 </body> | 84 </body> |
85 </html> | 85 </html> |
OLD | NEW |