| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 | 5 |
| 6 <p id="before">Before</p> | 6 <p id="before">Before</p> |
| 7 <textarea id="textarea">Text</textarea> | 7 <textarea id="textarea">Text</textarea> |
| 8 <p id="after">After</p> | 8 <p id="after">After</p> |
| 9 | 9 |
| 10 <div id="console"></div> | 10 <div id="console"></div> |
| 11 <script> | 11 <script> |
| 12 description("Ensure that extending a selection beyond a textarea does not escape
outside its shadow root."); | 12 description("Ensure that extending a selection beyond a textarea does not escape
outside its shadow root."); |
| 13 | 13 |
| 14 var before = document.getElementById("before"); | 14 var before = document.getElementById("before"); |
| 15 var after = document.getElementById("after"); | 15 var after = document.getElementById("after"); |
| 16 var textarea = document.getElementById("textarea"); | 16 var textarea = document.getElementById("textarea"); |
| 17 | 17 |
| 18 textarea.focus(); |
| 18 textarea.setSelectionRange(0, 2); | 19 textarea.setSelectionRange(0, 2); |
| 19 var textareaSelection = internals.youngestShadowRoot(textarea).getSelection(); | 20 var textareaSelection = internals.youngestShadowRoot(textarea).getSelection(); |
| 20 var initialTextareaFocusNode = textareaSelection.focusNode; | 21 var initialTextareaFocusNode = textareaSelection.focusNode; |
| 21 | 22 |
| 22 var initialFocusNode = window.getSelection().focusNode; | 23 var initialFocusNode = window.getSelection().focusNode; |
| 23 var initialFocusOffset = window.getSelection().focusOffset; | 24 var initialFocusOffset = window.getSelection().focusOffset; |
| 24 | 25 |
| 25 shouldBe("textareaSelection.focusOffset", "2"); | 26 shouldBe("textareaSelection.focusOffset", "2"); |
| 26 | 27 |
| 27 textareaSelection.modify("extend", "forward", "character"); | 28 textareaSelection.modify("extend", "forward", "character"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode"); | 47 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode"); |
| 47 shouldBe("textareaSelection.focusOffset", "4"); | 48 shouldBe("textareaSelection.focusOffset", "4"); |
| 48 | 49 |
| 49 shouldBe("window.getSelection().focusNode", "initialFocusNode"); | 50 shouldBe("window.getSelection().focusNode", "initialFocusNode"); |
| 50 shouldBe("window.getSelection().focusOffset", "initialFocusOffset"); | 51 shouldBe("window.getSelection().focusOffset", "initialFocusOffset"); |
| 51 | 52 |
| 52 </script> | 53 </script> |
| 53 | 54 |
| 54 </body> | 55 </body> |
| 55 </html> | 56 </html> |
| OLD | NEW |