webshims-rails 1.10.10 → 1.10.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +8 -8
  2. data/MIT_LICENSE.txt +3 -1
  3. data/lib/webshims-rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/webshims/polyfiller.js +8 -9
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +91 -58
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +247 -101
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +241 -96
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +79 -58
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +79 -12
  10. data/vendor/assets/javascripts/webshims/shims/combos/14.js +6 -5
  11. data/vendor/assets/javascripts/webshims/shims/combos/15.js +68 -75
  12. data/vendor/assets/javascripts/webshims/shims/combos/16.js +147 -133
  13. data/vendor/assets/javascripts/webshims/shims/combos/17.js +288 -143
  14. data/vendor/assets/javascripts/webshims/shims/combos/18.js +288 -143
  15. data/vendor/assets/javascripts/webshims/shims/combos/19.js +85 -63
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +97 -91
  17. data/vendor/assets/javascripts/webshims/shims/combos/20.js +85 -17
  18. data/vendor/assets/javascripts/webshims/shims/combos/21.js +17 -17
  19. data/vendor/assets/javascripts/webshims/shims/combos/23.js +79 -58
  20. data/vendor/assets/javascripts/webshims/shims/combos/24.js +17 -16
  21. data/vendor/assets/javascripts/webshims/shims/combos/25.js +85 -63
  22. data/vendor/assets/javascripts/webshims/shims/combos/26.js +6 -5
  23. data/vendor/assets/javascripts/webshims/shims/combos/27.js +0 -46
  24. data/vendor/assets/javascripts/webshims/shims/combos/28.js +6 -5
  25. data/vendor/assets/javascripts/webshims/shims/combos/29.js +13 -6
  26. data/vendor/assets/javascripts/webshims/shims/combos/3.js +47 -31
  27. data/vendor/assets/javascripts/webshims/shims/combos/30.js +47 -59
  28. data/vendor/assets/javascripts/webshims/shims/combos/31.js +18 -33
  29. data/vendor/assets/javascripts/webshims/shims/combos/4.js +35 -31
  30. data/vendor/assets/javascripts/webshims/shims/combos/5.js +304 -157
  31. data/vendor/assets/javascripts/webshims/shims/combos/6.js +304 -185
  32. data/vendor/assets/javascripts/webshims/shims/combos/7.js +126 -117
  33. data/vendor/assets/javascripts/webshims/shims/combos/8.js +126 -89
  34. data/vendor/assets/javascripts/webshims/shims/combos/9.js +247 -129
  35. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +6 -5
  36. data/vendor/assets/javascripts/webshims/shims/form-core.js +12 -0
  37. data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +3 -0
  38. data/vendor/assets/javascripts/webshims/shims/form-datalist.js +0 -28
  39. data/vendor/assets/javascripts/webshims/shims/form-message.js +29 -26
  40. data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +16 -14
  41. data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +47 -47
  42. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +241 -96
  43. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +21 -16
  44. data/vendor/assets/javascripts/webshims/shims/form-validation.js +17 -16
  45. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +173 -41
  46. data/vendor/assets/javascripts/webshims/shims/geolocation.js +17 -17
  47. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ar.js +35 -33
  48. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ch-ZN.js +32 -30
  49. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-de.txt +17 -13
  50. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-el.js +32 -30
  51. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-en.txt +4 -1
  52. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-es.js +30 -28
  53. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +35 -32
  54. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-he.js +32 -30
  55. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hi.js +32 -30
  56. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hu.js +32 -30
  57. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-it.js +32 -30
  58. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ja.js +32 -30
  59. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-lt.js +37 -36
  60. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-nl.js +32 -30
  61. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +5 -2
  62. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt-PT.js +33 -30
  63. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ru.js +3 -1
  64. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +32 -30
  65. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +79 -12
  66. data/vendor/assets/javascripts/webshims/shims/styles/forms.png +0 -0
  67. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +126 -121
  68. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +100 -111
  69. data/vendor/assets/javascripts/webshims/shims/swfmini.js +0 -46
  70. data/vendor/assets/javascripts/webshims/shims/track-ui.js +13 -6
  71. data/webshims-rails.gemspec +1 -0
  72. metadata +4 -3
