OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript"> | 3 <script type="text/javascript"> |
4 function print(message) | 4 function print(message) |
5 { | 5 { |
6 var paragraph = document.createElement("div"); | 6 var paragraph = document.createElement("div"); |
7 if (message == "") { | 7 if (message == "") { |
8 paragraph.appendChild(document.createElement("br")); | 8 paragraph.appendChild(document.createElement("br")); |
9 } else { | 9 } else { |
10 paragraph.appendChild(document.createTextNode(message)); | 10 paragraph.appendChild(document.createTextNode(message)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 elt.selectionEnd = 2; | 81 elt.selectionEnd = 2; |
82 display(elt); | 82 display(elt); |
83 elt.selectionEnd = -1; | 83 elt.selectionEnd = -1; |
84 display(elt); | 84 display(elt); |
85 elt.selectionEnd = 54; | 85 elt.selectionEnd = 54; |
86 display(elt); | 86 display(elt); |
87 elt.selectionStart = 7; | 87 elt.selectionStart = 7; |
88 elt.selectionEnd = 7; | 88 elt.selectionEnd = 7; |
89 display(elt); | 89 display(elt); |
90 | 90 |
| 91 print(""); |
| 92 print("selectionStart and selectionEnd in focus handler don't re
turn wrong values 0,0:"); |
| 93 elt.selectionStart = elt.selectionEnd = 7; |
| 94 // Need to clear selection. Selection API calls above modified |
| 95 // both of real selection and |elt|'s cached selection even |
| 96 // though |elt| has no focus. |
| 97 // We'd like to check the behavior in case that real selection |
| 98 // and the cached selection are mismatched. |
| 99 getSelection().removeAllRanges(); |
| 100 // selectionStart and selectionEnd are still 7. |
| 101 elt.onfocus = function() { display(elt); }; |
| 102 elt.focus(); |
| 103 |
91 elt.value = ""; | 104 elt.value = ""; |
92 } | 105 } |
93 function testButtonSelectionAccess(button, access) | 106 function testButtonSelectionAccess(button, access) |
94 { | 107 { |
95 var source = "button" + access; | 108 var source = "button" + access; |
96 try { | 109 try { |
97 eval(source); | 110 eval(source); |
98 print(source + " did not throw exception"); | 111 print(source + " did not throw exception"); |
99 } catch(e) { | 112 } catch(e) { |
100 print(source + " threw exception"); | 113 print(source + " threw exception"); |
(...skipping 13 matching lines...) Expand all Loading... |
114 <p>If this test passed you'll see a bunch of correct selection ranges be
low. Check the expected file for the correct ranges.</p> | 127 <p>If this test passed you'll see a bunch of correct selection ranges be
low. Check the expected file for the correct ranges.</p> |
115 <hr /> | 128 <hr /> |
116 <form> | 129 <form> |
117 <textarea id="text"></textarea> | 130 <textarea id="text"></textarea> |
118 <input type="text" id="input" /> | 131 <input type="text" id="input" /> |
119 <input type="button" id="button" /> | 132 <input type="button" id="button" /> |
120 </form> | 133 </form> |
121 <hr /> | 134 <hr /> |
122 <p id="console"></p> | 135 <p id="console"></p> |
123 </body> | 136 </body> |
124 </html> | 137 </html> |
OLD | NEW |