Browse Source

#207, #255: Plugin method invocation don't work

nghuuphuoc 11 years ago
parent
commit
bfdb0d80b9
4 changed files with 10 additions and 7 deletions
  1. 1 0
      CHANGELOG.md
  2. 4 3
      dist/js/bootstrapValidator.js
  3. 1 1
      dist/js/bootstrapValidator.min.js
  4. 4 3
      src/js/bootstrapValidator.js

+ 1 - 0
CHANGELOG.md

@@ -16,6 +16,7 @@
 * [#226](https://github.com/nghuuphuoc/bootstrapvalidator/issues/226): Fix the conflict issue with MooTools
 * [#238](https://github.com/nghuuphuoc/bootstrapvalidator/issues/238): The submit buttons are not sent
 * [#253](https://github.com/nghuuphuoc/bootstrapvalidator/issues/253): The [```iban``` validator](http://bootstrapvalidator.com/validators/iban/) does not work on IE8
+* [#257](https://github.com/nghuuphuoc/bootstrapvalidator/issues/257): Plugin method invocation don't work
 * Fix the issue that the hidden fields generated by other plugins might not be validated
 * When parsing options from HTML attributes, don't add the field which hasn't validators. It improves fixes for [#191](https://github.com/nghuuphuoc/bootstrapvalidator/issues/191), [#223](https://github.com/nghuuphuoc/bootstrapvalidator/issues/223)
 

+ 4 - 3
dist/js/bootstrapValidator.js

@@ -840,7 +840,8 @@
     };
 
     // Plugin definition
-    $.fn.bootstrapValidator = function(option, params) {
+    $.fn.bootstrapValidator = function(option) {
+        var params = arguments;
         return this.each(function() {
             var $this   = $(this),
                 data    = $this.data('bootstrapValidator'),
@@ -851,8 +852,8 @@
             }
 
             // Allow to call plugin method
-            if ('string' == typeof option) {
-                data[option](params);
+            if ('string' == typeof option && params && params.length > 0) {
+                data[option].apply(data, Array.prototype.slice.call(params, 1));
             }
         });
     };

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrapValidator.min.js


+ 4 - 3
src/js/bootstrapValidator.js

@@ -839,7 +839,8 @@
     };
 
     // Plugin definition
-    $.fn.bootstrapValidator = function(option, params) {
+    $.fn.bootstrapValidator = function(option) {
+        var params = arguments;
         return this.each(function() {
             var $this   = $(this),
                 data    = $this.data('bootstrapValidator'),
@@ -850,8 +851,8 @@
             }
 
             // Allow to call plugin method
-            if ('string' == typeof option) {
-                data[option](params);
+            if ('string' == typeof option && params && params.length > 0) {
+                data[option].apply(data, Array.prototype.slice.call(params, 1));
             }
         });
     };