webshims-rails 1.12.0 → 1.12.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/extras/modernizr-custom.js +440 -440
  4. data/vendor/assets/javascripts/webshims/polyfiller.js +132 -91
  5. data/vendor/assets/javascripts/webshims/shims/combos/10.js +248 -91
  6. data/vendor/assets/javascripts/webshims/shims/combos/11.js +237 -84
  7. data/vendor/assets/javascripts/webshims/shims/combos/15.js +21 -8
  8. data/vendor/assets/javascripts/webshims/shims/combos/16.js +21 -8
  9. data/vendor/assets/javascripts/webshims/shims/combos/17.js +237 -84
  10. data/vendor/assets/javascripts/webshims/shims/combos/18.js +237 -84
  11. data/vendor/assets/javascripts/webshims/shims/combos/19.js +11 -7
  12. data/vendor/assets/javascripts/webshims/shims/combos/2.js +18 -8
  13. data/vendor/assets/javascripts/webshims/shims/combos/20.js +11 -7
  14. data/vendor/assets/javascripts/webshims/shims/combos/21.js +1 -1
  15. data/vendor/assets/javascripts/webshims/shims/combos/22.js +1 -1
  16. data/vendor/assets/javascripts/webshims/shims/combos/24.js +9 -6
  17. data/vendor/assets/javascripts/webshims/shims/combos/25.js +11 -7
  18. data/vendor/assets/javascripts/webshims/shims/combos/26.js +11 -7
  19. data/vendor/assets/javascripts/webshims/shims/combos/28.js +10 -1
  20. data/vendor/assets/javascripts/webshims/shims/combos/3.js +11 -7
  21. data/vendor/assets/javascripts/webshims/shims/combos/30.js +18 -8
  22. data/vendor/assets/javascripts/webshims/shims/combos/31.js +18 -8
  23. data/vendor/assets/javascripts/webshims/shims/combos/32.js +7 -1
  24. data/vendor/assets/javascripts/webshims/shims/combos/33.js +7 -1
  25. data/vendor/assets/javascripts/webshims/shims/combos/4.js +11 -7
  26. data/vendor/assets/javascripts/webshims/shims/combos/5.js +237 -84
  27. data/vendor/assets/javascripts/webshims/shims/combos/6.js +244 -85
  28. data/vendor/assets/javascripts/webshims/shims/combos/7.js +18 -8
  29. data/vendor/assets/javascripts/webshims/shims/combos/8.js +11 -7
  30. data/vendor/assets/javascripts/webshims/shims/combos/9.js +255 -92
  31. data/vendor/assets/javascripts/webshims/shims/details.js +1 -1
  32. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +10 -7
  33. data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +53 -56
  34. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +7 -1
  35. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +175 -60
  36. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +3 -0
  37. data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +6 -6
  38. data/vendor/assets/javascripts/webshims/shims/form-validation.js +77 -28
  39. data/vendor/assets/javascripts/webshims/shims/form-validators.js +24 -16
  40. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +40 -68
  41. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +4 -4
  42. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +13 -6
  43. data/vendor/assets/javascripts/webshims/shims/range-ui.js +61 -24
  44. data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +278 -95
  45. data/vendor/assets/javascripts/webshims/shims/styles/progress.gif +0 -0
  46. data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-forms-ext.scss +203 -0
  47. data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-shim.scss +115 -0
  48. data/vendor/assets/javascripts/webshims/shims/styles/scss/_extends.scss +18 -2
  49. data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +227 -113
  50. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +168 -159
  51. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +106 -69
  52. metadata +4 -7
  53. data/vendor/assets/javascripts/webshims/shims/styles/details-arrows.png +0 -0
  54. data/vendor/assets/javascripts/webshims/shims/styles/polyfill-loader.gif +0 -0
  55. data/vendor/assets/javascripts/webshims/shims/styles/range-track.png +0 -0
  56. data/vendor/assets/javascripts/webshims/shims/styles/vertical-range.png +0 -0
  57. data/vendor/assets/javascripts/webshims/shims/swf/localStorage.swf +0 -0
