From 52b84c8239dd141a3172bf24797c5dc3b93d33e3 Mon Sep 17 00:00:00 2001
From: Nguyen Khac Chinh
Date: Thu, 7 Jun 2018 17:06:42 +0700
Subject: [PATCH 1/6] fix bug: Cannot read property 'set' of undefined when set
data to the inputs does not exists
---
jquery.input.js | 10 +-
jquery.input.min.js | 6 +-
package-lock.json | 1544 +++++++++++++++++++++++++++++++++++++++++++
src/main.js | 4 +-
4 files changed, 1556 insertions(+), 8 deletions(-)
create mode 100644 package-lock.json
diff --git a/jquery.input.js b/jquery.input.js
index ad8d6ad..d56f20f 100644
--- a/jquery.input.js
+++ b/jquery.input.js
@@ -1,6 +1,6 @@
-// jquery.input version 0.0.1
+// jquery.input version 0.1.0
// https://github.com/DubFriend/jquery.input
-// (MIT) 09-08-2015
+// (MIT) 07-06-2018
// Brian Detering (http://www.briandetering.net/)
(function ($) {
'use strict';
@@ -893,7 +893,7 @@ var buildFormInputs = function (fig) {
addInputsGroup('checkbox', $self);
}
else {
- //in all other cases default to a "text" input interface.
+ // in all other cases default to a "text" input interface.
addInputsBasic('text', $self);
}
}
@@ -1038,7 +1038,9 @@ $.fn.inputVal = function (newValue) {
}
else {
foreach(newValue, function (value, inputName) {
- inputs[inputName].set(value);
+ if(inputs[inputName]){
+ inputs[inputName].set(value);
+ }
});
return $self;
}
diff --git a/jquery.input.min.js b/jquery.input.min.js
index 76b1907..ddd44c2 100644
--- a/jquery.input.min.js
+++ b/jquery.input.min.js
@@ -1,5 +1,5 @@
-// jquery.input version 0.0.1
+// jquery.input version 0.1.0
// https://github.com/DubFriend/jquery.input
-// (MIT) 09-08-2015
+// (MIT) 07-06-2018
// Brian Detering (http://www.briandetering.net/)
-!function(a){"use strict";var b=function(b){return a.isArray(b)},c=function(a){return!b(a)&&a instanceof Object},d=function(a){return a instanceof Function},e=function(a){var b=Array.prototype.slice.call(arguments,1);return d(a)?function(){var c=Array.prototype.slice.call(arguments);return a.apply(null,b.concat(c))}:void 0},f=function(b,c){return a.inArray(c,b)},g=function(a,b){return-1!==f(a,b)},h=function(a,b){for(var c in a)a.hasOwnProperty(c)&&b(a[c],c,a)},i=function(a){return a[a.length-1]},j=function(a,b){var c=[];return h(a,function(a,d,e){c.push(b(a,d,e))}),c},k=function(a,b,c){var d={};return h(a,function(a,e,f){e=c?c(e,a):e,d[e]=b(a,e,f)}),d},l=function(a,c,d){return b(a)?j(a,c):k(a,c,d)},m=function(a,b,c){return l(a,function(a,d){return a[b].apply(a,c||[])})},n=function(){var a,b={};for(a=0;a").closest("form").get(0).reset(),a(this).unwrap()})},d.$().change(function(a){c.publishChange(a,this)}),d},x=function(a){var b={},c=r(a,b);return c.getType=function(){return"hidden"},c.$().change(function(a){b.publishChange(a,this)}),c},y=function(b){var c={},d=q(b,c);return d.getType=function(){return"file[multiple]"},d.get=function(){var a,b=d.$().get(0).files||[],c=[];for(a=0;a<(b.length||0);a+=1)c.push(b[a].name);return c},d.clear=function(){this.$().each(function(){a(this).wrap("