From: Shawn Jonnet Date: Mon, 9 Dec 2013 22:45:35 +0000 (-0500) Subject: Allow declarative pattern overrides X-Git-Tag: 5.0.3~71^2~30^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3846%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Allow declarative pattern overrides Noticed this issue when trying to override the current password pattern in a single use. --- diff --git a/js/foundation/foundation.abide.js b/js/foundation/foundation.abide.js index 66e10f766..1f9b960f1 100644 --- a/js/foundation/foundation.abide.js +++ b/js/foundation/foundation.abide.js @@ -115,10 +115,6 @@ var type = el.getAttribute('type'), required = typeof el.getAttribute('required') === 'string'; - if (this.settings.patterns.hasOwnProperty(type)) { - return [el, this.settings.patterns[type], required]; - } - var pattern = el.getAttribute('pattern') || ''; if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) { @@ -126,6 +122,10 @@ } else if (pattern.length > 0) { return [el, new RegExp(pattern), required]; } + + if (this.settings.patterns.hasOwnProperty(type)) { + return [el, this.settings.patterns[type], required]; + } pattern = /.*/; @@ -213,4 +213,4 @@ return valid; } }; -}(jQuery, this, this.document)); \ No newline at end of file +}(jQuery, this, this.document));