|
1 | 1 | <!DOCTYPE html> |
2 | | -<html> |
3 | | - |
4 | | - <head> |
5 | | - <title>Pattern Attribute</title> |
6 | | - <meta name=viewport content="width=device-width, maximum-scale=1.0, user-scalable=no" /> |
7 | | - <link rel=" author" title=" Fabrice Clari" href=" mailto:[email protected]" > |
8 | | - <link rel=" author" title=" Dimitri Bocquet" href=" mailto:[email protected]" > |
9 | | - <link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-input-pattern"> |
10 | | - <script src="/resources/testharness.js"></script> |
11 | | - <script src="/resources/testharnessreport.js"></script> |
12 | | - </head> |
13 | | - |
14 | | - <body> |
15 | | - |
16 | | - |
17 | | - <h1>Pattern Attribute</h1> |
18 | | - <div style="display: none"> |
19 | | - <input pattern="[a-z]{3}" value="abcd" title="three letters max"/> |
20 | | - </div> |
21 | | - |
22 | | - <div id="log"> |
23 | | - </div> |
24 | | - |
25 | | - <script type="text/javascript"> |
26 | | - |
27 | | - |
28 | | - test(function() {assert_equals(document.getElementsByTagName("input")[0].getAttribute("pattern"), "[a-z]{3}")}, "pattern attribute support on input element"); |
29 | | - |
30 | | - </script> |
31 | | - |
32 | | - </body> |
33 | | - |
34 | | -</html> |
| 2 | +<title>pattern attribute</title> |
| 3 | +<meta name=viewport content="width=device-width"> |
| 4 | +<link rel=" author" title=" Fabrice Clari" href=" mailto:[email protected]" > |
| 5 | +<link rel=" author" title=" Dimitri Bocquet" href=" mailto:[email protected]" > |
| 6 | +<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-input-pattern"> |
| 7 | +<script src="/resources/testharness.js"></script> |
| 8 | +<script src="/resources/testharnessreport.js"></script> |
| 9 | +<h1><code>pattern</code> attribute</h1> |
| 10 | +<div style="display: none"> |
| 11 | + <input pattern="[a-z]{3}" value="abcd" title="three letters max"> |
| 12 | +</div> |
| 13 | +<div id="log"></div> |
| 14 | +<script> |
| 15 | + test(function() { |
| 16 | + const input = document.querySelector("input"); |
| 17 | + |
| 18 | + assert_idl_attribute(input, "pattern"); |
| 19 | + assert_equals(input.pattern, "[a-z]{3}"); |
| 20 | + |
| 21 | + assert_inherits(input, "validity"); |
| 22 | + assert_false(input.validity.valid); |
| 23 | + |
| 24 | + assert_true(input.matches(":invalid")); |
| 25 | + }, "pattern attribute support on input element"); |
| 26 | +</script> |
0 commit comments