]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Allow declarative pattern overrides 3846/head
authorShawn Jonnet <sjonnet19@gmail.com>
Mon, 9 Dec 2013 22:45:35 +0000 (17:45 -0500)
committerShawn Jonnet <sjonnet19@gmail.com>
Mon, 9 Dec 2013 22:45:35 +0000 (17:45 -0500)
Noticed this issue when trying to override the current password pattern in a single use.

js/foundation/foundation.abide.js

index 66e10f76629c4c680da89989e1b55f42289e7cc6..1f9b960f144a3c7bd4ecb3605ff28f91307e95a5 100644 (file)
       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) {
       } 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 = /.*/;
 
       return valid;
     }
   };
-}(jQuery, this, this.document));
\ No newline at end of file
+}(jQuery, this, this.document));