Content-Length: 337202 | pFad | https://github.com/jquery-validation/jquery-validation/pull/2053

19 Core: guard against null & undefined values in required method by Arkni · Pull Request #2053 · jquery-validation/jquery-validation · GitHub
Skip to content

Core: guard against null & undefined values in required method #2053

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

Merged

Conversation

Arkni
Copy link
Member

@Arkni Arkni commented Sep 2, 2017

Ref #2049

Copy link
Member

@staabm staabm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test

@Arkni Arkni force-pushed the required-method-null-undef-val branch 3 times, most recently from a8f6905 to 92faa3b Compare September 2, 2017 15:39
@Arkni
Copy link
Member Author

Arkni commented Sep 2, 2017

I don't think there is a way to test it without using the normalizer. But the normalizer will not return undefined or null until #2054 was merged.

I will update the tests of the other PR and merge it and then update this one to use the normalizer.

For now, I added a description to the commit describing the needs for this fix.

@staabm
Copy link
Member

staabm commented Sep 2, 2017

Merged the other pr, we can add the tests here

@Arkni Arkni force-pushed the required-method-null-undef-val branch 2 times, most recently from c43f371 to 7b535ef Compare September 2, 2017 16:00
@Arkni
Copy link
Member Author

Arkni commented Sep 2, 2017

We are good to go.

An input element will never have undefined or null as value
but the normalizer may return null or undefined for an element.

Also, jQuery (< 3.x) returns `null` for select element with the
multiple attribute set if no options are selected.

As a result, the required method should guard against that.
@Arkni Arkni force-pushed the required-method-null-undef-val branch from 7b535ef to 83bfd48 Compare September 2, 2017 17:24
@Arkni
Copy link
Member Author

Arkni commented Sep 2, 2017

I'm going to merge this for now.
Thanks for the review and for merging the other PR.

@Arkni Arkni merged commit b7bb3c2 into jquery-validation:master Sep 2, 2017
@Arkni Arkni deleted the required-method-null-undef-val branch September 2, 2017 17:27
@staabm
Copy link
Member

staabm commented Sep 2, 2017

Awesome that our normalizer layer also turned out to be a good value-mocking test utility 😸

Great job, thx

@Arkni
Copy link
Member Author

Arkni commented Sep 2, 2017

Yes, and also I see (from Stackoverflow and here) that a lot of folks are using it and found it useful too.

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/jquery-validation/jquery-validation/pull/2053

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy