OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <p id="description">This test setting a suggested value on an input element. | 4 <p id="description">This test setting suggested values on an input element |
5 The dump below should have the "suggested value" instead of "initial value".</p> | 5 and a textarea element. The dump below should have the "suggested value" |
6 <pre><input id="test" type="text" value="initial value"></pre> | 6 instead of "initial value".</p> |
| 7 <pre><input id="test" type="text" value="initial value"><textarea id="textarea">
</textarea></pre> |
7 <script src="../../resources/dump-as-markup.js"></script> | 8 <script src="../../resources/dump-as-markup.js"></script> |
8 <script> | 9 <script> |
9 | 10 |
10 var input = document.getElementById('test'); | 11 var input = document.getElementById('test'); |
| 12 var textarea = document.getElementById('textarea'); |
| 13 textarea.value = "initial value"; |
11 var result = document.getElementById('result'); | 14 var result = document.getElementById('result'); |
12 if (!window.internals) | 15 if (!window.internals) |
13 testFailed('This test requires internals object'); | 16 testFailed('This test requires internals object'); |
14 else { | 17 else { |
15 input.focus(); | 18 input.focus(); |
16 input.selectionStart = input.selectionEnd = 0; | 19 input.selectionStart = input.selectionEnd = 0; |
17 | 20 |
18 internals.setSuggestedValue(input, 'suggested value'); | 21 internals.setSuggestedValue(input, 'suggested value'); |
| 22 internals.setSuggestedValue(textarea, 'suggested value'); |
19 | 23 |
20 Markup.description(document.getElementById('description').textContent) | 24 Markup.description(document.getElementById('description').textContent) |
21 | 25 |
22 function addTextResult(value) { input.parentNode.appendChild(document.create
TextNode(value + ': ' + eval(value))); } | 26 function addTextResult(value) { input.parentNode.appendChild(document.create
TextNode(value + ': ' + eval(value))); } |
23 addTextResult('input.value'); | 27 addTextResult('input.value'); |
24 addTextResult('internals.suggestedValue(input)'); | 28 addTextResult('internals.suggestedValue(input)'); |
25 addTextResult('input.selectionStart'); | 29 addTextResult('input.selectionStart'); |
26 addTextResult('input.selectionEnd'); | 30 addTextResult('input.selectionEnd'); |
27 | 31 addTextResult('textarea.value'); |
| 32 addTextResult('internals.suggestedValue(textarea)'); |
| 33 |
28 Markup.dump(input.parentNode); | 34 Markup.dump(input.parentNode); |
29 } | 35 } |
30 | 36 |
31 </script> | 37 </script> |
32 </body> | 38 </body> |
33 </html> | 39 </html> |
OLD | NEW |