-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Core: Added transformation/normalization layer #1609
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
Conversation
Will be on vacation for a week. Will review the PR when I am back. |
Have a good holiday :) |
Please adjust the PR per discussion in #1602 |
Will do soon. |
No need to hurry :-) |
46902d7
to
efd641b
Compare
@staabm Please let me know if there is anything I missed from our discussion. |
// before validating it. | ||
normalizer: function( element ) { | ||
// Trim the value of the input | ||
return $.trim( element.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.
Should this use elementValue
instead?
Same in the url normalizer below
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.
See my answer above
efd641b
to
7c20280
Compare
@staabm |
7c20280
to
5eb030e
Compare
Nice. Only things missing
|
5eb030e
to
a311bd4
Compare
Done!
Will do that, this night I guess (or even tomorrow) |
@Arkni just realised we also need a test which makes sure a exception is thrown when normalizer returns a non string. |
I will see what I can do. |
a311bd4
to
a9ae546
Compare
Done! |
For the docs, I will create a PR when I have the time, maybe this weekend. |
Awesome, thx. |
78226e8
to
43a6a01
Compare
@@ -861,7 +877,7 @@ $.extend( $.validator, { | |||
// meta-characters that should be escaped in order to be used with JQuery | |||
// as a literal part of a name/id or any selector. | |||
escapeCssMeta: function( string ) { | |||
return string.replace( /(!|"|#|\$|%|&|'|\(|\)|\*|\+|,|\.|\/|:|;|<|=|>|\?|@|\[|\\|\]|\^|`|\{|\||\}|~)/g, "\\$1"); | |||
return string.replace( /([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1" ); |
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.
I have simplified the regex used in escapeCssMeta
.
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.
Is it OK to include it in this PR ?
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.
There might be one \
too much, otherwise lgtm
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.
There might be one \ too much
nope, one for \
and one for ]
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.
Ok, so we should order the escaped \
char somewhere where it doesnt follow directly another escape char. This would ease reading
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.
make sense. maybe like this:
/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g
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.
Looks good.
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.
Done!
The user can change the value of an element before validating the element in question. The new value will be then used by the associated methods instead of the `real one`. Closes jquery-validation#1602
43a6a01
to
abe6810
Compare
|
Core: Added transformation/normalization layer
Awesome sauce 🌟 |
😃 |
The user can change/transform the value of an element before validating
the element in question. The
normalizer value
will be then used bythe associated methods instead of the
real one
.Ref: #1602