Skip to content

Commit

Permalink
Merge pull request #3 from coliff/dev/coliff/formatting-fixes
Browse files Browse the repository at this point in the history
Formatting Fixes
  • Loading branch information
coliff authored Sep 24, 2024
2 parents 6dfa162 + 72686ad commit cf95be5
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 43 deletions.
16 changes: 8 additions & 8 deletions .htmlhintrc
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
}
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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:
Expand Down
Loading

0 comments on commit cf95be5

Please sign in to comment.