Chromium Code Reviews| 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:"); | |
| 93 // Need to clear selection. Selection API calls above modified | |
| 94 // both of real selection and |elt|'s cached selection even | |
| 95 // though |elt| has no focus. | |
| 96 // We'd like to check the behavior in case that real selection | |
| 97 // and the cached selection are mismatched. | |
| 98 getSelection().removeAllRanges(); | |
|
yoichio
2015/11/17 05:56:40
Could you have |elt.selectionStart = elt.selection
tkent
2015/11/17 06:02:45
Setting 0 to them makes unable to check the behavi
tkent
2015/11/17 06:24:54
I added it to new patch set.
| |
| 99 elt.onfocus = function() { display(elt); }; | |
| 100 elt.focus(); | |
| 101 | |
| 91 elt.value = ""; | 102 elt.value = ""; |
| 92 } | 103 } |
| 93 function testButtonSelectionAccess(button, access) | 104 function testButtonSelectionAccess(button, access) |
| 94 { | 105 { |
| 95 var source = "button" + access; | 106 var source = "button" + access; |
| 96 try { | 107 try { |
| 97 eval(source); | 108 eval(source); |
| 98 print(source + " did not throw exception"); | 109 print(source + " did not throw exception"); |
| 99 } catch(e) { | 110 } catch(e) { |
| 100 print(source + " threw exception"); | 111 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> | 125 <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 /> | 126 <hr /> |
| 116 <form> | 127 <form> |
| 117 <textarea id="text"></textarea> | 128 <textarea id="text"></textarea> |
| 118 <input type="text" id="input" /> | 129 <input type="text" id="input" /> |
| 119 <input type="button" id="button" /> | 130 <input type="button" id="button" /> |
| 120 </form> | 131 </form> |
| 121 <hr /> | 132 <hr /> |
| 122 <p id="console"></p> | 133 <p id="console"></p> |
| 123 </body> | 134 </body> |
| 124 </html> | 135 </html> |
| OLD | NEW |