diff --git a/lib/jsdom/living/nodes/HTMLInputElement-impl.js b/lib/jsdom/living/nodes/HTMLInputElement-impl.js
index 8c7335be48..353ab6f410 100644
--- a/lib/jsdom/living/nodes/HTMLInputElement-impl.js
+++ b/lib/jsdom/living/nodes/HTMLInputElement-impl.js
@@ -1014,22 +1014,26 @@ class HTMLInputElementImpl extends HTMLElementImpl {
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-a-type-mismatch
typeMismatch: () => {
- if (this._value === "") {
- return false;
- }
- if (this.type === "email") {
+ switch (this.type) {
+ // https://html.spec.whatwg.org/multipage/input.html#url-state-(type=url)
+ // Constraint validation: While the value of the element is neither the empty string
+ // nor a valid absolute URL, the element is suffering from a type mismatch.
+ case "url":
+ if (this._value !== "" && !isValidAbsoluteURL(this._value)) {
+ return true;
+ }
+ break;
+
// https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type=email)
// Constraint validation [multiple=false]: While the value of the element is neither the empty
// string nor a single valid e - mail address, the element is suffering from a type mismatch.
-
// Constraint validation [multiple=true]: While the value of the element is not a valid e-mail address list,
// the element is suffering from a type mismatch.
- return !isValidEmailAddress(this._value, this.hasAttributeNS(null, "multiple"));
- } else if (this.type === "url") {
- // https://html.spec.whatwg.org/multipage/input.html#url-state-(type=url)
- // Constraint validation: While the value of the element is neither the empty string
- // nor a valid absolute URL, the element is suffering from a type mismatch.
- return !isValidAbsoluteURL(this._value);
+ case "email":
+ if (this._value !== "" && !isValidEmailAddress(this._getValue(), this.hasAttributeNS(null, "multiple"))) {
+ return true;
+ }
+ break;
}
return false;
}