Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix pattern validator failing on optional fields if pattern doesn't allow empty value (Fix #605) #625

Merged
merged 1 commit into from

2 participants

@rs
rs commented

No description provided.

@duclet duclet was assigned
@duclet duclet merged commit 9a6b3fb into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 28, 2011
  1. @rs
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/validator/validator.js
View
5 src/validator/validator.js
@@ -251,9 +251,8 @@
return !!v;
});
- v.fn("[pattern]", function(el) {
- var p = new RegExp("^" + el.attr("pattern") + "$");
- return p.test(el.val());
+ v.fn("[pattern]", function(el, v) {
+ return v === '' || new RegExp("^" + el.attr("pattern") + "$").test(v);
});
Something went wrong with that request. Please try again.