OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script> | 9 <script> |
10 description('Various tests for .willValidate property'); | 10 description('Various tests for .willValidate property'); |
11 | 11 |
12 var parent = document.createElement('div'); | 12 var parent = document.createElement('div'); |
13 document.body.appendChild(parent); | 13 document.body.appendChild(parent); |
14 | 14 |
15 debug('Existence of .willValidate'); | 15 debug('Existence of .willValidate'); |
16 parent.innerHTML = '<form>' | 16 parent.innerHTML = '<form>' |
17 + '<input name="victim"/>' | 17 + '<input name="victim"/>' |
18 + '<textarea name="victim"></textarea>' | 18 + '<textarea name="victim"></textarea>' |
19 + '<fieldset name="victim">Test</fieldset>' | 19 + '<fieldset name="victim">Test</fieldset>' |
20 + '<button name="victim">' | 20 + '<button name="victim">' |
21 + '<select name="victim"></select>' | 21 + '<select name="victim"></select>' |
22 + '<output name="victim"></output>' | 22 + '<output name="victim"></output>' |
23 + '<object name="victim"></object>' | 23 + '<object name="victim"></object>' |
24 + '<keygen name="victim">' | |
25 + '</form>'; | 24 + '</form>'; |
26 var controls = document.getElementsByName('victim'); | 25 var controls = document.getElementsByName('victim'); |
27 for (var i = 0; i < controls.length; i++) | 26 for (var i = 0; i < controls.length; i++) |
28 shouldBe('typeof controls[i].willValidate', '"boolean"'); | 27 shouldBe('typeof controls[i].willValidate', '"boolean"'); |
29 | 28 |
30 debug(''); | 29 debug(''); |
31 debug('Form association'); | 30 debug('Form association'); |
32 parent.innerHTML = '<input name="test">'; | 31 parent.innerHTML = '<input name="test">'; |
33 var input = document.getElementsByTagName("input")[0]; | 32 var input = document.getElementsByTagName("input")[0]; |
34 shouldBeTrue('input.willValidate'); | 33 shouldBeTrue('input.willValidate'); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 debug(''); | 79 debug(''); |
81 debug('Output element'); | 80 debug('Output element'); |
82 parent.innerHTML = '<form><output></output></form>'; | 81 parent.innerHTML = '<form><output></output></form>'; |
83 shouldBeFalse('document.getElementsByTagName("output")[0].willValidate'); | 82 shouldBeFalse('document.getElementsByTagName("output")[0].willValidate'); |
84 | 83 |
85 debug(''); | 84 debug(''); |
86 debug('Object element'); | 85 debug('Object element'); |
87 parent.innerHTML = '<form><object></object></form>'; | 86 parent.innerHTML = '<form><object></object></form>'; |
88 shouldBeFalse('document.getElementsByTagName("object")[0].willValidate'); | 87 shouldBeFalse('document.getElementsByTagName("object")[0].willValidate'); |
89 | 88 |
90 debug(''); | |
91 debug('Keygen element'); | |
92 parent.innerHTML = '<form><keygen></form>'; | |
93 shouldBeFalse('document.getElementsByTagName("keygen")[0].willValidate'); | |
94 </script> | 89 </script> |
95 </body> | 90 </body> |
96 </html> | 91 </html> |
OLD | NEW |