OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>button element validation</title> |
| 4 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> |
| 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-button-elemen
t"> |
| 6 <script src="../../../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 8 <div id="log"></div> |
| 9 <button id=btn1>button</button> |
| 10 <button id=btn2 type=submit>button</button> |
| 11 <button id=btn3 type=reset>button</button> |
| 12 <button id=btn4 type=button>button</button> |
| 13 <button id=btn5 type=menu>button</button> |
| 14 <button id=btn6 type=foobar>button</button> |
| 15 <script> |
| 16 function willValid(element, expectedType, willValidate, desc) { |
| 17 test(function(){ |
| 18 assert_equals(element.type, expectedType); |
| 19 assert_equals(element.willValidate, willValidate); |
| 20 }, desc); |
| 21 } |
| 22 |
| 23 willValid(document.getElementById('btn1'), "submit", true, "missing type attri
bute"); |
| 24 willValid(document.getElementById('btn2'), "submit", true, "submit type attrib
ute"); |
| 25 willValid(document.getElementById('btn3'), "reset", false, "reset type attribu
te"); |
| 26 willValid(document.getElementById('btn4'), "button", false, "button type attri
bute"); |
| 27 willValid(document.getElementById('btn5'), "menu", false, "menu type attribute
"); |
| 28 willValid(document.getElementById('btn6'), "submit", true, "invalid type attri
bute"); |
| 29 </script> |
OLD | NEW |