Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / forms / textfield-clone.html
1 <!DOCTYPE html>
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 updated.</p>
4 <div id=container>
5 <input id=i1 value="Initial" style>
6 <input id=i2 type=search value="Initial" style>
7 <input id=i3 type=number value="0" style>
8 </div>
9 <div id=console></div>
10 <script>
11 var clone;
12 var container = document.getElementById('container');
13 var newValue;
14
15 function check(id, value) {
16     var original = document.getElementById(id);
17     clone = original.cloneNode();
18     container.replaceChild(clone, original);
19     clone.focus();
20     document.execCommand('selectAll');
21     document.execCommand('insertText', false, value);
22     newValue = value;
23     debug('Check for ' + clone.type + ' type:');
24     shouldBe('clone.value', 'newValue');
25 }
26
27 check('i1', 'foo');
28 check('i2', 'query');
29 check('i3', '13');
30 container.innerHTML = '';
31 </script>