webshims-rails 1.11.1 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +8 -8
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/polyfiller.js +41 -20
  4. data/vendor/assets/javascripts/webshims/shims/combos/10.js +212 -42
  5. data/vendor/assets/javascripts/webshims/shims/combos/11.js +196 -37
  6. data/vendor/assets/javascripts/webshims/shims/combos/12.js +82 -36
  7. data/vendor/assets/javascripts/webshims/shims/combos/13.js +82 -36
  8. data/vendor/assets/javascripts/webshims/shims/combos/14.js +17 -6
  9. data/vendor/assets/javascripts/webshims/shims/combos/15.js +234 -1247
  10. data/vendor/assets/javascripts/webshims/shims/combos/16.js +234 -1247
  11. data/vendor/assets/javascripts/webshims/shims/combos/17.js +202 -45
  12. data/vendor/assets/javascripts/webshims/shims/combos/18.js +202 -45
  13. data/vendor/assets/javascripts/webshims/shims/combos/19.js +16 -5
  14. data/vendor/assets/javascripts/webshims/shims/combos/2.js +51 -11
  15. data/vendor/assets/javascripts/webshims/shims/combos/20.js +16 -5
  16. data/vendor/assets/javascripts/webshims/shims/combos/21.js +82 -36
  17. data/vendor/assets/javascripts/webshims/shims/combos/22.js +82 -36
  18. data/vendor/assets/javascripts/webshims/shims/combos/24.js +1689 -997
  19. data/vendor/assets/javascripts/webshims/shims/combos/25.js +16 -5
  20. data/vendor/assets/javascripts/webshims/shims/combos/26.js +16 -5
  21. data/vendor/assets/javascripts/webshims/shims/combos/3.js +16 -5
  22. data/vendor/assets/javascripts/webshims/shims/combos/30.js +51 -11
  23. data/vendor/assets/javascripts/webshims/shims/combos/31.js +51 -11
  24. data/vendor/assets/javascripts/webshims/shims/combos/4.js +16 -5
  25. data/vendor/assets/javascripts/webshims/shims/combos/5.js +202 -45
  26. data/vendor/assets/javascripts/webshims/shims/combos/6.js +237 -51
  27. data/vendor/assets/javascripts/webshims/shims/combos/7.js +51 -11
  28. data/vendor/assets/javascripts/webshims/shims/combos/8.js +16 -5
  29. data/vendor/assets/javascripts/webshims/shims/combos/9.js +247 -48
  30. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +17 -5
  31. data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +21 -3
  32. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +35 -6
  33. data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +6 -8
  34. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +134 -24
  35. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +152 -1205
  36. data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +1076 -0
  37. data/vendor/assets/javascripts/webshims/shims/form-validation.js +47 -20
  38. data/vendor/assets/javascripts/webshims/shims/form-validators.js +2 -2
  39. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
  40. data/vendor/assets/javascripts/webshims/shims/i18n/{formcfg-de.txt → formcfg-de.js} +3 -0
  41. data/vendor/assets/javascripts/webshims/shims/i18n/{formcfg-en.txt → formcfg-en.js} +5 -1
  42. data/vendor/assets/javascripts/webshims/shims/json-storage.js +1 -1
  43. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +1 -1
  44. data/vendor/assets/javascripts/webshims/shims/range-ui.js +62 -13
  45. data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +610 -0
  46. data/vendor/assets/javascripts/webshims/shims/styles/scss/_extends.scss +10 -0
  47. data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +743 -0
  48. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +1 -755
  49. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +0 -606
  50. data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
  51. data/vendor/assets/javascripts/webshims/shims/track-ui.js +36 -23
  52. data/vendor/assets/javascripts/webshims/shims/track.js +82 -36
  53. metadata +8 -6
  54. data/vendor/assets/javascripts/webshims/shims/combos/28.js +0 -2196
  55. data/vendor/assets/javascripts/webshims/shims/combos/29.js +0 -1167
@@ -6,7 +6,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
6
6
  webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
7
7
 
8
8
  if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
9
- webshims.error("IE browser modes are busted in IE10. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
9
+ webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools");
10
10
  }
11
11
 
