| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <body> | 2 <body> |
| 3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <div id="sample"></div> | 5 <div id="sample"></div> |
| 6 <script> | 6 <script> |
| 7 // See also imported/wpt/html/semantics/forms/constraints/form-validation-checkV
alidity.html. | 7 // See also external/wpt/html/semantics/forms/constraints/form-validation-checkV
alidity.html. |
| 8 | 8 |
| 9 function checkValidityFor(html) { | 9 function checkValidityFor(html) { |
| 10 var sample = document.getElementById('sample'); | 10 var sample = document.getElementById('sample'); |
| 11 sample.innerHTML = html; | 11 sample.innerHTML = html; |
| 12 return sample.firstChild.checkValidity(); | 12 return sample.firstChild.checkValidity(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 test(() => { | 15 test(() => { |
| 16 assert_true(checkValidityFor('<fieldset></fieldset>')); | 16 assert_true(checkValidityFor('<fieldset></fieldset>')); |
| 17 }, 'checkValidity() for FIELDSET should return true.'); | 17 }, 'checkValidity() for FIELDSET should return true.'); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 assert_false(checkValidityFor('<form method="get">' + | 67 assert_false(checkValidityFor('<form method="get">' + |
| 68 '<fieldset name="victim"></fieldset>' + | 68 '<fieldset name="victim"></fieldset>' + |
| 69 '<input name="victim" type="text" value="invalid" pattern="something"/>' + | 69 '<input name="victim" type="text" value="invalid" pattern="something"/>' + |
| 70 '<button name="victim">lorem ipsum</button>' + | 70 '<button name="victim">lorem ipsum</button>' + |
| 71 '<select name="victim"></select>' + | 71 '<select name="victim"></select>' + |
| 72 '<textarea name="victim"></textarea>' + | 72 '<textarea name="victim"></textarea>' + |
| 73 '</form>')); | 73 '</form>')); |
| 74 }, 'checkValidity() for FORM with an invalid control should return false.'); | 74 }, 'checkValidity() for FORM with an invalid control should return false.'); |
| 75 </script> | 75 </script> |
| 76 </body> | 76 </body> |
| OLD | NEW |