OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <p> | 3 <p> |
4 On Mac when word-selecting backwards starting with the | 4 On Mac when word-selecting backwards starting with the |
5 caret on the middle of a word and then word-selecting forward, the | 5 caret on the middle of a word and then word-selecting forward, the |
6 caret is left in the same place where it was, instead of directly selecting to t
he end | 6 caret is left in the same place where it was, instead of directly selecting to t
he end |
7 of the word (which is windows/unix behavior). | 7 of the word (which is windows/unix behavior). |
8 </p> | 8 </p> |
9 | 9 |
10 <div id="test-div" contenteditable=true> | 10 <div id="test-div" contenteditable=true> |
(...skipping 30 matching lines...) Expand all Loading... |
41 document.write(s === expectedText ? "PASS" : 'FAIL: expected "' + escape
(expectedText) + '", got "' + escape(s) + '"'); | 41 document.write(s === expectedText ? "PASS" : 'FAIL: expected "' + escape
(expectedText) + '", got "' + escape(s) + '"'); |
42 document.write("<br>"); | 42 document.write("<br>"); |
43 } | 43 } |
44 | 44 |
45 var node = document.getElementById("test-div"); | 45 var node = document.getElementById("test-div"); |
46 var children = node.childNodes; | 46 var children = node.childNodes; |
47 | 47 |
48 var wordCaretFunction = getSetCaretFunction(node, children[2], children[2].d
ata.search("ne 2")); | 48 var wordCaretFunction = getSetCaretFunction(node, children[2], children[2].d
ata.search("ne 2")); |
49 | 49 |
50 document.write(behavior + ":<br>"); | 50 document.write(behavior + ":<br>"); |
51 runTest("backward", "forward", "word", behavior == "mac" ? "" : "ne", getSet
CaretFunction(node, children[2], children[2].data.search("ne 2"))); | 51 runTest("backward", "forward", "word", behavior == "mac" ? "" : behavior ==
"win" ? "ne " : "ne", getSetCaretFunction(node, children[2], children[2].data.se
arch("ne 2"))); |
52 runTest("forward", "backward", "word", behavior == "mac" ? "" : "li", getSet
CaretFunction(node, children[2], children[2].data.search("ne 2"))); | 52 runTest("forward", "backward", "word", behavior == "mac" ? "" : "li", getSet
CaretFunction(node, children[2], children[2].data.search("ne 2"))); |
53 runTest("backward", "forward", "line", behavior == "mac" ? "" : "1\nline ",
getSetCaretFunction(node, children[0], children[0].data.search("1"))); | 53 runTest("backward", "forward", "line", behavior == "mac" ? "" : "1\nline ",
getSetCaretFunction(node, children[0], children[0].data.search("1"))); |
54 runTest("forward", "backward", "line", behavior == "mac" ? "" : "2\nline ",
getSetCaretFunction(node, children[4], children[4].data.search("3"))); | 54 runTest("forward", "backward", "line", behavior == "mac" ? "" : "2\nline ",
getSetCaretFunction(node, children[4], children[4].data.search("3"))); |
55 runTest("backward", "forward", "paragraph", behavior == "mac" ? "" : "1\nlin
e ", getSetCaretFunction(node, children[0], children[0].data.search("1"))); | 55 runTest("backward", "forward", "paragraph", behavior == "mac" ? "" : "1\nlin
e ", getSetCaretFunction(node, children[0], children[0].data.search("1"))); |
56 runTest("forward", "backward", "paragraph", behavior == "mac" ? "" : "2\nlin
e ", getSetCaretFunction(node, children[4], children[4].data.search("3"))); | 56 runTest("forward", "backward", "paragraph", behavior == "mac" ? "" : "2\nlin
e ", getSetCaretFunction(node, children[4], children[4].data.search("3"))); |
57 } | 57 } |
58 | 58 |
59 editingTest("mac"); | 59 editingTest("mac"); |
60 editingTest("win"); | 60 editingTest("win"); |
61 editingTest("unix"); | 61 editingTest("unix"); |
62 editingTest("android"); | 62 editingTest("android"); |
63 | 63 |
64 var node = document.getElementById("test-div"); | 64 var node = document.getElementById("test-div"); |
65 node.parentNode.removeChild(node); | 65 node.parentNode.removeChild(node); |
66 </script> | 66 </script> |
OLD | NEW |