vendor/assets/javascripts/webshims/shims/combos/17.js in webshims-rails-1.14.4 vs vendor/assets/javascripts/webshims/shims/combos/17.js in webshims-rails-1.14.5

- old
+ new

@@ -28,11 +28,10 @@ } }; } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); }, supportsType = function(type){ @@ -1418,13 +1417,15 @@ }; return function(element, labels, noFocus){ $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; })(); var addZero = function(val){ @@ -3078,11 +3079,11 @@ } $(opts.orig).off('invalid.replacedwidgetbubble'); }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { $(this).css('display', 'none'); } @@ -3108,47 +3109,48 @@ }); }); } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); return data; } }); } ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; } var markup = opts.splitInput ?