Why is checkValidity() on type="email" so rubbish?
It returns true for values like
string@char
…so it’s not looking for a valid domain 🤦♂️
Why do browser vendors not integrate a pattern check such as:
/^[\w._%+-]+@[\w.-]+\.[a-z]{2,}$/
?
- - -
Similar for input.validity.typeMismatch where
string@x returns false 🤪
@urlyman May I point you towards https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression and https://beesbuzz.biz/code/439-Falsehoods-programmers-believe-about-email. Email addresses are notoriously complex and there's many addresses out there that seem invalid, but aren't. https://e-mail.wtf/ is a great way to be introduced to the horrors that are e-mail addresses.
Email is Easy
How can I validate an email address using a regular expression?