OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <p>There was a bug that the value property of a cloned text input was not update
d.</p> | 3 <p>There was a bug that the value property of a cloned text input was not update
d.</p> |
4 <div id=container> | 4 <div id=container> |
5 <input id=i1 value="Initial" style> | 5 <input id=i1 value="Initial" style> |
6 <input id=i2 type=search value="Initial" style> | 6 <input id=i2 type=search value="Initial" style> |
7 <!-- ENABLE_INPUT_SPEECH flag doesn't affect the test result --> | 7 <!-- ENABLE_INPUT_SPEECH flag doesn't affect the test result --> |
8 <input id=i3 type=search value="Initial" x-webkit-speech style> | |
9 <input id=i4 type=number value="0" style> | 8 <input id=i4 type=number value="0" style> |
10 </div> | 9 </div> |
11 <div id=console></div> | 10 <div id=console></div> |
12 <script> | 11 <script> |
13 var clone; | 12 var clone; |
14 var container = document.getElementById('container'); | 13 var container = document.getElementById('container'); |
15 var newValue; | 14 var newValue; |
16 | 15 |
17 function check(id, value) { | 16 function check(id, value) { |
18 var original = document.getElementById(id); | 17 var original = document.getElementById(id); |
19 clone = original.cloneNode(); | 18 clone = original.cloneNode(); |
20 container.replaceChild(clone, original); | 19 container.replaceChild(clone, original); |
21 clone.focus(); | 20 clone.focus(); |
22 document.execCommand('selectAll'); | 21 document.execCommand('selectAll'); |
23 document.execCommand('insertText', false, value); | 22 document.execCommand('insertText', false, value); |
24 newValue = value; | 23 newValue = value; |
25 debug('Check for ' + clone.type + ' type:'); | 24 debug('Check for ' + clone.type + ' type:'); |
26 shouldBe('clone.value', 'newValue'); | 25 shouldBe('clone.value', 'newValue'); |
27 } | 26 } |
28 | 27 |
29 check('i1', 'foo'); | 28 check('i1', 'foo'); |
30 check('i2', 'query'); | 29 check('i2', 'query'); |
31 check('i3', 'speech'); | |
32 check('i4', '13'); | 30 check('i4', '13'); |
33 container.innerHTML = ''; | 31 container.innerHTML = ''; |
34 </script> | 32 </script> |
OLD | NEW |