-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from coliff/dev/coliff/formatting-fixes
Formatting Fixes
- Loading branch information
Showing
4 changed files
with
81 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"tagname-lowercase": true, | ||
"alt-require": true, | ||
"attr-lowercase": true, | ||
"attr-no-duplication": true, | ||
"attr-value-double-quotes": true, | ||
"attr-value-not-empty": false, | ||
"doctype-first": true, | ||
"tag-pair": true, | ||
"spec-char-escape": true, | ||
"doctype-html5": true, | ||
"id-unique": true, | ||
"spec-char-escape": true, | ||
"src-not-empty": true, | ||
"attr-no-duplication": true, | ||
"title-require": true, | ||
"attr-value-not-empty": false, | ||
"alt-require": true, | ||
"doctype-html5": true | ||
"tag-pair": true, | ||
"tagname-lowercase": true, | ||
"title-require": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,13 @@ | |
An email address validator (which includes checking a valid TLD is used) in pure HTML with no JavaScript or dependencies. It could be used to improve the user experience by rejecting mistyped email addresses. | ||
|
||
## Where can I see a demo? | ||
https://coliff.github.io/html5-email-regex/ | ||
|
||
https://coliff.github.io/html5-email-regex/ | ||
|
||
## How does it work? | ||
|
||
It uses the HTML5 `pattern` attribute and uses the standard email regex [RFC 5322](https://www.w3.org/TR/2012/WD-html-markup-20120320/input.email.html) and expanded to check the end of the email address matches against a list of valid TLDs. | ||
|
||
|
||
## Is it safe to use? | ||
|
||
Kind of, but a few points: | ||
|
@@ -23,7 +22,6 @@ Kind of, but a few points: | |
|
||
- It doesn't give meaningful feedback if an email address is mistyped. So if someone enters `[email protected]` they'll get an invalid message, but won't specify that the TLD is incorrect. I've used [Verimail](https://github.com/amail/Verimail.js) and [Mailcheck](https://github.com/mailcheck/mailcheck) with success before to give inline feedback on mistyped email addresses. | ||
|
||
|
||
## Are there any other recommended HTML attributes to add? | ||
|
||
- Always use `type="email"` rather than `type="text"` to take advantage of browser-based validation and feedback and provide hints to autocomplete/autofill users email address. | ||
|
@@ -34,7 +32,6 @@ Kind of, but a few points: | |
|
||
- If it's an order form/contact form or similar add the `required` tag to prevent submissions when this field is empty. | ||
|
||
|
||
## How did you get the list of valid TLDs? | ||
|
||
I scraped the official list with this command: | ||
|
Oops, something went wrong.