Clearing the form should update element state.

Just like setting it does, since at the very least it influences
:user-valid/:user-invalid matching.

Differential Revision: https://phabricator.services.mozilla.com/D162043

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1800543
gecko-commit: 56f699fdd26087f0f76c8a78b7bd88bb375b9b04
gecko-reviewers: edgar
diff --git a/html/semantics/forms/the-input-element/input-form-detach-style-crash.html b/html/semantics/forms/the-input-element/input-form-detach-style-crash.html
new file mode 100644
index 0000000..5472563
--- /dev/null
+++ b/html/semantics/forms/the-input-element/input-form-detach-style-crash.html
@@ -0,0 +1,17 @@
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1800543">
+<script>
+document.addEventListener('DOMContentLoaded', () => {
+  b.setCustomValidity("x")
+  a.reportValidity()
+  c.appendChild(a)
+  document.adoptNode(d)
+  document.documentElement.style.display = 'none'
+})
+</script>
+<form id="a">
+<textarea id="b">a</textarea>
+</form>
+<dl id="d">
+<canvas id="c"></canvas>
+</dl>
+<input form="a">