The input type[email]
is intended to validate if the field is being populated with a valid email.
But I've been questioning a few times on some projects about why this field accepts some types of emails that are seemingly invalid.
Example:
[type=email]:invalid{
color:red;
}
[type=email]:valid{
color: green;
border-color: lightgreen;
}
<input type="email" value="wallace@dominio-sem-ponto-com" />
<input type="email" value="wallace@xx" />
<input type="email" value="[email protected]" />
<input type="email" value="wallace" />
If you notice, none of the emails whose domain was without ".com"
or ".net"
was marked invalid.
Why does this happen?
Why was the "wallace@dominio-sem-ponto-com"
email considered valid by the browser?
Is there a case where it would be valid to use a domain with no value after the point ( .com
, .net
, etc)?