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/the-textarea-element/textarea-validity-clone.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<title>HTML Test: <textarea> validity state is correct after a clone</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
let form = document.createElement("form");
let textarea = document.createElement("textarea");
textarea.required = true;
textarea.appendChild(document.createTextNode("A"));
form.appendChild(textarea);
assert_true(textarea.validity.valid);
let formClone = form.cloneNode(true);
assert_equals(
formClone.querySelector('textarea').validity.valid,
textarea.validity.valid,
"Validity state should be preserved after a clone"
);
}, "<textarea> validity state should be preserved after a clone");
</script>