vendor/assets/javascripts/webshims/shims/combos/11.js in webshims-rails-1.15.3 vs vendor/assets/javascripts/webshims/shims/combos/11.js in webshims-rails-1.15.4
- old
+ new
@@ -1042,13 +1042,17 @@
}
return val;
},
time: function(val, o, noCorrect){
var fVal, i;
+
if(val){
val = val.split(':');
+ if(val.length != 2 || isNaN(parseInt(val[0] || '', 10)) || isNaN(parseInt(val[1] || '', 10))){
+ return val.join(':');
+ }
if(curCfg.meridian){
fVal = (val[0] * 1);
if(fVal && fVal >= 12){
val[0] = addZero(fVal - 12+'');
fVal = 1;
@@ -1199,10 +1203,11 @@
},
date: function(val, opts, noCorrect){
createFormat('d');
var tmp, obj;
var ret = '';
+
if(opts.splitInput){
obj = {yy: 0, mm: 1, dd: 2};
} else {
obj = curCfg.patterns.dObj;
val = val.split(curCfg.dFormat);
@@ -1220,12 +1225,11 @@
}
val[obj.yy] = tmp + val[obj.yy];
}
ret = ([addZero(val[obj.yy]), addZero(val[obj.mm]), addZero(val[obj.dd])]).join('-');
}
- return ret
- ;
+ return ret;
},
color: function(val, opts){
var ret = '#000000';
if(val){
val = val.toLowerCase();
@@ -1523,13 +1527,15 @@
}
}
};
['defaultValue', 'value'].forEach(function(name){
+ var formatName = 'format'+name;
wsWidgetProto[name] = function(val, force){
- if(!this._init || force || val !== this.options[name]){
- this.element.prop(name, this.formatValue(val));
+ if(!this._init || force || val !== this.options[name] || this.options[formatName] != this.element.prop(name)){
+ this.options[formatName] = this.formatValue(val);
+ this.element.prop(name, this.options[formatName]);
this.options[name] = val;
this._propertyChange(name);
this.mirrorValidity();
}
};
@@ -1649,39 +1655,37 @@
['defaultValue', 'value'].forEach(function(name){
var isValue = name == 'value';
spinBtnProto[name] = function(val, force, isLive){
var selectionEnd;
- if(!this._init || force || this.options[name] !== val){
- if(isValue){
- this._beforeValue(val);
- } else {
- this.elemHelper.prop(name, val);
- }
+ if(isValue){
+ this._beforeValue(val);
+ } else {
+ this.elemHelper.prop(name, val);
+ }
- val = formatVal[this.type](val, this.options);
- if(this.options.splitInput){
- $.each(this.splits, function(i, elem){
- var setOption;
- if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
- $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
- } else {
- $.prop(elem, name, val[i]);
- }
- });
- } else {
- val = this.toFixed(val);
- if(isLive && this._getSelectionEnd){
- selectionEnd = this._getSelectionEnd(val);
+ val = formatVal[this.type](val, this.options);
+ if(this.options.splitInput){
+ $.each(this.splits, function(i, elem){
+ var setOption;
+ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
+ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
+ } else {
+ $.prop(elem, name, val[i]);
}
- this.element.prop(name, val);
- if(selectionEnd != null){
- this.element.prop('selectionEnd', selectionEnd);
- }
+ });
+ } else {
+ val = this.toFixed(val);
+ if(isLive && this._getSelectionEnd){
+ selectionEnd = this._getSelectionEnd(val);
}
- this._propertyChange(name);
- this.mirrorValidity();
+ this.element.prop(name, val);
+ if(selectionEnd != null){
+ this.element.prop('selectionEnd', selectionEnd);
+ }
}
+ this._propertyChange(name);
+ this.mirrorValidity();
};
});
$.each({min: 1, max: -1}, function(name, factor){
var numName = name +'AsNumber';