@@ -1,8 +1,9 @@
1
1
  //DOM-Extension helper
2
2
  webshims.register('dom-extend', function($, webshims, window, document, undefined){
3
3
  "use strict";
4
-
5
- webshims.assumeARIA = $.support.getSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
4
+ var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized;
5
+ var supportGetSetAttribute = !('getSetAttribute' in $.support) || $.support.getSetAttribute;
6
+ webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
6
7
 
7
8
  if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
8
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");
@@ -12,8 +13,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
12
13
  webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
13
14
  }
14
15
 
15
- if(webshims.cfg.extendNative === 1){
16
- webshims.warn("extendNative configuration will be set to false by default with next release. In case you rely on it set it to 'true' otherwise to 'false'. See http://bit.ly/16OOTQO");
16
+ if(webshims.cfg.extendNative === undefined){
17
+ webshims.warn("extendNative configuration was set to false by default with this release. In case you rely on it set it to 'true' otherwise to 'false'. See http://bit.ly/16OOTQO");
17
18
  }
18
19
 
19
20
  if (!webshims.cfg.no$Switch) {
@@ -685,7 +686,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
685
686
 
686
687
  anchor.setAttribute('href', href+'' );
687
688
 
688
- if(!$.support.hrefNormalized){
689
+ if(!supportHrefNormalized){
689
690
  try {
690
691
  $(anchor).insertAfter(this);
691
692
  ret = anchor.getAttribute('href', 4);
@@ -33,6 +33,10 @@ webshims.register('form-core', function($, webshims, window, document, undefined
33
33
  options.customMessages = true;
34
34
  toLoad.push('form-message');
35
35
  }
36
+ if(options.customDatalist){
37
+ options.fD = true;
38
+ toLoad.push('form-datalist');
39
+ }
36
40
  if(options.addValidators){
37
41
  toLoad.push('form-validators');
38
42
  }
@@ -171,6 +175,14 @@ webshims.register('form-core', function($, webshims, window, document, undefined
171
175
  return false;
172
176
  }
173
177
  });
178
+ if(typeof message == 'object'){
179
+ if(validity.typeMismatch && message.badInput){
180
+ message = message.badInput;
181
+ }
182
+ if(validity.badInput && message.typeMismatch){
183
+ message = message.typeMismatch;
184
+ }
185
+ }
174
186
  }
175
187
  }
176
188
 
@@ -296,6 +296,9 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
296
296
 
297
297
  this.hasViewableData = found;
298
298
  if(!_fromShowList && found){
299
+ if(this.popover.isVisible && this.popover.element.attr('data-vertical') == 'bottom'){
300
+ this.popover.element.triggerHandler('pospopover');
301
+ }
299
302
  this.showList();
300
303
  }
301
304
 
@@ -96,34 +96,6 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
96
96
  }
97
97
  };
98
98
 
99
- if(formsCFG.customDatalist && (!listSupport || !('selectedOption' in $('<input />')[0]))){
100
- //currently not supported x-browser (FF4 has not implemented and is not polyfilled )
101
- inputListProto.selectedOption = {
102
- prop: {
103
- writeable: false,
104
- get: function(){
105
- var elem = this;
106
- var list = $.prop(elem, 'list');
107
- var ret = null;
108
- var value, options;
109
- if(!list){return ret;}
110
- value = $.prop(elem, 'value');
111
- if(!value){return ret;}
112
- options = $.prop(list, 'options');
113
- if(!options.length){return ret;}
114
- $.each(options, function(i, option){
115
- if(value == $.prop(option, 'value')){
116
- ret = option;
117
- return false;
118
- }
119
- });
120
- return ret;
121
- }
122
- }
123
- };
124
- }
125
-
126
-
127
99
  if(listSupport){
128
100
  //options only return options, if option-elements are rooted: but this makes this part of HTML5 less backwards compatible
129
101
  if(!($('<datalist><select><option></option></select></datalist>').prop('options') || []).length ){
@@ -1,8 +1,7 @@
1
1
  webshims.register('form-message', function($, webshims, window, document, undefined, options){
2
2
  "use strict";
3
- if(options.overrideMessages){
3
+ if(options.lazyCustomMessages){
4
4
  options.customMessages = true;
5
- webshims.error('overrideMessages is deprecated. use customMessages instead.');
6
5
  }
7
6
  var validityMessages = webshims.validityMessages;
8
7
 
@@ -12,7 +11,10 @@ webshims.register('form-message', function($, webshims, window, document, undefi
12
11
  typeMismatch: {
13
12
  defaultMessage: 'Please enter a valid value.',
14
13
  email: 'Please enter an email address.',
15
- url: 'Please enter a URL.',
14
+ url: 'Please enter a URL.'
15
+ },
16
+ badInput: {
17
+ defaultMessage: 'Please enter a valid value.',
16
18
  number: 'Please enter a number.',
17
19
  date: 'Please enter a date.',
18
20
  time: 'Please enter a time.',
@@ -65,13 +67,16 @@ webshims.register('form-message', function($, webshims, window, document, undefi
65
67
  typeMismatch: {
66
68
  defaultMessage: '{%value} ist in diesem Feld nicht zulässig.',
67
69
  email: '{%value} ist keine gültige E-Mail-Adresse.',
68
- url: '{%value} ist kein(e) gültige(r) Webadresse/Pfad.',
69
- number: '{%value} ist keine Nummer.',
70
- date: '{%value} ist kein Datum.',
71
- time: '{%value} ist keine Uhrzeit.',
72
- month: '{%value} ist in diesem Feld nicht zulässig.',
73
- range: '{%value} ist keine Nummer.',
74
- "datetime-local": '{%value} ist kein Datum-Uhrzeit Format.'
70
+ url: '{%value} ist kein(e) gültige(r) Webadresse/Pfad.'
71
+ },
72
+ badInput: {
73
+ defaultMessage: 'Geben Sie einen zulässigen Wert ein.',
74
+ number: 'Geben Sie eine Nummer ein.',
75
+ date: 'Geben Sie ein Datum ein.',
76
+ time: 'Geben Sie eine Uhrzeit ein.',
77
+ month: 'Geben Sie einen Monat mit Jahr ein.',
78
+ range: 'Geben Sie eine Nummer.',
79
+ "datetime-local": 'Geben Sie ein Datum mit Uhrzeit ein.'
75
80
  },
76
81
  rangeUnderflow: {
77
82
  defaultMessage: '{%value} ist zu niedrig. {%min} ist der unterste Wert, den Sie benutzen können.'
@@ -119,11 +124,17 @@ webshims.register('form-message', function($, webshims, window, document, undefi
119
124
 
120
125
  webshims.createValidationMessage = function(elem, name){
121
126
  var widget;
122
- var message = getMessageFromObj(currentValidationMessage[name], elem);
123
127
  var type = $.prop(elem, 'type');
128
+ var message = getMessageFromObj(currentValidationMessage[name], elem);
129
+ if(!message && name == 'badInput'){
130
+ message = getMessageFromObj(currentValidationMessage.typeMismatch, elem);
131
+ }
132
+ if(!message && name == 'typeMismatch'){
133
+ message = getMessageFromObj(currentValidationMessage.badInput, elem);
134
+ }
124
135
  if(!message){
125
136
  message = getMessageFromObj(validityMessages[''][name], elem) || $.prop(elem, 'validationMessage');
126
- webshims.info('could not find errormessage for: '+ name +' / '+ type +'. in language: '+$.webshims.activeLang());
137
+ webshims.info('could not find errormessage for: '+ name +' / '+ type +'. in language: '+webshims.activeLang());
127
138
  }
128
139
  if(message){
129
140
  ['value', 'min', 'max', 'title', 'maxlength', 'label'].forEach(function(attr){
@@ -166,20 +177,14 @@ webshims.register('form-message', function($, webshims, window, document, undefi
166
177
  webshims.activeLang({
167
178
  register: 'form-core',
168
179
  callback: function(val){
169
- $.each(validityMessages, function(i, val){
170
- if(validityMessages[val]){
171
- currentValidationMessage = validityMessages[val];
172
- return false;
173
- }
174
- });
180
+ if(validityMessages[val]){
181
+ currentValidationMessage = validityMessages[val];
182
+ }
175
183
  }
176
184
  });
177
185
 
178
186
  implementProperties.forEach(function(messageProp){
179
- var skipNames = {
180
- valid: 1,
181
- badInput: 1
182
- };
187
+
183
188
  webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, {
184
189
  prop: {
185
190
  value: '',
@@ -208,16 +213,14 @@ webshims.register('form-message', function($, webshims, window, document, undefi
208
213
  if(message){return message;}
209
214
  }
210
215
  $.each(validity, function(name, prop){
211
- if(skipNames[name] || !prop){return;}
216
+ if(name == 'valid' || !prop){return;}
212
217
 
213
218
  message = webshims.createValidationMessage(elem, name);
214
219
  if(message){
215
220
  return false;
216
221
  }
217
222
  });
218
- if(!message && validity.badInput){
219
- message = webshims.createValidationMessage(elem, 'typeMismatch') || webshims.createValidationMessage(elem, 'valueMissing');
220
- }
223
+
221
224
  return message || '';
222
225
  },
223
226
  writeable: false
@@ -32,22 +32,24 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
32
32
  validityRules[type] = fn;
33
33
  };
34
34
 
35
- webshims.addValidityRule('typeMismatch', function (input, val, cache, validityState){
36
- if(val === ''){return false;}
37
- var ret = validityState.typeMismatch;
38
- if(!('type' in cache)){
39
- cache.type = (input[0].getAttribute('type') || '').toLowerCase();
40
- }
41
-
42
- if(typeModels[cache.type] && typeModels[cache.type].mismatch){
43
- ret = typeModels[cache.type].mismatch(val, input);
44
- }
45
- return ret;
35
+ $.each({typeMismatch: 'mismatch', badInput: 'bad'}, function(name, fn){
36
+ webshims.addValidityRule(name, function (input, val, cache, validityState){
37
+ if(val === ''){return false;}
38
+ var ret = validityState[name];
39
+ if(!('type' in cache)){
40
+ cache.type = (input[0].getAttribute('type') || '').toLowerCase();
41
+ }
42
+
43
+ if(typeModels[cache.type] && typeModels[cache.type][fn]){
44
+ ret = typeModels[cache.type][fn](val, input);
45
+ }
46
+ return ret || false;
47
+ });
46
48
  });
47
49
 
48
50
  var formsExtModule = webshims.modules['form-number-date-api'];
49
51
  var overrideValidity = formsExtModule.loaded && !formsExtModule.test();
50
- var validityProps = ['customError','typeMismatch','rangeUnderflow','rangeOverflow','stepMismatch','tooLong','patternMismatch','valueMissing','valid'];
52
+ var validityProps = ['customError', 'badInput','typeMismatch','rangeUnderflow','rangeOverflow','stepMismatch','tooLong','patternMismatch','valueMissing','valid'];
51
53
 
52
54
  var validityChanger = ['value'];
53
55
  var validityElements = [];
@@ -113,7 +115,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
113
115
  }
114
116
  stopValidity = true;
115
117
  var jElm = $(elem),
116
- cache = {type: (elem.getAttribute && elem.getAttribute('type') || '').toLowerCase(), nodeName: (elem.nodeName || '').toLowerCase()},
118
+ cache = {type: (elem.getAttribute && elem.getAttribute('type') || elem.type || '').toLowerCase(), nodeName: (elem.nodeName || '').toLowerCase()},
117
119
  val = jElm.val(),
118
120
  customError = !!(webshims.data(elem, 'hasCustomError')),
119
121
  setCustomMessage
@@ -140,7 +142,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
140
142
 
141
143
  $.each(validityRules, function(rule, fn){
142
144
  validityState[rule] = fn(jElm, val, cache, validityState);
143
- if( validityState[rule] && (validityState.valid || !setCustomMessage) && ((typeModels[cache.type] && typeModels[cache.type].mismatch)) ) {
145
+ if( validityState[rule] && (validityState.valid || !setCustomMessage) && ((typeModels[cache.type])) ) {
144
146
  oldSetCustomValidity[nodeName].call(elem, webshims.createValidationMessage(elem, rule));
145
147
  validityState.valid = false;
146
148
  setCustomMessage = true;
@@ -149,8 +149,8 @@ webshims.register('form-number-date-api', function($, webshims, window, document
149
149
  } else {
150
150
  webshims.error('INVALID_STATE_ERR: DOM Exception 11');
151
151
  }
152
- } else {
153
- valueAsNumberDescriptor.prop._supset && valueAsNumberDescriptor.prop._supset.apply(elem, arguments);
152
+ } else if(valueAsNumberDescriptor.prop._supset) {
153
+ valueAsNumberDescriptor.prop._supset.apply(elem, arguments);
154
154
  }
155
155
  }
156
156
  }
@@ -277,7 +277,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
277
277
  var typeProtos = {
278
278
 
279
279
  number: {
280
- mismatch: function(val){
280
+ bad: function(val){
281
281
  return !(isNumber(val));
282
282
  },
283
283
  step: 1,
@@ -296,7 +296,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
296
296
  maxDefault: 100
297
297
  },
298
298
  color: {
299
- mismatch: (function(){
299
+ bad: (function(){
300
300
  var cReg = /^\u0023[a-f0-9]{6}$/;
301
301
  return function(val){
302
302
  return (!val || val.length != 7 || !(cReg.test(val)));
@@ -304,7 +304,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
304
304
  })()
305
305
  },
306
306
  date: {
307
- mismatch: function(val){
307
+ bad: function(val){
308
308
  if(!val || !val.split || !(/\d$/.test(val))){return true;}
309
309
  var i;
310
310
  var valA = val.split(/\u002D/);
@@ -329,14 +329,14 @@ webshims.register('form-number-date-api', function($, webshims, window, document
329
329
  //stepBase: 0, 0 = default
330
330
  stepScaleFactor: 86400000,
331
331
  asDate: function(val, _noMismatch){
332
- if(!_noMismatch && this.mismatch(val)){
332
+ if(!_noMismatch && this.bad(val)){
333
333
  return null;
334
334
  }
335
335
  return new Date(this.asNumber(val, true));
336
336
  },
337
337
  asNumber: function(str, _noMismatch){
338
338
  var ret = nan;
339
- if(_noMismatch || !this.mismatch(str)){
339
+ if(_noMismatch || !this.bad(str)){
340
340
  str = str.split(/\u002D/);
341
341
  ret = Date.UTC(str[0], str[1] - 1, str[2]);
342
342
  }
@@ -353,7 +353,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
353
353
  * ToDO: WEEK
354
354
  */
355
355
  // week: {
356
- // mismatch: function(val){
356
+ // bad: function(val){
357
357
  // if(!val || !val.split){return true;}
358
358
  // var valA = val.split('-W');
359
359
  // var ret = true;
@@ -367,7 +367,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
367
367
  // stepBase: -259200000,
368
368
  // asDate: function(str, _noMismatch){
369
369
  // var ret = null;
370
- // if(_noMismatch || !this.mismatch(str)){
370
+ // if(_noMismatch || !this.bad(str)){
371
371
  // ret = str.split('-W');
372
372
  // ret = setWeek(ret[0], ret[1]);
373
373
  // }
@@ -400,7 +400,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
400
400
  // }
401
401
  // },
402
402
  time: {
403
- mismatch: function(val, _getParsed){
403
+ bad: function(val, _getParsed){
404
404
  if(!val || !val.split || !(/\d$/.test(val))){return true;}
405
405
  val = val.split(/\u003A/);
406
406
  if(val.length < 2 || val.length > 3){return true;}
@@ -445,7 +445,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
445
445
  },
446
446
  asNumber: function(val){
447
447
  var ret = nan;
448
- val = this.mismatch(val, true);
448
+ val = this.bad(val, true);
449
449
  if(val !== true){
450
450
  ret = Date.UTC('1970', 0, 1, val[0][0], val[0][1], val[0][2] || 0);
451
451
  if(val[1]){
@@ -473,8 +473,8 @@ webshims.register('form-number-date-api', function($, webshims, window, document
473
473
  }
474
474
  },
475
475
  month: {
476
- mismatch: function(val){
477
- return typeProtos.date.mismatch(val+'-01');
476
+ bad: function(val){
477
+ return typeProtos.date.bad(val+'-01');
478
478
  },
479
479
  step: 1,
480
480
  stepScaleFactor: false,
@@ -485,7 +485,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
485
485
  asNumber: function(val){
486
486
  //1970-01
487
487
  var ret = nan;
488
- if(val && !this.mismatch(val)){
488
+ if(val && !this.bad(val)){
489
489
  val = val.split(/\u002D/);
490
490
  val[0] = (val[0] * 1) - 1970;
491
491
  val[1] = (val[1] * 1) - 1;
@@ -519,46 +519,46 @@ webshims.register('form-number-date-api', function($, webshims, window, document
519
519
  }
520
520
  }
521
521
  }
522
- // ,'datetime-local': {
523
- // mismatch: function(val, _getParsed){
524
- // if(!val || !val.split || (val+'special').split(/\u0054/).length !== 2){return true;}
525
- // val = val.split(/\u0054/);
526
- // return ( typeProtos.date.mismatch(val[0]) || typeProtos.time.mismatch(val[1], _getParsed) );
527
- // },
528
- // noAsDate: true,
529
- // asDate: function(val){
530
- // val = new Date(this.asNumber(val));
531
- //
532
- // return (isNaN(val)) ? null : val;
533
- // },
534
- // asNumber: function(val){
535
- // var ret = nan;
536
- // var time = this.mismatch(val, true);
537
- // if(time !== true){
538
- // val = val.split(/\u0054/)[0].split(/\u002D/);
539
- //
540
- // ret = Date.UTC(val[0], val[1] - 1, val[2], time[0][0], time[0][1], time[0][2] || 0);
541
- // if(time[1]){
542
- // ret += time[1];
543
- // }
544
- // }
545
- // return ret;
546
- // },
547
- // dateToString: function(date, _getParsed){
548
- // return typeProtos.date.dateToString(date) +'T'+ typeProtos.time.dateToString(date, _getParsed);
549
- // }
550
- // }
522
+ ,'datetime-local': {
523
+ bad: function(val, _getParsed){
524
+ if(!val || !val.split || (val+'special').split(/\u0054/).length !== 2){return true;}
525
+ val = val.split(/\u0054/);
526
+ return ( typeProtos.date.bad(val[0]) || typeProtos.time.bad(val[1], _getParsed) );
527
+ },
528
+ noAsDate: true,
529
+ asDate: function(val){
530
+ val = new Date(this.asNumber(val));
531
+
532
+ return (isNaN(val)) ? null : val;
533
+ },
534
+ asNumber: function(val){
535
+ var ret = nan;
536
+ var time = this.bad(val, true);
537
+ if(time !== true){
538
+ val = val.split(/\u0054/)[0].split(/\u002D/);
539
+
540
+ ret = Date.UTC(val[0], val[1] - 1, val[2], time[0][0], time[0][1], time[0][2] || 0);
541
+ if(time[1]){
542
+ ret += time[1];
543
+ }
544
+ }
545
+ return ret;
546
+ },
547
+ dateToString: function(date, _getParsed){
548
+ return typeProtos.date.dateToString(date) +'T'+ typeProtos.time.dateToString(date, _getParsed);
549
+ }
550
+ }
551
551
  };
552
552
 
553
- if(typeBugs || !supportsType('range') || !supportsType('time') || !supportsType('month')){
553
+ if(typeBugs || !supportsType('range') || !supportsType('time') || !supportsType('month') || !supportsType('datetime-local')){
554
554
  typeProtos.range = $.extend({}, typeProtos.number, typeProtos.range);
555
555
  typeProtos.time = $.extend({}, typeProtos.date, typeProtos.time);
556
556
  typeProtos.month = $.extend({}, typeProtos.date, typeProtos.month);
557
- // typeProtos['datetime-local'] = $.extend({}, typeProtos.date, typeProtos.time, typeProtos['datetime-local']);
557
+ typeProtos['datetime-local'] = $.extend({}, typeProtos.date, typeProtos.time, typeProtos['datetime-local']);
558
558
  }
559
559
 
560
- //'datetime-local'
561
- ['number', 'month', 'range', 'date', 'time', 'color'].forEach(function(type){
560
+ //
561
+ ['number', 'month', 'range', 'date', 'time', 'color', 'datetime-local'].forEach(function(type){
562
562
  if(typeBugs || !supportsType(type)){
563
563
  webshims.addInputType(type, typeProtos[type]);
564
564
  }