Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/constraints/input-pattern-dynamic-value.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Pattern dynamic value attribute change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input pattern="a" value="a">
<script>
test(function() {
let i = document.querySelector("input");
assert_false(i.matches(":invalid"));
i.pattern = "b";
assert_true(i.matches(":invalid"));
i.pattern = "(";
assert_false(i.matches(":invalid"));
}, "input validation is updated after pattern attribute change");
</script>