12
12
  if(!$.parseHTML){
@@ -559,7 +559,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
559
559
  $(this.test);
560
560
  webshims.ready('WINDOWLOAD', this.test);
561
561
  $(document).on('updatelayout', this.handler);
562
- $(window).bind('resize', this.handler);
562
+ $(window).on('resize', this.handler);
563
563
  (function(){
564
564
  var oldAnimate = $.fn.animate;
565
565
  var animationTimer;
@@ -581,6 +581,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
581
581
  webshims.docObserve = function(){
582
582
  webshims.ready('DOM', function(){
583
583
  docObserve.start();
584
+ if($.support.boxSizing == null){
585
+ $(function(){
586
+ if($.support.boxSizing){
587
+ docObserve.handler({type: 'boxsizing'});
588
+ }
589
+ });
590
+ }
584
591
  });
585
592
  };
586
593
  return function(nativeElem, shadowElem, opts){
@@ -741,7 +748,12 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
741
748
  havePolyfill[prop] = true;
742
749
 
743
750
  if(descs.reflect){
744
- webshims.propTypes[descs.propType || 'standard'](descs, prop);
751
+ if(descs.propType && !webshims.propTypes[descs.propType]){
752
+ webshims.error('could not finde propType '+ descs.propType);
753
+ } else {
754
+ webshims.propTypes[descs.propType || 'standard'](descs, prop);
755
+ }
756
+
745
757
  }
746
758
 
747
759
  ['prop', 'attr', 'removeAttr'].forEach(function(type){
@@ -927,7 +939,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
927
939
  var notLocal = /:\/\/|^\.*\//;
928
940
  var loadRemoteLang = function(data, lang, options){
929
941
  var langSrc;
930
- if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
942
+ if(lang && options && $.inArray(lang, options.availableLangs || options.availabeLangs || []) !== -1){
931
943
  data.loading = true;
932
944
  langSrc = options.langSrc;
933
945
  if(!notLocal.test(langSrc)){
@@ -1087,7 +1099,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1087
1099
  });
1088
1100
 
1089
1101
  })(webshims.$, document);
1090
-
1091
1102
  webshims.register('form-message', function($, webshims, window, document, undefined, options){
1092
1103
  "use strict";
1093
1104
  if(options.lazyCustomMessages){
@@ -410,7 +410,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
410
410
  cache = {type: type};
411
411
  if(!factor){
412
412
  factor = 1;
413
- webshims.info("you should always use a factor for stepUp/stepDown");
413
+ webshims.warn("you should always use a factor for stepUp/stepDown");
414
414
  }
415
415
  factor *= stepFactor;
416
416
 
@@ -446,13 +446,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
446
446
  webshims.info("max/min overflow can't apply stepUp/stepDown");
447
447
  throw('invalid state error');
448
448
  }
449
- if(dateVal){
450
- $.prop(this, 'valueAsDate', dateVal);
451
- } else {
452
- $.prop(this, 'valueAsNumber', val);
453
- }
454
- } else if(stepDescriptor.prop && stepDescriptor.prop.value){
455
- return stepDescriptor.prop.value.apply(this, arguments);
449
+
450
+ $.prop(this, 'valueAsNumber', val);
451
+
452
+ } else if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
453
+ return stepDescriptor.prop._supvalue.apply(this, arguments);
456
454
  } else {
457
455
  webshims.info("no step method for type: "+ type);
458
456
  throw('invalid state error');
@@ -819,9 +817,9 @@ webshims.register('form-number-date-api', function($, webshims, window, document
819
817
  var i;
820
818
 
821
819
 
822
- this.element.addClass('ws-range').attr({role: 'slider'}).append('<span class="ws-range-min" /><span class="ws-range-rail"><span class="ws-range-thumb" /></span>');
823
- this.trail = $('.ws-range-rail', this.element);
824
- this.range = $('.ws-range-min', this.element);
820
+ this.element.addClass('ws-range').attr({role: 'slider'}).append('<span class="ws-range-min ws-range-progress" /><span class="ws-range-rail ws-range-track"><span class="ws-range-thumb" /></span>');
821
+ this.trail = $('.ws-range-track', this.element);
822
+ this.range = $('.ws-range-progress ', this.element);
825
823
  this.thumb = $('.ws-range-thumb', this.trail);
826
824
 
827
825
  this.updateMetrics();
@@ -831,6 +829,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
831
829
  for(i = 0; i < createOpts.length; i++){
832
830
  this[createOpts[i]](this.options[createOpts[i]]);
833
831
  }
832
+
834
833
  this.value = this._value;
835
834
  this.value(this.options.value);
836
835
  this.initDataList();
@@ -1069,7 +1068,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1069
1068
  }
1070
1069
  },
1071
1070
  addBindings: function(){
1072
- var leftOffset, widgetUnits, hasFocus;
1071
+ var leftOffset, widgetUnits, hasFocus, isActive;
1073
1072
  var that = this;
1074
1073
  var o = this.options;
1075
1074
 
@@ -1099,8 +1098,28 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1099
1098
  }
1100
1099
  };
1101
1100
  })();
1102
-
1101
+ var normalizeTouch = (function(){
1102
+ var types = {
1103
+ touchstart: 1,
1104
+ touchend: 1,
1105
+ touchmove: 1
1106
+ };
1107
+ var normalize = ['pageX', 'pageY'];
1108
+ return function(e){
1109
+ if(types[e.type] && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length){
1110
+ for(var i = 0; i < normalize.length; i++){
1111
+ e[normalize[i]] = e.originalEvent.touches[0][normalize[i]];
1112
+ }
1113
+
1114
+ }
1115
+ return e;
1116
+ };
1117
+ })();
1103
1118
  var setValueFromPos = function(e, animate){
1119
+ if(e.type == 'touchmove'){
1120
+ e.preventDefault();
1121
+ normalizeTouch(e);
1122
+ }
1104
1123
 
1105
1124
  var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits);
1106
1125
  if(val != o.value){
@@ -1117,18 +1136,25 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1117
1136
  eventTimer.call('change', o.value);
1118
1137
  }
1119
1138
  that.addRemoveClass('ws-active');
1120
- $(document).off('mousemove', setValueFromPos).off('mouseup', remove);
1139
+ $(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove);
1121
1140
  $(window).off('blur', removeWin);
1141
+ isActive = false;
1122
1142
  };
1123
1143
  var removeWin = function(e){
1124
1144
  if(e.target == window){remove();}
1125
1145
  };
1126
1146
  var add = function(e){
1127
1147
  var outerWidth;
1148
+
1149
+ if(isActive || (e.type == 'touchstart' && (!e.originalEvent || !e.originalEvent.touches || e.originalEvent.touches.length != 1))){
1150
+ return;
1151
+ }
1128
1152
  e.preventDefault();
1129
- $(document).off('mousemove', setValueFromPos).off('mouseup', remove);
1153
+
1154
+ $(document).off('mousemove touchmove', setValueFromPos).off('mouseup touchend', remove);
1130
1155
  $(window).off('blur', removeWin);
1131
1156
  if(!o.readonly && !o.disabled){
1157
+ normalizeTouch(e);
1132
1158
  that.element.focus();
1133
1159
  that.addRemoveClass('ws-active', true);
1134
1160
  leftOffset = that.element.focus().offset();
@@ -1138,20 +1164,27 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1138
1164
  leftOffset = leftOffset[that.dirs.pos];
1139
1165
  widgetUnits = 100 / widgetUnits;
1140
1166
  setValueFromPos(e, o.animate);
1167
+ isActive = true;
1141
1168
  $(document)
1142
- .on({
1143
- mouseup: remove,
1144
- mousemove: setValueFromPos
1145
- })
1169
+ .on(e.type == 'touchstart' ?
1170
+ {
1171
+ touchend: remove,
1172
+ touchmove: setValueFromPos
1173
+ } :
1174
+ {
1175
+ mouseup: remove,
1176
+ mousemove: setValueFromPos
1177
+ }
1178
+ )
1146
1179
  ;
1147
1180
  $(window).on('blur', removeWin);
1148
1181
  e.stopPropagation();
1149
1182
  }
1150
1183
  };
1151
1184
  var elementEvts = {
1152
- mousedown: add,
1185
+ 'touchstart mousedown': add,
1153
1186
  focus: function(e){
1154
- if(!o.disabled){
1187
+ if(!o.disabled && !hasFocus){
1155
1188
  eventTimer.init('input', o.value);
1156
1189
  eventTimer.init('change', o.value);
1157
1190
  that.addRemoveClass('ws-focus', true);
@@ -1214,6 +1247,20 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1214
1247
  this.thumb.on({
1215
1248
  mousedown: add
1216
1249
  });
1250
+
1251
+ if(this.orig){
1252
+ $(this.orig).jProp('form').on('reset', function(){
1253
+ var val = $.prop(that.orig, 'value');
1254
+ that.value(val);
1255
+ setTimeout(function(){
1256
+ var val2 = $.prop(that.orig, 'value');
1257
+ if(val != val2){
1258
+ that.value(val2);
1259
+ }
1260
+ }, 4);
1261
+ });
1262
+ }
1263
+
1217
1264
  if (window.webshims) {
1218
1265
  webshims.ready('WINDOWLOAD', function(){
1219
1266
  webshims.ready('dom-support', function(){
@@ -1319,8 +1366,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1319
1366
  var str;
1320
1367
  return function(){
1321
1368
  if(!str){
1322
- str = ('<option></option>')+$.map(monthDigits, function(val){
1323
- return '<option>'+val+'</option>';
1369
+ str = ('<option value=""></option>')+$.map(monthDigits, function(val){
1370
+ return '<option value="'+val+'"]>'+val+'</option>';
1324
1371
  }).join('');
1325
1372
  }
1326
1373
  return str;
@@ -1342,7 +1389,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1342
1389
  splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]]
1343
1390
  };
1344
1391
  if(opts.monthSelect){
1345
- obj.splits.push($('<select class="mm">'+getMonthOptions()+'</select>')[0]);
1392
+ obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
1346
1393
  } else {
1347
1394
  obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]);
1348
1395
  }
@@ -1377,7 +1424,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1377
1424
  splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
1378
1425
  };
1379
1426
  if(opts.monthSelect){
1380
- obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions()+'</select>')[0]);
1427
+ obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions(opts)+'</select>')[0]);
1381
1428
  } else {
1382
1429
  obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]);
1383
1430
  if(opts.onlyMonthDigits){
@@ -1469,6 +1516,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1469
1516
  month: {
1470
1517
  currentText: 'Aktueller Monat'
1471
1518
  },
1519
+ time: {
1520
+ currentText: 'Jetzt'
1521
+ },
1472
1522
  date: {
1473
1523
  close: 'schließen',
1474
1524
  clear: 'Löschen',
@@ -1506,6 +1556,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1506
1556
  month: {
1507
1557
  currentText: 'This month'
1508
1558
  },
1559
+ time: {
1560
+ "currentText": "Now"
1561
+ },
1509
1562
  date: {
1510
1563
  "closeText": "Done",
1511
1564
  clear: 'Clear',
@@ -1568,6 +1621,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1568
1621
  if(!langCfg['datetime-localSigns']){
1569
1622
  langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns;
1570
1623
  }
1624
+ if(!langCfg['datetime-local']){
1625
+ langCfg['datetime-local'] = {};
1626
+ }
1627
+ if(!langCfg['datetime-local'].currentText && langCfg.time.currentText){
1628
+ langCfg['datetime-local'].currentText = langCfg.time.currentText;
1629
+ }
1571
1630
  };
1572
1631
  var triggerLocaleChange = function(){
1573
1632
  processLangCFG(curCfg);
@@ -1635,6 +1694,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1635
1694
  } else {
1636
1695
  fVal = 0;
1637
1696
  }
1697
+ if(val[0] === '00'){
1698
+ val[0] = '12';
1699
+ }
1638
1700
  val = $.trim(val.join(':')) + ' '+ curCfg.meridian[fVal];
1639
1701
  }
1640
1702
  return val;
@@ -1719,6 +1781,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1719
1781
  time: function(val){
1720
1782
  var fVal;
1721
1783
  if(val && curCfg.meridian){
1784
+ if(val.substr(0,2) === "12"){
1785
+ val = "00" + val.substr(2);
1786
+ }
1722
1787
  if(val.indexOf(curCfg.meridian[1]) != -1){
1723
1788
  val = val.split(':');
1724
1789
  fVal = (val[0] * 1);
@@ -1804,7 +1869,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1804
1869
  if(hintValue.length == 2){
1805
1870
  hintValue = opts.splitInput ?
1806
1871
  hintValue :
1807
- curCfg.patterns.d.replace('yy', hintValue[0]).replace('mm', hintValue[1]);
1872
+ curCfg.date.showMonthAfterYear ?
1873
+ hintValue[0] +' '+hintValue[1] :
1874
+
1875
+ hintValue[1] +' '+ hintValue[0];
1808
1876
  } else {
1809
1877
  hintValue = opts.splitInput ?
1810
1878
  [val, val] :
@@ -2179,10 +2247,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2179
2247
  }
2180
2248
  try {
2181
2249
  that.elemHelper[name](factor);
2250
+
2182
2251
  ret = that.elemHelper.prop('value');
2252
+
2253
+ } catch (er) {
2254
+ if(!o.value && that.maxAsNumber >= that.minAsNumber){
2255
+ ret = o.defValue;
2256
+ }
2257
+ }
2258
+ if(ret !== false && o.value != ret){
2183
2259
  that.value(ret);
2184
2260
  eventTimer.call('input', ret);
2185
- } catch (er) {}
2261
+ }
2186
2262
  return ret;
2187
2263
  }
2188
2264
  };
@@ -2248,15 +2324,6 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2248
2324
 
2249
2325
  initChangeEvents();
2250
2326
  },
2251
- value: function(val, force){
2252
- if(!this._init || force || val !== this.options.value){
2253
- this.element.val(this.formatValue(val));
2254
- this.options.value = val;
2255
- this._propertyChange('value');
2256
- this.mirrorValidity();
2257
- }
2258
-
2259
- },
2260
2327
  required: function(val, boolVal){
2261
2328
  this.inputElements.attr({'aria-required': ''+boolVal});
2262
2329
  this.mirrorValidity();
@@ -2273,7 +2340,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2273
2340
  formatValue: function(val, noSplit){
2274
2341
  return formatVal[this.type](val, noSplit === false ? false : this.options);
2275
2342
  },
2276
- createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
2343
+ createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
2277
2344
  placeholder: function(val){
2278
2345
  var options = this.options;
2279
2346
  options.placeholder = val;
@@ -2343,6 +2410,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2343
2410
  }
2344
2411
  };
2345
2412
 
2413
+ ['defaultValue', 'value'].forEach(function(name){
2414
+ wsWidgetProto[name] = function(val, force){
2415
+ if(!this._init || force || val !== this.options[name]){
2416
+ this.element.prop(name, this.formatValue(val));
2417
+ this.options[name] = val;
2418
+ this._propertyChange(name);
2419
+ this.mirrorValidity();
2420
+ }
2421
+ };
2422
+ });
2346
2423
 
2347
2424
  ['readonly', 'disabled'].forEach(function(name){
2348
2425
  var isDisabled = name == 'disabled';
@@ -2396,7 +2473,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2396
2473
  }
2397
2474
  this._init = true;
2398
2475
  },
2399
- createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
2476
+ createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
2400
2477
  _addSplitInputs: function(){
2401
2478
  if(!this.inputElements){
2402
2479
  var create = splitInputs[this.type]._create(this.options);
@@ -2466,9 +2543,47 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2466
2543
  this.options.step = val;
2467
2544
  this.elemHelper.prop('step', retDefault(val, defStep.step));
2468
2545
  this.mirrorValidity();
2546
+ },
2547
+ _beforeValue: function(val){
2548
+ this.valueAsNumber = this.asNumber(val);
2549
+ this.options.value = val;
2550
+
2551
+ if(isNaN(this.valueAsNumber) || (!isNaN(this.minAsNumber) && this.valueAsNumber < this.minAsNumber) || (!isNaN(this.maxAsNumber) && this.valueAsNumber > this.maxAsNumber)){
2552
+ this._setStartInRange();
2553
+ } else {
2554
+ this.elemHelper.prop('value', val);
2555
+ this.options.defValue = "";
2556
+ }
2469
2557
  }
2470
2558
  });
2471
2559
 
2560
+ ['defaultValue', 'value'].forEach(function(name){
2561
+ var isValue = name == 'value';
2562
+ spinBtnProto[name] = function(val, force){
2563
+ if(!this._init || force || this.options[name] !== val){
2564
+ if(isValue){
2565
+ this._beforeValue(val);
2566
+ }
2567
+
2568
+ val = formatVal[this.type](val, this.options);
2569
+ if(this.options.splitInput){
2570
+ $.each(this.splits, function(i, elem){
2571
+ var setOption;
2572
+ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
2573
+ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
2574
+ } else {
2575
+ $.prop(elem, name, val[i]);
2576
+ }
2577
+ });
2578
+ } else {
2579
+ this.element.prop(name, val);
2580
+ }
2581
+ this._propertyChange(name);
2582
+ this.mirrorValidity();
2583
+ }
2584
+ };
2585
+ });
2586
+
2472
2587
  $.each({min: 1, max: -1}, function(name, factor){
2473
2588
  var numName = name +'AsNumber';
2474
2589
  spinBtnProto[name] = function(val){
@@ -2872,10 +2987,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2872
2987
  var inputTypes = {
2873
2988
 
2874
2989
  };
2990
+ var boolAttrs = {disabled: 1, required: 1, readonly: 1};
2875
2991
  var copyProps = [
2876
2992
  'disabled',
2877
2993
  'readonly',
2878
2994
  'value',
2995
+ 'defaultValue',
2879
2996
  'min',
2880
2997
  'max',
2881
2998
  'step',
@@ -2893,14 +3010,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2893
3010
  if(!stopCircular){
2894
3011
  var shadowData = webshims.data(this, 'shadowData');
2895
3012
  if(shadowData && shadowData.data && shadowData.nativeElement === this && shadowData.data[fnName]){
2896
- shadowData.data[fnName](val, boolVal);
3013
+ if(boolAttrs[fnName]){
3014
+ shadowData.data[fnName](val, boolVal);
3015
+ } else {
3016
+ shadowData.data[fnName](val);
3017
+ }
2897
3018
  }
2898
3019
  }
2899
3020
  });
2900
3021
  });
2901
3022
 
2902
3023
  if(options.replaceUI && 'valueAsNumber' in document.createElement('input')){
2903
- var reflectFn = function(val){
3024
+ var reflectFn = function(){
2904
3025
  if(webshims.data(this, 'hasShadow')){
2905
3026
  $.prop(this, 'value', $.prop(this, 'value'));
2906
3027
  }
@@ -2908,6 +3029,20 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2908
3029
 
2909
3030
  webshims.onNodeNamesPropertyModify('input', 'valueAsNumber', reflectFn);
2910
3031
  webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn);
3032
+ $.each({stepUp: 1, stepDown: -1}, function(name, stepFactor){
3033
+ var stepDescriptor = webshims.defineNodeNameProperty('input', name, {
3034
+ prop: {
3035
+ value: function(){
3036
+ var ret;
3037
+ if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
3038
+ ret = stepDescriptor.prop._supvalue.apply(this, arguments);
3039
+ reflectFn.apply(this, arguments);
3040
+ }
3041
+ return ret;
3042
+ }
3043
+ }
3044
+ });
3045
+ });
2911
3046
  }
2912
3047
 
2913
3048
  var extendType = (function(){
@@ -2927,7 +3062,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2927
3062
  $(data.orig).removeClass('ws-important-hide');
2928
3063
  $.style( data.orig, 'display', '' );
2929
3064
  var hasButtons, marginR, marginL;
2930
- var correctWidth = 0.6;
3065
+ var correctWidth = 0.8;
2931
3066
  if(!init || data.orig.offsetWidth){
2932
3067
  hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
2933
3068
  marginR = $.css( data.orig, 'marginRight');
@@ -2951,7 +3086,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
2951
3086
  ;
2952
3087
  } else {
2953
3088
  data.buttonWrapper.css('marginRight', marginR);
2954
- correctWidth = data.buttonWrapper.outerWidth(true) + 0.6;
3089
+ correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
2955
3090
  }
2956
3091
  }
2957
3092
 
@@ -3109,7 +3244,29 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
3109
3244
  });
