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)){
@@ -1086,4 +1098,4 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1086
1098
  }
1087
1099
  });
1088
1100
 
1089
- })(webshims.$, document);
1101
+ })(webshims.$, document);
@@ -25,6 +25,7 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
25
25
 
26
26
  var lReg = /</g;
27
27
  var gReg = />/g;
28
+ var splitReg = /\s*,\s*/g;
28
29
 
29
30
  $.extend(options.shadowListProto, {
30
31
  _lazyCreate: function(opts){
@@ -184,7 +185,7 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
184
185
  }
185
186
  this.addMarkElement = options.addMark || $(this.input).hasClass('mark-option-text');
186
187
  this.listFilter = $(this.input).data('listFilter') || options.listFilter || '*';
187
-
188
+ this.multiple = $(this.input).hasClass('list-multiple') || ($(this.input).prop('multiple') && $(this.input).prop('type') == 'email');
188
189
  var list = [];
189
190
 
190
191
  var values = [];
@@ -256,7 +257,13 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
256
257
  //first check prevent infinite loop, second creates simple lazy optimization
257
258
  if(value === this.lastUpdatedValue){
258
259
  return;
259
- }
260
+ }
261
+
262
+ if(this.multiple){
263
+ value = value.split(splitReg);
264
+ value = value[value.length - 1] || '';
265
+ }
266
+
260
267
  if(this.lastUnfoundValue && value.indexOf(this.lastUnfoundValue) === 0){
261
268
  this.hideList();
262
269
  return;
@@ -268,8 +275,11 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
268
275
  var startSearch = this.listFilter == '^';
269
276
  var lis = $('li', this.shadowList);
270
277
  var that = this;
278
+
279
+
271
280
  if(value && this.listFilter != '!'){
272
281
 
282
+
273
283
  this.arrayOptions.forEach(function(item, i){
274
284
  var search, searchIndex, foundName;
275
285
  if(!('lowerValue' in item)){
@@ -390,9 +400,17 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
390
400
  },
391
401
  changeValue: function(activeItem){
392
402
  if(!activeItem[0]){return;}
393
- var spinner;
403
+ var spinner, tmpValue;
394
404
  var newValue = $('span.option-value', activeItem).text();
395
405
  var oldValue = $.prop(this.input, 'value');
406
+
407
+ if(this.multiple){
408
+ tmpValue = oldValue.split(splitReg);
409
+ tmpValue[tmpValue.length - 1] = newValue;
410
+
411
+ newValue = tmpValue.join(', ');
412
+ }
413
+
396
414
  if(newValue != oldValue){
397
415
 
398
416
  $(this.input)
@@ -33,12 +33,12 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
33
33
  /*
34
34
  * implement propType "element" currently only used for list-attribute (will be moved to dom-extend, if needed)
35
35
  */
36
- webshims.propTypes.element = function(descs){
36
+ webshims.propTypes.element = function(descs, name){
37
37
  webshims.createPropDefault(descs, 'attr');
38
38
  if(descs.prop){return;}
39
39
  descs.prop = {
40
40
  get: function(){
41
- var elem = $.attr(this, 'list');
41
+ var elem = $.attr(this, name);
42
42
  if(elem){
43
43
  elem = document.getElementById(elem);
44
44
  if(elem && descs.propNodeName && !$.nodeName(elem, descs.propNodeName)){
@@ -62,7 +62,15 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
62
62
  if(listSupport && !formsCFG.customDatalist){return;}
63
63
 
64
64
  var initializeDatalist = function(){
65
-
65
+
66
+ var updateDatlistAndOptions = function(){
67
+ var id;
68
+ if(!$.data(this, 'datalistWidgetData') && (id = $.prop(this, 'id'))){
69
+ $('input[list="'+ id +'"], input[data-wslist="'+ id +'"]').eq(0).attr('list', id);
70
+ } else {
71
+ $(this).triggerHandler('updateDatalist');
72
+ }
73
+ };
66
74
 
67
75
  var inputListProto = {
68
76
  //override autocomplete
@@ -140,6 +148,7 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
140
148
  id: value,
141
149
  datalist: $.prop(elem, 'list')
142
150
  });
151
+ elem.setAttribute('data-wslist', value);
143
152
  } else {
144
153
  elem.setAttribute('list', value);
145
154
  }
@@ -151,6 +160,27 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
151
160
  propType: 'element',
152
161
  propNodeName: 'datalist'
153
162
  };
163
+ } else {
164
+ webshims.defineNodeNameProperties('input', {
165
+ list: {
166
+ attr: {
167
+ get: function(){
168
+ var val = webshims.contentAttr(this, 'list');
169
+ return (val == null) ? undefined : val;
170
+ },
171
+ set: function(value){
172
+ var elem = this;
173
+ webshims.contentAttr(elem, 'list', value);
174
+ webshims.objectCreate(options.shadowListProto, undefined, {input: elem, id: value, datalist: $.prop(elem, 'list')});
175
+ $(elem).triggerHandler('listdatalistchange');
176
+ }
177
+ },
178
+ initAttr: true,
179
+ reflect: true,
180
+ propType: 'element',
181
+ propNodeName: 'datalist'
182
+ }
183
+ });
154
184
  }
155
185
 
156
186
  webshims.defineNodeNameProperties('input', inputListProto);
@@ -159,9 +189,7 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
159
189
  contextElem
160
190
  .filter('datalist > select, datalist, datalist > option, datalist > select > option')
161
191
  .closest('datalist')
162
- .each(function(){
163
- $(this).triggerHandler('updateDatalist');
164
- })
192
+ .each(updateDatlistAndOptions)
165
193
  ;
166
194
  });
167
195
  };
@@ -206,6 +234,7 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
206
234
  this.hasViewableData = true;
207
235
  this._autocomplete = $.attr(opts.input, 'autocomplete');
208
236
  $.data(opts.input, 'datalistWidget', this);
237
+ $.data(datalist, 'datalistWidgetData', this);
209
238
 
210
239
  lazyLoad('WINDOWLOAD');
211
240
 
@@ -198,7 +198,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
198
198
  cache = {type: type};
199
199
  if(!factor){
200
200
  factor = 1;
201
- webshims.info("you should always use a factor for stepUp/stepDown");
201
+ webshims.warn("you should always use a factor for stepUp/stepDown");
202
202
  }
203
203
  factor *= stepFactor;
204
204
 
@@ -234,13 +234,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
234
234
  webshims.info("max/min overflow can't apply stepUp/stepDown");
235
235
  throw('invalid state error');
236
236
  }
237
- if(dateVal){
238
- $.prop(this, 'valueAsDate', dateVal);
239
- } else {
240
- $.prop(this, 'valueAsNumber', val);
241
- }
242
- } else if(stepDescriptor.prop && stepDescriptor.prop.value){
243
- return stepDescriptor.prop.value.apply(this, arguments);
237
+
238
+ $.prop(this, 'valueAsNumber', val);
239
+
240
+ } else if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
241
+ return stepDescriptor.prop._supvalue.apply(this, arguments);
244
242
  } else {
245
243
  webshims.info("no step method for type: "+ type);
246
244
  throw('invalid state error');
@@ -10,8 +10,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
10
10
  var str;
11
11
  return function(){
12
12
  if(!str){
13
- str = ('<option></option>')+$.map(monthDigits, function(val){
14
- return '<option>'+val+'</option>';
13
+ str = ('<option value=""></option>')+$.map(monthDigits, function(val){
14
+ return '<option value="'+val+'"]>'+val+'</option>';
15
15
  }).join('');
16
16
  }
17
17
  return str;
@@ -33,7 +33,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
33
33
  splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" />')[0]]
34
34
  };
35
35
  if(opts.monthSelect){
36
- obj.splits.push($('<select class="mm">'+getMonthOptions()+'</select>')[0]);
36
+ obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
37
37
  } else {
38
38
  obj.splits.push($('<input type="text" class="mm" inputmode="numeric" maxlength="2" size="2" />')[0]);
39
39
  }
@@ -68,7 +68,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
68
68
  splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
69
69
  };
70
70
  if(opts.monthSelect){
71
- obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions()+'</select>')[0]);
71
+ obj.splits.push($('<select class="mm ws-spin">'+getMonthOptions(opts)+'</select>')[0]);
72
72
  } else {
73
73
  obj.splits.push($('<input type="text" class="mm ws-spin" />')[0]);
74
74
  if(opts.onlyMonthDigits){
@@ -160,6 +160,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
160
160
  month: {
161
161
  currentText: 'Aktueller Monat'
162
162
  },
163
+ time: {
164
+ currentText: 'Jetzt'
165
+ },
163
166
  date: {
164
167
  close: 'schließen',
165
168
  clear: 'Löschen',
@@ -197,6 +200,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
197
200
  month: {
198
201
  currentText: 'This month'
199
202
  },
203
+ time: {
204
+ "currentText": "Now"
205
+ },
200
206
  date: {
201
207
  "closeText": "Done",
202
208
  clear: 'Clear',
@@ -259,6 +265,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
259
265
  if(!langCfg['datetime-localSigns']){
260
266
  langCfg['datetime-localSigns'] = langCfg.dateSigns+langCfg.timeSigns;
261
267
  }
268
+ if(!langCfg['datetime-local']){
269
+ langCfg['datetime-local'] = {};
270
+ }
271
+ if(!langCfg['datetime-local'].currentText && langCfg.time.currentText){
272
+ langCfg['datetime-local'].currentText = langCfg.time.currentText;
273
+ }
262
274
  };
263
275
  var triggerLocaleChange = function(){
264
276
  processLangCFG(curCfg);
@@ -326,6 +338,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
326
338
  } else {
327
339
  fVal = 0;
328
340
  }
341
+ if(val[0] === '00'){
342
+ val[0] = '12';
343
+ }
329
344
  val = $.trim(val.join(':')) + ' '+ curCfg.meridian[fVal];
330
345
  }
331
346
  return val;
@@ -410,6 +425,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
410
425
  time: function(val){
411
426
  var fVal;
412
427
  if(val && curCfg.meridian){
428
+ if(val.substr(0,2) === "12"){
429
+ val = "00" + val.substr(2);
430
+ }
413
431
  if(val.indexOf(curCfg.meridian[1]) != -1){
414
432
  val = val.split(':');
415
433
  fVal = (val[0] * 1);
@@ -495,7 +513,10 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
495
513
  if(hintValue.length == 2){
496
514
  hintValue = opts.splitInput ?
497
515
  hintValue :
498
- curCfg.patterns.d.replace('yy', hintValue[0]).replace('mm', hintValue[1]);
516
+ curCfg.date.showMonthAfterYear ?
517
+ hintValue[0] +' '+hintValue[1] :
518
+
519
+ hintValue[1] +' '+ hintValue[0];
499
520
  } else {
500
521
  hintValue = opts.splitInput ?
501
522
  [val, val] :
@@ -870,10 +891,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
870
891
  }
871
892
  try {
872
893
  that.elemHelper[name](factor);
894
+
873
895
  ret = that.elemHelper.prop('value');
896
+
897
+ } catch (er) {
898
+ if(!o.value && that.maxAsNumber >= that.minAsNumber){
899
+ ret = o.defValue;
900
+ }
901
+ }
902
+ if(ret !== false && o.value != ret){
874
903
  that.value(ret);
875
904
  eventTimer.call('input', ret);
876
- } catch (er) {}
905
+ }
877
906
  return ret;
878
907
  }
879
908
  };
@@ -939,15 +968,6 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
939
968
 
940
969
  initChangeEvents();
941
970
  },
942
- value: function(val, force){
943
- if(!this._init || force || val !== this.options.value){
944
- this.element.val(this.formatValue(val));
945
- this.options.value = val;
946
- this._propertyChange('value');
947
- this.mirrorValidity();
948
- }
949
-
950
- },
951
971
  required: function(val, boolVal){
952
972
  this.inputElements.attr({'aria-required': ''+boolVal});
953
973
  this.mirrorValidity();
@@ -964,7 +984,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
964
984
  formatValue: function(val, noSplit){
965
985
  return formatVal[this.type](val, noSplit === false ? false : this.options);
966
986
  },
967
- createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
987
+ createOpts: ['readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
968
988
  placeholder: function(val){
969
989
  var options = this.options;
970
990
  options.placeholder = val;
@@ -1034,6 +1054,16 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1034
1054
  }
1035
1055
  };
1036
1056
 
1057
+ ['defaultValue', 'value'].forEach(function(name){
1058
+ wsWidgetProto[name] = function(val, force){
1059
+ if(!this._init || force || val !== this.options[name]){
1060
+ this.element.prop(name, this.formatValue(val));
1061
+ this.options[name] = val;
1062
+ this._propertyChange(name);
1063
+ this.mirrorValidity();
1064
+ }
1065
+ };
1066
+ });
1037
1067
 
1038
1068
  ['readonly', 'disabled'].forEach(function(name){
1039
1069
  var isDisabled = name == 'disabled';
@@ -1087,7 +1117,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1087
1117
  }
1088
1118
  this._init = true;
1089
1119
  },
1090
- createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'value', 'required'],
1120
+ createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
1091
1121
  _addSplitInputs: function(){
1092
1122
  if(!this.inputElements){
1093
1123
  var create = splitInputs[this.type]._create(this.options);
@@ -1157,9 +1187,47 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1157
1187
  this.options.step = val;
1158
1188
  this.elemHelper.prop('step', retDefault(val, defStep.step));
1159
1189
  this.mirrorValidity();
1190
+ },
1191
+ _beforeValue: function(val){
1192
+ this.valueAsNumber = this.asNumber(val);
1193
+ this.options.value = val;
1194
+
1195
+ if(isNaN(this.valueAsNumber) || (!isNaN(this.minAsNumber) && this.valueAsNumber < this.minAsNumber) || (!isNaN(this.maxAsNumber) && this.valueAsNumber > this.maxAsNumber)){
1196
+ this._setStartInRange();
1197
+ } else {
1198
+ this.elemHelper.prop('value', val);
1199
+ this.options.defValue = "";
1200
+ }
1160
1201
  }
1161
1202
  });
1162
1203
 
1204
+ ['defaultValue', 'value'].forEach(function(name){
1205
+ var isValue = name == 'value';
1206
+ spinBtnProto[name] = function(val, force){
1207
+ if(!this._init || force || this.options[name] !== val){
1208
+ if(isValue){
1209
+ this._beforeValue(val);
1210
+ }
1211
+
1212
+ val = formatVal[this.type](val, this.options);
1213
+ if(this.options.splitInput){
1214
+ $.each(this.splits, function(i, elem){
1215
+ var setOption;
1216
+ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
1217
+ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
1218
+ } else {
1219
+ $.prop(elem, name, val[i]);
1220
+ }
1221
+ });
1222
+ } else {
1223
+ this.element.prop(name, val);
1224
+ }
1225
+ this._propertyChange(name);
1226
+ this.mirrorValidity();
1227
+ }
1228
+ };
1229
+ });
1230
+
1163
1231
  $.each({min: 1, max: -1}, function(name, factor){
1164
1232
  var numName = name +'AsNumber';
1165
1233
  spinBtnProto[name] = function(val){
@@ -1563,10 +1631,12 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1563
1631
  var inputTypes = {
1564
1632
 
1565
1633
  };
1634
+ var boolAttrs = {disabled: 1, required: 1, readonly: 1};
1566
1635
  var copyProps = [
1567
1636
  'disabled',
1568
1637
  'readonly',
1569
1638
  'value',
1639
+ 'defaultValue',
1570
1640
  'min',
1571
1641
  'max',
1572
1642
  'step',
@@ -1584,14 +1654,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1584
1654
  if(!stopCircular){
1585
1655
  var shadowData = webshims.data(this, 'shadowData');
1586
1656
  if(shadowData && shadowData.data && shadowData.nativeElement === this && shadowData.data[fnName]){
1587
- shadowData.data[fnName](val, boolVal);
1657
+ if(boolAttrs[fnName]){
1658
+ shadowData.data[fnName](val, boolVal);
1659
+ } else {
1660
+ shadowData.data[fnName](val);
1661
+ }
1588
1662
  }
1589
1663
  }
1590
1664
  });
1591
1665
  });
1592
1666
 
1593
1667
  if(options.replaceUI && 'valueAsNumber' in document.createElement('input')){
1594
- var reflectFn = function(val){
1668
+ var reflectFn = function(){
1595
1669
  if(webshims.data(this, 'hasShadow')){
1596
1670
  $.prop(this, 'value', $.prop(this, 'value'));
1597
1671
  }
@@ -1599,6 +1673,20 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1599
1673
 
1600
1674
  webshims.onNodeNamesPropertyModify('input', 'valueAsNumber', reflectFn);
1601
1675
  webshims.onNodeNamesPropertyModify('input', 'valueAsDate', reflectFn);
1676
+ $.each({stepUp: 1, stepDown: -1}, function(name, stepFactor){
1677
+ var stepDescriptor = webshims.defineNodeNameProperty('input', name, {
1678
+ prop: {
1679
+ value: function(){
1680
+ var ret;
1681
+ if(stepDescriptor.prop && stepDescriptor.prop._supvalue){
1682
+ ret = stepDescriptor.prop._supvalue.apply(this, arguments);
1683
+ reflectFn.apply(this, arguments);
1684
+ }
1685
+ return ret;
1686
+ }
1687
+ }
1688
+ });
1689
+ });
1602
1690
  }
1603
1691
 
1604
1692
  var extendType = (function(){
@@ -1618,7 +1706,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1618
1706
  $(data.orig).removeClass('ws-important-hide');
1619
1707
  $.style( data.orig, 'display', '' );
1620
1708
  var hasButtons, marginR, marginL;
1621
- var correctWidth = 0.6;
1709
+ var correctWidth = 0.8;
1622
1710
  if(!init || data.orig.offsetWidth){
1623
1711
  hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
1624
1712
  marginR = $.css( data.orig, 'marginRight');
@@ -1642,7 +1730,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1642
1730
  ;
1643
1731
  } else {
1644
1732
  data.buttonWrapper.css('marginRight', marginR);
1645
- correctWidth = data.buttonWrapper.outerWidth(true) + 0.6;
1733
+ correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
1646
1734
  }
1647
1735
  }
1648
1736
 
@@ -1800,7 +1888,29 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1800
1888
  });
1801
1889
  }
1802
1890
 
1803
- if(!modernizrInputTypes.range || options.replaceUI){
1891
+ var replace = {};
1892
+
1893
+
1894
+ if(options.replaceUI){
1895
+ if( $.isPlainObject(options.replaceUI) ){
1896
+ $.extend(replace, options.replaceUI);
1897
+ } else {
1898
+ $.extend(replace, {
1899
+ 'range': 1,
1900
+ 'number': 1,
1901
+ 'time': 1,
1902
+ 'month': 1,
1903
+ 'date': 1,
1904
+ 'color': 1,
1905
+ 'datetime-local': 1
1906
+ });
1907
+ }
1908
+ }
1909
+ if(modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
1910
+ replace.number = 1;
1911
+ }
1912
+
1913
+ if(!modernizrInputTypes.range || replace.range){
1804
1914
  extendType('range', {
1805
1915
  _create: function(opts, set){
1806
1916
  var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@@ -1809,9 +1919,9 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
1809
1919
  });
1810
1920
  }
1811
1921
 
1812
- var isStupid = modernizrInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)));
1922
+
1813
1923
  ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
1814
- if(!modernizrInputTypes[name] || options.replaceUI || (name == 'number' && isStupid)){
1924
+ if(!modernizrInputTypes[name] || replace[name]){
1815
1925
  extendType(name, {
1816
1926
  _create: function(opts, set){
1817
1927
  if(opts.monthSelect){