-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
tel no. validation #10124
base: develop
Are you sure you want to change the base?
tel no. validation #10124
Conversation
There seem to be changes unrelated to telephone numbers here. Could you also title your PR and add a comment so that it's obvious what it's for? |
I have updated the files and body of message |
Is this correct now ? @pnorman |
code updated to only neglect tel: or tel:// @1ec5 |
val = val.replace(/^tel:\/\//, ''); // Remove 'tel://' prefix if present | ||
val = val.replace(/^tel:/, ''); // Remove 'tel:' prefix if present |
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.
Since these are regular expressions, you could combine these two steps by surrounding the slashes in (\/\/)?
. (Technically, RFC 3966 doesn’t allow slashes after the colon, but as #9559 (comment) demonstrates, there’s probably enough confusion about that to go ahead and strip out those slashes too.)
if (!val && getVals(_tags).size > 1) return; | ||
|
||
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.
We should probably perform the tel:
-stripping after cleaning the tag value. cleanTagValue()
removes stuff like leading and trailing whitespace, something that can easily occur if someone is copy-pasting from another website.
Resolves issue #9559 - Implemented a regular expression to restrict the pasting of alphabetical characters into the input field.