-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make linkValidation allow hash links #1143
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,8 @@ | |
// Matches any alphabetical characters followed by :// | ||
// Matches protocol relative "//" | ||
// Matches common external protocols "mailto:" "tel:" "maps:" | ||
var urlSchemeRegex = /^([a-z]+:)?\/\/|^(mailto|tel|maps):/i, | ||
// Matches relative hash link, "#" followed by any character | ||
var urlSchemeRegex = /^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#.+/i, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this allow just plain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my opinion, the hash should be omitted if there is no fragment identifier; however, you are correct that it is valid, so it should be allowed here. |
||
// var te is a regex for checking if the string is a telephone number | ||
telRegex = /^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/; | ||
if (telRegex.test(value)) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add an extra space before and after this assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I will add spaces.