3110
3245
  }
3111
3246
 
3112
- if(!modernizrInputTypes.range || options.replaceUI){
3247
+ var replace = {};
3248
+
3249
+
3250
+ if(options.replaceUI){
3251
+ if( $.isPlainObject(options.replaceUI) ){
3252
+ $.extend(replace, options.replaceUI);
3253
+ } else {
3254
+ $.extend(replace, {
3255
+ 'range': 1,
3256
+ 'number': 1,
3257
+ 'time': 1,
3258
+ 'month': 1,
3259
+ 'date': 1,
3260
+ 'color': 1,
3261
+ 'datetime-local': 1
3262
+ });
3263
+ }
3264
+ }
3265
+ if(modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
3266
+ replace.number = 1;
3267
+ }
3268
+
3269
+ if(!modernizrInputTypes.range || replace.range){
3113
3270
  extendType('range', {
3114
3271
  _create: function(opts, set){
3115
3272
  var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@@ -3118,9 +3275,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
3118
3275
  });
3119
3276
  }
3120
3277
 
3121
- var isStupid = modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)));
3278
+
3122
3279
  ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
3123
- if(!modernizrInputTypes[name] || options.replaceUI || (name == 'number' && isStupid)){
3280
+ if(!modernizrInputTypes[name] || replace[name]){
3124
3281
  extendType(name, {
3125
3282
  _create: function(opts, set){
3126
3283
  if(opts.monthSelect){