@@ -1,34 +1,29 @@
1
1
  (function (factory) {
2
- var timer;
2
+ if (typeof WSDEBUG === 'undefined') {
3
+ window.WSDEBUG = true;
4
+ }
3
5
  var addAsync = function(){
4
6
  if(!window.asyncWebshims){
5
- if(!window.asyncWebshims){
6
- window.asyncWebshims = {
7
- cfg: [],
8
- ready: []
9
- };
10
- }
7
+ window.asyncWebshims = {
8
+ cfg: [],
9
+ ready: []
10
+ };
11
11
  }
12
12
  };
13
13
  var start = function(){
14
14
  if(window.jQuery){
15
15
  factory(jQuery);
16
- factory = jQuery.noop;
17
- clearInterval(timer);
18
- }
19
- if (typeof define === 'function' && define.amd && define.amd.jQuery) {
20
- define('polyfiller', ['jquery'], factory);
21
- clearInterval(timer);
16
+ factory = function(){return window.webshims;};
22
17
  }
23
-
24
18
  };
25
- var timer = setInterval(start, 1);
19
+
26
20
 
27
21
  window.webshims = {
28
22
  setOptions: function(){
29
23
  addAsync();
30
24
  window.asyncWebshims.cfg.push(arguments);
31
25
  },
26
+
32
27
  ready: function(){
33
28
  addAsync();
34
29
  window.asyncWebshims.ready.push(arguments);
@@ -40,18 +35,62 @@
40
35
  polyfill: function(features){
41
36
  addAsync();
42
37
  window.asyncWebshims.polyfill = features;
43
- }
38
+ },
39
+ _curScript: (function(){
40
+ var scripts, i, scriptUrl;
41
+ //modern browsers: Chrome 29+, Firefox 4+
42
+ var currentScript = document.currentScript;
43
+
44
+ //in debug mode remove result to fully test fallback in all browsers
45
+ if(WSDEBUG){
46
+ currentScript = false;
47
+ }
48
+ if (!currentScript) {
49
+ //error trick: works in Safari, Chrome, Firefox, IE 10+
50
+ //idea found here: https://github.com/samyk/jiagra/
51
+ try {
52
+ throw(new Error(''));
53
+ } catch (e) {
54
+ //Safari has sourceURL
55
+ scriptUrl = (e.sourceURL || e.stack || '').split('\n');
56
+ //extract scriptUrl from stack: this is dangerous! All browsers have different string patterns (pattern can even vary between different browser versions). Help to make it bulletproof!!!
57
+ scriptUrl = ((scriptUrl[scriptUrl.length - 1] || scriptUrl[scriptUrl.length - 2] || '').match(/(?:fil|htt|wid|abo|app|res)(.)+/i) || [''])[0].replace(/[\:\s\(]+[\d\:\)\(\s]+$/, '');
58
+ }
59
+
60
+ scripts = document.scripts || document.getElementsByTagName('script');
61
+
62
+ //get script by URL or by readyState == 'interactive' (readySate is supported in IE10-)
63
+ //if this fails the last found script is set to the currentScript
64
+ for (i = 0; i < scripts.length; i++) {
65
+ if(scripts[i].getAttribute('src')){
66
+ currentScript = scripts[i];
67
+ if (scripts[i].readyState == 'interactive' || scriptUrl == scripts[i].src) {
68
+ if(WSDEBUG){
69
+ currentScript.wsFoundCurrent = true;
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ return currentScript;
78
+ })()
44
79
  };
45
80
  window.webshim = window.webshims;
46
-
81
+
82
+
83
+ window.webshims.timer = setInterval(start, 0);
47
84
  start();
85
+
86
+ if (typeof define === 'function' && define.amd && define.amd.jQuery) {
87
+ define('polyfiller', ['jquery'], factory);
88
+ }
48
89
  }(function($){
49
90
  "use strict";
50
- if (typeof WSDEBUG === 'undefined') {
51
- window.WSDEBUG = true;
52
- }
91
+ var firstRun, path;
92
+ var webshims = window.webshims;
53
93
  var DOMSUPPORT = 'dom-support';
54
- var jScripts = $(document.scripts || 'script');
55
94
  var special = $.event.special;
56
95
  var emptyJ = $([]);
57
96
  var Modernizr = window.Modernizr;
@@ -59,8 +98,6 @@
59
98
  var addTest = Modernizr.addTest;
60
99
  var Object = window.Object;
61
100
  var html5 = window.html5 || {};
62
- var firstRun;
63
- var webshims = window.webshims;
64
101
  var addSource = function(text){
65
102
  return text +"\n//# sourceURL="+this.url;
66
103
  };
@@ -70,9 +107,13 @@
70
107
  Modernizr.ES5 = false;
71
108
  }
72
109
 
73
-
110
+ clearInterval(webshims.timer);
111
+
112
+ path = ($.support.hrefNormalized === false) ? webshims._curScript.getAttribute("src", 4) : webshims._curScript.src;
113
+ path = path.split('?')[0].slice(0, path.lastIndexOf("/") + 1) + 'shims/';
114
+
74
115
  $.extend(webshims, {
75
- version: '1.12.0',
116
+ version: '1.12.2',
76
117
  cfg: {
77
118
 
78
119
  //addCacheBuster: false,
@@ -80,23 +121,14 @@
80
121
  // extendNative: false,
81
122
  loadStyles: true,
82
123
  disableShivMethods: true,
124
+ wsdoc: document,
83
125
  wspopover: {appendTo: 'auto', hideOnBlur: true},
84
126
  ajax: {},
85
127
  loadScript: function(src, success, fail){
86
128
  $.ajax($.extend({}, webCFG.ajax, {url: src, success: success, dataType: 'script', cache: true, global: false, dataFilter: addSource}));
87
129
  },
88
130
 
89
- basePath: (function(){
90
- var script = jScripts.filter('[src*="polyfiller.js"]');
91
- var path;
92
- script = script[0] || script.end()[script.end().length - 1];
93
- if(WSDEBUG && document.currentScript && script != document.currentScript && document.currentScript.src){
94
- webshims.warn("It seems you need to set webshims.setOptions('basePath', 'pathTo/shims/'); manually.");
95
- }
96
- path = ( ( !('hrefNormalized' in $.support) || $.support.hrefNormalized ) ? script.src : script.getAttribute("src", 4) ).split('?')[0];
97
- path = path.slice(0, path.lastIndexOf("/") + 1) + 'shims/';
98
- return path;
99
- })()
131
+ basePath: path
100
132
  },
101
133
  bugs: {},
102
134
  /*
@@ -106,7 +138,7 @@
106
138
  features: {},
107
139
  featureList: [],
108
140
  setOptions: function(name, opts){
109
- if (typeof name == 'string' && opts !== undefined) {
141
+ if (typeof name == 'string' && arguments.length > 1) {
110
142
  webCFG[name] = (!$.isPlainObject(opts)) ? opts : $.extend(true, webCFG[name] || {}, opts);
111
143
  } else if (typeof name == 'object') {
112
144
  $.extend(true, webCFG, name);
@@ -499,9 +531,10 @@
499
531
  loadScript: (function(){
500
532
  var loadedSrcs = {};
501
533
  var scriptLoader;
502
- return function(src, callback, name){
503
-
504
- src = loader.makePath(src);
534
+ return function(src, callback, name, noShimPath){
535
+ if(!noShimPath){
536
+ src = loader.makePath(src);
537
+ }
505
538
  if (loadedSrcs[src]) {return;}
506
539
  var complete = function(){
507
540
 
@@ -554,10 +587,6 @@
554
587
  error: 1
555
588
  };
556
589
 
557
- if(webCFG.debug || (!('crossDomain' in webCFG.ajax) && location.protocol.indexOf('http'))){
558
- webCFG.ajax.crossDomain = true;
559
- }
560
-
561
590
  webshims.addMethodName = function(name){
562
591
  name = name.split(':');
563
592
  var prop = name[1];
@@ -595,10 +624,9 @@
595
624
 
596
625
 
597
626
  webshims.activeLang = (function(){
598
- var curLang = navigator.browserLanguage || navigator.language || '';
627
+ var curLang = $('html').attr('lang') || navigator.browserLanguage || navigator.language || '';
599
628
  onReady('webshimLocalization', function(){
600
629
  webshims.activeLang(curLang);
601
-
602
630
  });
603
631
  return function(lang){
604
632
  if(lang){
@@ -627,6 +655,12 @@
627
655
  }
628
656
  };
629
657
  });
658
+
659
+ if(WSDEBUG){
660
+ if(!webshims._curScript.wsFoundCurrent){
661
+ webshims.error('Could not detect currentScript! Use basePath to set script path.');
662
+ }
663
+ }
630
664
 
631
665
  /*
632
666
  * jQuery-plugins for triggering dom updates can be also very usefull in conjunction with non-HTML5 DOM-Changes (AJAX)
@@ -643,10 +677,10 @@
643
677
  */
644
678
 
645
679
  (function(){
646
-
647
680
  //Overwrite DOM-Ready and implement a new ready-method
648
681
  $.isDOMReady = $.isReady;
649
- var onReady = function(){
682
+ var onReady = function(e){
683
+
650
684
  $.isDOMReady = true;
651
685
  isReady('DOM', true);
652
686
  setTimeout(function(){
@@ -656,6 +690,11 @@
656
690
 
657
691
  firstRun = function(){
658
692
  if(!firstRun.run){
693
+
694
+ if(webCFG.debug || (!('crossDomain' in webCFG.ajax) && location.protocol.indexOf('http'))){
695
+ webCFG.ajax.crossDomain = true;
696
+ }
697
+
659
698
  if($.mobile && ($.mobile.textinput || $.mobile.rangeslider || $.mobile.button)){
660
699
  if(WSDEBUG){
661
700
  webshims.warn('jQM textinput/rangeslider/button detected waitReady was set to false. Use webshims.ready("featurename") to script against polyfilled methods/properties');
@@ -689,10 +728,7 @@
689
728
  }
690
729
  firstRun.run = true;
691
730
  };
692
-
693
- setTimeout(function(){
694
- $(onReady);
695
- }, 4);
731
+
696
732
  $(window).on('load', function(){
697
733
  onReady();
698
734
  setTimeout(function(){
@@ -712,7 +748,10 @@
712
748
  webshims.ready('DOM', function(){fn(context, elem);});
713
749
  };
714
750
  readyFns.push(readyFn);
715
- readyFn(document, emptyJ);
751
+
752
+ if(webCFG.wsdoc){
753
+ readyFn(webCFG.wsdoc, emptyJ);
754
+ }
716
755
  },
717
756
  triggerDomUpdate: function(context){
718
757
  if(!context || !context.nodeType){
@@ -1100,9 +1139,6 @@
1100
1139
  test: function(){
1101
1140
  var o = this.options;
1102
1141
  initialFormTest();
1103
- if(o.replaceUI){
1104
- $('html').addClass('ws-replaceui');
1105
- }
1106
1142
  //input widgets on old androids can't be trusted
1107
1143
  if(bustedWidgetUi && !o.replaceUI && (/Android/i).test(navigator.userAgent)){
1108
1144
  o.replaceUI = true;
@@ -1232,43 +1268,48 @@
1232
1268
  webshims.$ = $;
1233
1269
  webshims.M = Modernizr;
1234
1270
  window.webshims = webshims;
1235
-
1236
- jScripts
1237
- .filter('[data-polyfill-cfg]')
1238
- .each(function(){
1239
- try {
1240
- webshims.setOptions( $(this).data('polyfillCfg') );
1241
- } catch(e){
1242
- webshims.warn('error parsing polyfill cfg: '+e);
1271
+
1272
+ webshims.callAsync = function(){
1273
+ webshims.callAsync = $.noop;
1274
+ $(document.scripts || 'script')
1275
+ .filter('[data-polyfill-cfg]')
1276
+ .each(function(){
1277
+ try {
1278
+ webshims.setOptions( $(this).data('polyfillCfg') );
1279
+ } catch(e){
1280
+ webshims.warn('error parsing polyfill cfg: '+e);
1281
+ }
1282
+ })
1283
+ .end()
1284
+ .filter('[data-polyfill]')
1285
+ .each(function(){
1286
+ webshims.polyfill( $.trim( $(this).data('polyfill') || '' ) );
1287
+ })
1288
+ ;
1289
+ if(asyncWebshims){
1290
+ if(asyncWebshims.cfg){
1291
+ if(!asyncWebshims.cfg.length){
1292
+ asyncWebshims.cfg = [[asyncWebshims.cfg]];
1293
+ }
1294
+ $.each(asyncWebshims.cfg, function(i, cfg){
1295
+ webshims.setOptions.apply(webshims, cfg);
1296
+ });
1243
1297
  }
1244
- })
1245
- .end()
1246
- .filter('[data-polyfill]')
1247
- .each(function(){
1248
- webshims.polyfill( $.trim( $(this).data('polyfill') || '' ) );
1249
- })
1250
- ;
1251
- if(asyncWebshims){
1252
- if(asyncWebshims.cfg){
1253
- if(!asyncWebshims.cfg.length){
1254
- asyncWebshims.cfg = [asyncWebshims.cfg];
1298
+ if(asyncWebshims.ready){
1299
+ $.each(asyncWebshims.ready, function(i, ready){
1300
+ webshims.ready.apply(webshims, ready);
1301
+ });
1302
+ }
1303
+ if(asyncWebshims.lang){
1304
+ webshims.activeLang(asyncWebshims.lang);
1305
+ }
1306
+ if('polyfill' in asyncWebshims){
1307
+ webshims.polyfill(asyncWebshims.polyfill);
1255
1308
  }
1256
- $.each(asyncWebshims.cfg, function(i, cfg){
1257
- webshims.setOptions.call(webshims, cfg);
1258
- });
1259
- }
1260
- if(asyncWebshims.ready){
1261
- $.each(asyncWebshims.ready, function(i, ready){
1262
- webshims.ready.apply(webshims, ready);
1263
- });
1264
- }
1265
- if(asyncWebshims.lang){
1266
- webshims.activeLang(asyncWebshims.lang);
1267
- }
1268
- if('polyfill' in asyncWebshims){
1269
- webshims.polyfill(asyncWebshims.polyfill);
1270
1309
  }
1271
- }
1272
- webshims.isReady('jquery', true);
1310
+ webshims.isReady('jquery', true);
1311
+ };
1312
+
1313
+ webshims.callAsync();
1273
1314
  return webshims;
1274
1315
  }));
@@ -609,7 +609,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
609
609
  setTimeout(trigger, 0);
610
610
  }
611
611
 
612
- }, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 0);
612
+ }, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9);
613
613
  };
614
614
  })(),
615
615
  _create: function(){
@@ -634,7 +634,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
634
634
  setInterval(this.test, 600);
635
635
  $(this.test);
636
636
  webshims.ready('WINDOWLOAD', this.test);
637
- $(document).on('updatelayout pageinit collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler);
637
+ $(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler);
638
638
  $(window).on('resize', this.handler);
639
639
  (function(){
640
640
  var oldAnimate = $.fn.animate;
@@ -1081,10 +1081,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1081
1081
  });
1082
1082
 
1083
1083
  webshims.isReady('webshimLocalization', true);
1084
- });
1085
- //html5a11y
1086
- (function($, document){
1087
- if(!$.webshims.assumeARIA || ('content' in document.createElement('template'))){return;}
1084
+
1085
+ //html5a11y + hidden attribute
1086
+ (function(){
1087
+ if(('content' in document.createElement('template'))){return;}
1088
1088
 
1089
1089
  $(function(){
1090
1090
  var main = $('main').attr({role: 'main'});
@@ -1099,6 +1099,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1099
1099
  return;
1100
1100
  }
1101
1101
 
1102
+ webshims.defineNodeNamesBooleanProperty(['*'], 'hidden');
1103
+
1102
1104
  var elemMappings = {
1103
1105
  article: "article",
1104
1106
  aside: "complementary",
@@ -1139,7 +1141,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1139
1141
  }
1140
1142
  });
1141
1143
 
1142
- })(webshims.$, document);;(function($){
1144
+ })();
1145
+ });
1146
+ ;(function($){
1143
1147
 
1144
1148
  var id = 0;
1145
1149
  var isNumber = function(string){
@@ -1156,8 +1160,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1156
1160
  _create: function(){
1157
1161
  var i;
1158
1162
 
1159
-
1160
- 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>');
1163
+ 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 data-value="" data-valuetext="" /></span></span>');
1161
1164
  this.trail = $('.ws-range-track', this.element);
1162
1165
  this.range = $('.ws-range-progress', this.element);
1163
1166
  this.thumb = $('.ws-range-thumb', this.trail);
@@ -1179,7 +1182,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1179
1182
  },
1180
1183
  value: $.noop,
1181
1184
  _value: function(val, _noNormalize, animate){
1182
- var left, posDif, textValue;
1185
+ var left, posDif;
1183
1186
  var o = this.options;
1184
1187
  var oVal = val;
1185
1188
  var thumbStyle = {};
@@ -1195,7 +1198,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1195
1198
  left = 100 * ((val - o.min) / (o.max - o.min));
1196
1199
 
1197
1200
  if(this._init && val == o.value && oVal == val){return;}
1198
- this.options.value = val;
1201
+ o.value = val;
1199
1202
 
1200
1203
  if($.fn.stop){
1201
1204
  this.thumb.stop();
@@ -1203,6 +1206,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1203
1206
  }
1204
1207
 
1205
1208
  rangeStyle[this.dirs.width] = left+'%';
1209
+
1206
1210
  if(this.vertical){
1207
1211
  left = Math.abs(left - 100);
1208
1212
  }
@@ -1229,15 +1233,26 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1229
1233
  this.options._change(val);
1230
1234
  }
1231
1235
 
1232
- textValue = this.options.textValue ? this.options.textValue(this.options.value) : this.options.options[this.options.value] || this.options.value;
1236
+ this._setValueMarkup();
1237
+ },
1238
+ _setValueMarkup: function(){
1239
+ var o = this.options;
1240
+ var textValue = o.textValue ? o.textValue(this.options.value) : o.options[o.value] || o.value;
1233
1241
  this.element.attr({
1234
1242
  'aria-valuenow': this.options.value,
1235
1243
  'aria-valuetext': textValue
1236
1244
  });
1237
- this.thumb.attr({
1245
+ $('span', this.thumb).attr({
1238
1246
  'data-value': this.options.value,
1239
1247
  'data-valuetext': textValue
1240
1248
  });
1249
+ if(o.selectedOption){
1250
+ $(o.selectedOption).removeClass('ws-selected-option');
1251
+ o.selectedOption = null;
1252
+ }
1253
+ if(o.value in o.options){
1254
+ o.selectedOption = $('[data-value="'+o.value+'"].ws-range-ticks').addClass('ws-selected-option');
1255
+ }
1241
1256
  },
1242
1257
  initDataList: function(){
1243
1258
  if(this.orig){
@@ -1280,9 +1295,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1280
1295
  $.each(o.options, function(val, label){
1281
1296
  if(!isNumber(val) || val < min || val > max){return;}
1282
1297
  var left = 100 * ((val - min) / (max - min));
1283
- var attr = '';
1298
+ var attr = 'data-value="'+val+'"';
1284
1299
  if(label){
1285
- attr += 'data-label="'+label+'"';
1300
+ attr += ' data-label="'+label+'"';
1286
1301
  if(o.showLabels){
1287
1302
  attr += ' title="'+label+'"';
1288
1303
  }
@@ -1295,6 +1310,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1295
1310
  $('<span class="ws-range-ticks"'+ attr +' style="'+(that.dirs.left)+': '+left+'%;" />').appendTo(trail)
1296
1311
  );
1297
1312
  });
1313
+ if(o.value in o.options){
1314
+ this._setValueMarkup();
1315
+ }
1298
1316
  },
1299
1317
  readonly: function(val){
1300
1318
  val = !!val;
@@ -1338,12 +1356,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1338
1356
  var step = val == 'any' ? 'any' : retDefault(val, 1);
1339
1357
 
1340
1358
  if(o.stepping){
1341
- if(step != 'any' && o.stepping % step){
1342
- webshims.error('wrong stepping value for type range:'+ (o.stepping % step));
1343
- } else {
1344
- step = o.stepping;
1345
- }
1359
+ webshims.error('stepping was removed. Use stepfactor instead.');
1360
+ }
1361
+
1362
+ if(o.stepfactor && step != 'any'){
1363
+ step *= o.stepfactor;
1346
1364
  }
1365
+
1347
1366
  o.step = step;
1348
1367
  this.value(this.options.value);
1349
1368
  },
@@ -1381,11 +1400,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1381
1400
  var val, valModStep, alignValue, step;
1382
1401
 
1383
1402
  if(pos <= 0){
1384
- val = this.options[this.dirs.min];
1403
+ val = this.options[this.dirs[this.isRtl ? 'max' : 'min']];
1385
1404
  } else if(pos > 100) {
1386
- val = this.options[this.dirs.max];
1405
+ val = this.options[this.dirs[this.isRtl ? 'min' : 'max']];
1387
1406
  } else {
1388
- if(this.vertical){
1407
+ if(this.vertical || this.isRtl){
1389
1408
  pos = Math.abs(pos - 100);
1390
1409
  }
1391
1410
  val = ((this.options.max - this.options.min) * (pos / 100)) + this.options.min;
@@ -1470,17 +1489,20 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1470
1489
  return e;
1471
1490
  };
1472
1491
  })();
1492
+ var updateValue = function(val, animate){
1493
+ if(val != o.value){
1494
+ that.value(val, false, animate);
1495
+ eventTimer.call('input', val);
1496
+ }
1497
+ };
1473
1498
  var setValueFromPos = function(e, animate){
1474
1499
  if(e.type == 'touchmove'){
1475
1500
  e.preventDefault();
1476
1501
  normalizeTouch(e);
1477
1502
  }
1478
1503
 
1479
- var val = that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits);
1480
- if(val != o.value){
1481
- that.value(val, false, animate);
1482
- eventTimer.call('input', val);
1483
- }
1504
+ updateValue(that.getStepedValueFromPos((e[that.dirs.mouse] - leftOffset) * widgetUnits), animate);
1505
+
1484
1506
  if(e && e.type == 'mousemove'){
1485
1507
  e.preventDefault();
1486
1508
  }
@@ -1518,7 +1540,12 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1518
1540
  outerWidth = that.thumb[that.dirs.outerWidth]();
1519
1541
  leftOffset = leftOffset[that.dirs.pos];
1520
1542
  widgetUnits = 100 / widgetUnits;
1521
- setValueFromPos(e, o.animate);
1543
+
1544
+ if(e.target.className == 'ws-range-ticks'){
1545
+ updateValue(e.target.getAttribute('data-value'), o.animate);
1546
+ } else {
1547
+ setValueFromPos(e, o.animate);
1548
+ }
1522
1549
  isActive = true;
1523
1550
  $(document)
1524
1551
  .on(e.type == 'touchstart' ?
@@ -1564,6 +1591,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1564
1591
  var step = true;
1565
1592
  var code = e.keyCode;
1566
1593
  if(!o.readonly && !o.disabled){
1594
+ if(that.isRtl){
1595
+ if(code == 39){
1596
+ code = 37;
1597
+ } else if(code == 37){
1598
+ code = 39;
1599
+ }
1600
+ }
1567
1601
  if (code == 39 || code == 38) {
1568
1602
  that.doStep(1);
1569
1603
  } else if (code == 37 || code == 40) {
@@ -1663,10 +1697,17 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1663
1697
  {mouse: 'pageY', pos: 'top', min: 'max', max: 'min', left: 'top', right: 'bottom', width: 'height', innerWidth: 'innerHeight', innerHeight: 'innerWidth', outerWidth: 'outerHeight', outerHeight: 'outerWidth', marginTop: 'marginLeft', marginLeft: 'marginTop'} :
1664
1698
  {mouse: 'pageX', pos: 'left', min: 'min', max: 'max', left: 'left', right: 'right', width: 'width', innerWidth: 'innerWidth', innerHeight: 'innerHeight', outerWidth: 'outerWidth', outerHeight: 'outerHeight', marginTop: 'marginTop', marginLeft: 'marginLeft'}
1665
1699
  ;
1700
+ if(!this.vertical && this.element.css('direction') == 'rtl'){
1701
+ this.isRtl = true;
1702
+ this.dirs.left = 'right';
1703
+ this.dirs.right = 'left';
1704
+ this.dirs.marginLeft = 'marginRight';
1705
+ }
1666
1706
  this.element
1667
1707
  [this.vertical ? 'addClass' : 'removeClass']('vertical-range')
1668
- [this.vertical ? 'addClass' : 'removeClass']('horizontal-range')
1708
+ [this.isRtl ? 'addClass' : 'removeClass']('ws-is-rtl')
1669
1709
  ;
1710
+ this.updateMetrics = this.posCenter;
1670
1711
  this.posCenter();
1671
1712
  }
1672
1713
  };
@@ -1703,7 +1744,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1703
1744
  if(window.webshims && webshims.isReady){
1704
1745
  webshims.isReady('range-ui', true);
1705
1746
  }
1706
- })(window.webshims ? webshims.$ : jQuery);;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
1747
+ })(window.webshims ? webshims.$ : jQuery);
1748
+ ;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
1707
1749
  "use strict";
1708
1750
  var curCfg;
1709
1751
  var formcfg = webshims.formcfg;
@@ -1713,9 +1755,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1713
1755
  e.stopImmediatePropagation();
1714
1756
  };
1715
1757
  var getMonthOptions = function(opts){
1716
- var selectName = 'monthSelect'+opts.formatMonthNames;
1758
+ var selectName = 'monthSelect'+opts.monthNames;
1717
1759
  if(!curCfg[selectName]){
1718
- var labels = curCfg.date[opts.formatMonthNames] || monthDigits;
1760
+ var labels = curCfg.date[opts.monthNames] || monthDigits;
1719
1761
  curCfg[selectName] = ('<option value=""></option>')+$.map(monthDigits, function(val, i){
1720
1762
  return '<option value="'+val+'"]>'+labels[i]+'</option>';
1721
1763
  }).join('');
@@ -1740,13 +1782,39 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1740
1782
  curCfg.patterns[name+'Obj'] = obj;
1741
1783
  }
1742
1784
  };
1785
+ var createYearSelect = function(obj, opts){
1786
+ var options, nowY, max, min;
1787
+ if(opts.yearSelect){
1788
+ nowY = parseInt(opts.value.split('-')[0], 10);
1789
+ max = opts.max.split('-');
1790
+ min = opts.min.split('-');
1791
+ options = webshims.picker.createYearSelect(nowY || parseInt(min[0], 10) || parseInt(max[0], 10) || nowYear, max, min);
1792
+ options.unshift('<option />');
1793
+ $(obj.elements)
1794
+ .filter('select.yy')
1795
+ .html(options.join(''))
1796
+ .each(function(){
1797
+ if(!nowY){
1798
+ $('option[selected]', this).removeAttr('selected');
1799
+ $(this).val();
1800
+ }
1801
+ })
1802
+ ;
1803
+ }
1804
+ };
1743
1805
  var splitInputs = {
1744
1806
  date: {
1745
1807
  _create: function(opts){
1746
1808
  var obj = {
1747
- splits: [$('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]]
1809
+ splits: []
1748
1810
  };
1749
1811
 
1812
+ if(opts.yearSelect){
1813
+ obj.splits.push($('<select class="yy"></select>')[0]);
1814
+ } else {
1815
+ obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]);
1816
+ }
1817
+
1750
1818
  if(opts.monthSelect){
1751
1819
  obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
1752
1820
  } else {
@@ -1759,6 +1827,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1759
1827
  }
1760
1828
 
1761
1829
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1], $('<span class="ws-input-seperator" />')[0], obj.splits[2]];
1830
+ createYearSelect(obj, opts);
1762
1831
  return obj;
1763
1832
  },
1764
1833
  sort: function(element){
@@ -1783,8 +1852,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1783
1852
  _create: function(opts){
1784
1853
 
1785
1854
  var obj = {
1786
- splits: [$('<input type="text" class="yy" inputmode="numeric" size="4" />')[0]]
1855
+ splits: []
1787
1856
  };
1857
+
1858
+ if(opts.yearSelect){
1859
+ obj.splits.push($('<select class="yy"></select>')[0]);
1860
+ } else {
1861
+ obj.splits.push($('<input type="text" class="yy" size="4" inputmode="numeric" maxlength="4" />')[0]);
1862
+ }
1863
+
1788
1864
  if(opts.monthSelect){
1789
1865
  obj.splits.push($('<select class="mm">'+getMonthOptions(opts)+'</select>')[0]);
1790
1866
  } else {
@@ -1795,6 +1871,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1795
1871
  }
1796
1872
 
1797
1873
  obj.elements = [obj.splits[0], $('<span class="ws-input-seperator" />')[0], obj.splits[1]];
1874
+ createYearSelect(obj, opts);
1798
1875
  return obj;
1799
1876
  },
1800
1877
  sort: function(element){
@@ -1814,7 +1891,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1814
1891
  };
1815
1892
 
1816
1893
  var nowDate = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60 * 1000 ));
1817
- nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime()
1894
+ var nowYear = nowDate.getFullYear();
1895
+ nowDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), nowDate.getHours()).getTime();
1818
1896
  var steps = {
1819
1897
  number: {
1820
1898
  step: 1
@@ -2024,9 +2102,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2024
2102
  $(document).triggerHandler('wslocalechange');
2025
2103
  };
2026
2104
 
2027
-
2028
-
2029
-
2030
2105
  curCfg = webshims.activeLang(formcfg);
2031
2106
 
2032
2107
  triggerLocaleChange();
@@ -2051,7 +2126,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2051
2126
 
2052
2127
 
2053
2128
  var formatVal = {
2054
- number: function(val){
2129
+ number: function(val, o){
2055
2130
  return (val+'').replace(/\,/g, '').replace(/\./, curCfg.numberFormat['.']);
2056
2131
  },
2057
2132
  time: function(val){
@@ -2088,7 +2163,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2088
2163
  var names;
2089
2164
  var p = val.split('-');
2090
2165
  if(p[0] && p[1]){
2091
- names = curCfg.date[options.formatMonthNames] || curCfg.date[options.monthNames] || curCfg.date.monthNames;
2166
+ names = curCfg.date[options.monthNames] || curCfg.date.monthNames;
2092
2167
  p[1] = names[(p[1] * 1) - 1];
2093
2168
  if(options && options.splitInput){
2094
2169
  val = [p[0] || '', p[1] || ''];
@@ -2409,7 +2484,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2409
2484
  })
2410
2485
  .on({
2411
2486
  'change input focus focusin blur focusout': function(e){
2487
+ var oVal, nVal;
2412
2488
  $(e.target).trigger('ws__'+e.type);
2489
+ if(o.toFixed && o.type == 'number' && e.type == 'change'){
2490
+ oVal = that.element.prop('value');
2491
+ nVal = that.toFixed(oVal, true);
2492
+ if(oVal != nVal){
2493
+ that.element[0].value = nVal;
2494
+ }
2495
+ }
2413
2496
  }
2414
2497
  })
2415
2498
 
@@ -2558,11 +2641,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2558
2641
  this.inputElements.attr('inputmode', 'numeric');
2559
2642
  }
2560
2643
 
2561
-
2562
-
2563
2644
  if((!o.max && typeof o.relMax == 'number') || (!o.min && typeof o.relMin == 'number')){
2564
- webshims.error('relMax/relMin are not supported anymore')
2645
+ webshims.error('relMax/relMin are not supported anymore calculate at set it your own.');
2565
2646
  }
2647
+
2648
+ if(this.options.relDefaultValue){
2649
+ webshims.warn('relDefaultValue was removed use startValue instead!');
2650
+ }
2651
+
2566
2652
  this._init = true;
2567
2653
  },
2568
2654
  createOpts: ['step', 'min', 'max', 'readonly', 'title', 'disabled', 'tabindex', 'placeholder', 'defaultValue', 'value', 'required'],
@@ -2573,17 +2659,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2573
2659
  this.inputElements = $(create.elements).prependTo(this.element).filter('input, select');
2574
2660
  }
2575
2661
  },
2576
-
2577
- getRelNumber: function(rel){
2578
- var start = steps[this.type].start || 0;
2579
- if(rel){
2580
- start += rel;
2581
- }
2582
- return start;
2583
- },
2584
2662
  addZero: addZero,
2585
2663
  _setStartInRange: function(){
2586
- var start = this.getRelNumber(this.options.relDefaultValue);
2664
+ var start = this.options.startValue && this.asNumber( this.options.startValue ) || steps[this.type].start || 0;
2587
2665
  if(!isNaN(this.minAsNumber) && start < this.minAsNumber){
2588
2666
  start = this.minAsNumber;
2589
2667
  } else if(!isNaN(this.maxAsNumber) && start > this.maxAsNumber){
@@ -2595,7 +2673,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2595
2673
  },
2596
2674
  reorderInputs: function(){
2597
2675
  if(splitInputs[this.type]){
2598
- var element = this.element;
2676
+ var element = this.element.attr('dir', curCfg.date.isRTL ? 'rtl' : 'ltr');
2599
2677
  splitInputs[this.type].sort(element, this.options);
2600
2678
  setTimeout(function(){
2601
2679
  var data = webshims.data(element);
@@ -2621,6 +2699,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2621
2699
  this.elemHelper.prop('value', val);
2622
2700
  this.options.defValue = "";
2623
2701
  }
2702
+ },
2703
+ toFixed: function(val, force){
2704
+ var o = this.options;
2705
+ if(o.toFixed && o.type == 'number' && val && this.valueAsNumber && (force || !this.element.is(':focus')) && (!o.fixOnlyFloat || (this.valueAsNumber % 1)) && !$(this.orig).is(':invalid')){
2706
+ val = formatVal[this.type](this.valueAsNumber.toFixed(o.toFixed), this.options);
2707
+ }
2708
+ return val;
2624
2709
  }
2625
2710
  });
2626
2711
 
@@ -2633,7 +2718,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2633
2718
  } else {
2634
2719
  this.elemHelper.prop(name, val);
2635
2720
  }
2636
-
2721
+
2637
2722
  val = formatVal[this.type](val, this.options);
2638
2723
  if(this.options.splitInput){
2639
2724
  $.each(this.splits, function(i, elem){
@@ -2645,7 +2730,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2645
2730
  }
2646
2731
  });
2647
2732
  } else {
2648
- this.element.prop(name, val);
2733
+ this.element.prop(name, this.toFixed(val));
2649
2734
  }
2650
2735
  this._propertyChange(name);
2651
2736
  this.mirrorValidity();
@@ -2662,6 +2747,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2662
2747
  this._setStartInRange();
2663
2748
  }
2664
2749
  this.options[name] = val;
2750
+ if(this._init){
2751
+ createYearSelect({elements: this.inputElements}, this.options);
2752
+ }
2665
2753
  this._propertyChange(name);
2666
2754
  this.mirrorValidity();
2667
2755
  };
@@ -2682,7 +2770,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2682
2770
 
2683
2771
  $.fn.spinbtnUI = function(opts){
2684
2772
  opts = $.extend({
2685
- monthNames: 'monthNames'
2773
+ monthNames: 'monthNamesShort'
2686
2774
  }, opts);
2687
2775
  return this.each(function(){
2688
2776
  $.webshims.objectCreate(spinBtnProto, {
@@ -2712,6 +2800,53 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2712
2800
  isVisible: true
2713
2801
  };
2714
2802
 
2803
+ picker.isInRange = function(value, max, min){
2804
+ return !((min[0] && min[0] > value[0]) || (max[0] && max[0] < value[0]));
2805
+ };
2806
+
2807
+
2808
+ picker.createYearSelect = function(value, max, min, valueAdd, stepper){
2809
+ if(!stepper){
2810
+ stepper = {start: value, step: 1, label: value};
2811
+ }
2812
+ var temp;
2813
+ var goUp = true;
2814
+ var goDown = true;
2815
+ var options = ['<option selected="">'+ stepper.label + '</option>'];
2816
+ var i = 0;
2817
+ var createOption = function(value, add){
2818
+ var value2, label;
2819
+ if(stepper.step > 1){
2820
+ value2 = value + stepper.step - 1;
2821
+ label = value+' – '+value2;
2822
+ } else {
2823
+ label = value;
2824
+ }
2825
+
2826
+ if(picker.isInRange([value], max, min) || (value2 && picker.isInRange([value2], max, min))){
2827
+ options[add]('<option value="'+ (value+valueAdd) +'">'+ label +'</option>');
2828
+ return true;
2829
+ }
2830
+ };
2831
+ if(!valueAdd){
2832
+ valueAdd = '';
2833
+ }
2834
+ while(i < 18 && (goUp || goDown)){
2835
+ i++;
2836
+ if(goUp){
2837
+ temp = stepper.start - (i * stepper.step);
2838
+ goUp = createOption(temp, 'unshift');
2839
+ }
2840
+ if(goDown){
2841
+ temp = stepper.start + (i * stepper.step);
2842
+ goDown = createOption(temp, 'push');
2843
+ }
2844
+
2845
+ }
2846
+
2847
+ return options;
2848
+ };
2849
+
2715
2850
  picker._genericSetFocus = function(element, _noFocus){
2716
2851
  element = $(element || this.activeButton);
2717
2852
 
@@ -2721,12 +2856,12 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2721
2856
  clearTimeout(that.timer);
2722
2857
  that.timer = setTimeout(function(){
2723
2858
  if(element[0]){
2724
- element[0].focus();
2859
+ element.trigger('focus');
2725
2860
  if(noTrigger !== true && !element.is(':focus')){
2726
2861
  setFocus(true);
2727
2862
  }
2728
2863
  }
2729
- }, that.popover.isVisible ? 99 : 360);
2864
+ }, that.popover.isVisible ? 0 : 360);
2730
2865
  };
2731
2866
  this.popover.activateElement(element);
2732
2867
  setFocus();
@@ -2939,7 +3074,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2939
3074
  popover.preventBlur();
2940
3075
  }
2941
3076
  },
2942
- mousedown: function(){
3077
+ mousedown: function(e){
2943
3078
  mouseFocus = true;
2944
3079
  setTimeout(resetMouseFocus, 9);
2945
3080
  if(options.buttonOnly && popover.isVisible && popover.activeElement){
@@ -3097,31 +3232,41 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3097
3232
  var updateStyles = function(){
3098
3233
  $(data.orig).removeClass('ws-important-hide');
3099
3234
  $.style( data.orig, 'display', '' );
3100
- var hasButtons, marginR, marginL;
3235
+ var hasButtons, marginR, marginL, left, right, isRtl;
3101
3236
  var correctWidth = 0.8;
3102
3237
  if(!init || data.orig.offsetWidth){
3103
3238
  hasButtons = data.buttonWrapper && data.buttonWrapper.filter(isVisible).length;
3104
- marginR = $.css( data.orig, 'marginRight');
3105
- data.element.css({
3106
- marginLeft: $.css( data.orig, 'marginLeft'),
3107
- marginRight: hasButtons ? 0 : marginR
3108
- });
3239
+
3240
+ isRtl = hasButtons && data.buttonWrapper.css('direction') == 'rtl';
3241
+ if(isRtl){
3242
+ left = 'Right';
3243
+ right = 'Left';
3244
+ } else {
3245
+ left = 'Left';
3246
+ right = 'Right';
3247
+ }
3248
+
3249
+ marginR = $.css( data.orig, 'margin'+right);
3250
+
3251
+ data.element
3252
+ .css('margin'+left, $.css( data.orig, 'margin'+left))
3253
+ .css('margin'+right, hasButtons ? 0 : marginR)
3254
+ ;
3109
3255
 
3110
3256
  if(hasButtons){
3111
- marginL = (parseInt(data.buttonWrapper.css('marginLeft'), 10) || 0);
3112
- data.element.css({paddingRight: ''});
3257
+ data.buttonWrapper[isRtl ? 'addClass' : 'removeClass']('ws-is-rtl');
3258
+ marginL = (parseInt(data.buttonWrapper.css('margin'+left), 10) || 0);
3259
+ data.element.css('padding'+right, '');
3113
3260
 
3114
3261
  if(marginL < 0){
3115
3262
  marginR = (parseInt(marginR, 10) || 0) + ((data.buttonWrapper.outerWidth() + marginL) * -1);
3116
- data.buttonWrapper.css('marginRight', marginR);
3263
+ data.buttonWrapper.css('margin'+right, marginR);
3117
3264
  data.element
3118
- .css({paddingRight: ''})
3119
- .css({
3120
- paddingRight: (parseInt( data.element.css('paddingRight'), 10) || 0) + data.buttonWrapper.outerWidth()
3121
- })
3265
+ .css('padding'+right, '')
3266
+ .css('padding'+right, (parseInt( data.element.css('padding'+right), 10) || 0) + data.buttonWrapper.outerWidth())
3122
3267
  ;
3123
3268
  } else {
3124
- data.buttonWrapper.css('marginRight', marginR);
3269
+ data.buttonWrapper.css('margin'+right, marginR);
3125
3270
  correctWidth = data.buttonWrapper.outerWidth(true) + correctWidth;
3126
3271
  }
3127
3272
  }
@@ -3139,7 +3284,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3139
3284
 
3140
3285
  var type = $.prop(this, 'type');
3141
3286
 
3142
- var i, opts, data, optsName, labels;
3287
+ var i, opts, data, optsName, labels, cNames;
3143
3288
  if(inputTypes[type] && webshims.implement(this, 'inputwidgets')){
3144
3289
  data = {};
3145
3290
  optsName = type;
@@ -3177,17 +3322,38 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3177
3322
  opts[optsName] = $.attr(this, copyAttrs[i]) || opts[optsName];
3178
3323
  }
3179
3324
  }
3180
-
3181
- if(opts.onlyMonthDigits || (!opts.formatMonthNames && opts.monthSelect)){
3182
- opts.formatMonthNames = 'monthDigits';
3325
+ if(opts.formatMonthNames){
3326
+ webshims.error('formatMonthNames was renamded to monthNames');
3327
+ }
3328
+ if(opts.onlyMonthDigits){
3329
+ opts.monthNames = 'monthDigits';
3183
3330
  }
3184
3331
  data.shim = inputTypes[type]._create(opts);
3185
-
3332
+
3186
3333
  webshims.addShadowDom(this, data.shim.element, {
3187
3334
  data: data.shim || {}
3188
3335
  });
3189
3336
 
3190
3337
  data.shim.options.containerElements.push(data.shim.element[0]);
3338
+ cNames = $.prop(this, 'className');
3339
+ if(opts.classes){
3340
+ cNames += ' '+opts.classes;
3341
+ }
3342
+
3343
+ if(opts.splitInput || type == 'range'){
3344
+ cNames = cNames.replace('form-control', '');
3345
+ }
3346
+
3347
+ data.shim.element.on('change input', stopPropagation).addClass(cNames);
3348
+
3349
+ if(data.shim.buttonWrapper){
3350
+
3351
+ data.shim.buttonWrapper.addClass('input-button-size-'+(data.shim.buttonWrapper.children().filter(isVisible).length));
3352
+
3353
+ if(data.shim.buttonWrapper.filter(isVisible).length){
3354
+ data.shim.element.addClass('has-input-buttons');
3355
+ }
3356
+ }
3191
3357
 
3192
3358
  labelWidth($(this).getShadowFocusElement(), labels);
3193
3359
 
@@ -3219,14 +3385,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3219
3385
  $(opts.orig).trigger(hasFocus ? 'focusin' : 'focusout');
3220
3386
  }
3221
3387
  hasFocusTriggered = hasFocus;
3222
- }, 0);
3388
+ }, 9);
3223
3389
  }
3224
3390
  })
3225
3391
  ;
3226
3392
  })();
3227
-
3228
3393
 
3229
- data.shim.element.on('change input', stopPropagation);
3394
+
3230
3395
 
3231
3396
  if(hasFormValidation){
3232
3397
  $(opts.orig).on('firstinvalid', function(e){
@@ -3242,13 +3407,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3242
3407
  });
3243
3408
  }
3244
3409
 
3245
-
3246
- if(data.shim.buttonWrapper && data.shim.buttonWrapper.filter(isVisible).length){
3247
- data.shim.element.addClass('has-input-buttons');
3248
- }
3249
-
3250
- data.shim.element.addClass($.prop(this, 'className'));
3251
-
3252
3410
  if(opts.calculateWidth){
3253
3411
  sizeInput(data.shim);
3254
3412
  } else {
@@ -3310,7 +3468,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3310
3468
  if(!modernizrInputTypes[name] || replace[name]){
3311
3469
  extendType(name, {
3312
3470
  _create: function(opts, set){
3313
- if(opts.monthSelect || opts.daySelect){
3471
+ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
3314
3472
  opts.splitInput = true;
3315
3473
  }
3316
3474
  if(opts.splitInput && !splitInputs[name]){
@@ -3329,7 +3487,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3329
3487
  if(webshims.picker && webshims.picker[name]){
3330
3488
  webshims.picker[name](data);
3331
3489
  }
3332
- data.buttonWrapper.addClass('input-button-size-'+(data.buttonWrapper.children().filter(isVisible).length));
3333
3490
  return data;
3334
3491
  }
3335
3492
  });