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.
- checksums.yaml +8 -8
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +41 -20
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +212 -42
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +196 -37
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +17 -6
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +234 -1247
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +234 -1247
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +202 -45
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +202 -45
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +82 -36
- data/vendor/assets/javascripts/webshims/shims/combos/24.js +1689 -997
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +202 -45
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +237 -51
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +51 -11
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +16 -5
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +247 -48
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +17 -5
- data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +21 -3
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +35 -6
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +6 -8
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +134 -24
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +152 -1205
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +1076 -0
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +47 -20
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/i18n/{formcfg-de.txt → formcfg-de.js} +3 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/{formcfg-en.txt → formcfg-en.js} +5 -1
- data/vendor/assets/javascripts/webshims/shims/json-storage.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +62 -13
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +610 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/_extends.scss +10 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +743 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +1 -755
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +0 -606
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +36 -23
- data/vendor/assets/javascripts/webshims/shims/track.js +82 -36
- metadata +8 -6
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +0 -2196
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +0 -1167
@@ -458,7 +458,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
458
458
|
webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing;
|
459
459
|
|
460
460
|
if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){
|
461
|
-
webshims.error("IE browser modes are busted in IE10
|
461
|
+
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");
|
462
462
|
}
|
463
463
|
|
464
464
|
if(!$.parseHTML){
|
@@ -1011,7 +1011,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1011
1011
|
$(this.test);
|
1012
1012
|
webshims.ready('WINDOWLOAD', this.test);
|
1013
1013
|
$(document).on('updatelayout', this.handler);
|
1014
|
-
$(window).
|
1014
|
+
$(window).on('resize', this.handler);
|
1015
1015
|
(function(){
|
1016
1016
|
var oldAnimate = $.fn.animate;
|
1017
1017
|
var animationTimer;
|
@@ -1033,6 +1033,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1033
1033
|
webshims.docObserve = function(){
|
1034
1034
|
webshims.ready('DOM', function(){
|
1035
1035
|
docObserve.start();
|
1036
|
+
if($.support.boxSizing == null){
|
1037
|
+
$(function(){
|
1038
|
+
if($.support.boxSizing){
|
1039
|
+
docObserve.handler({type: 'boxsizing'});
|
1040
|
+
}
|
1041
|
+
});
|
1042
|
+
}
|
1036
1043
|
});
|
1037
1044
|
};
|
1038
1045
|
return function(nativeElem, shadowElem, opts){
|
@@ -1193,7 +1200,12 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1193
1200
|
havePolyfill[prop] = true;
|
1194
1201
|
|
1195
1202
|
if(descs.reflect){
|
1196
|
-
webshims.propTypes[descs.propType
|
1203
|
+
if(descs.propType && !webshims.propTypes[descs.propType]){
|
1204
|
+
webshims.error('could not finde propType '+ descs.propType);
|
1205
|
+
} else {
|
1206
|
+
webshims.propTypes[descs.propType || 'standard'](descs, prop);
|
1207
|
+
}
|
1208
|
+
|
1197
1209
|
}
|
1198
1210
|
|
1199
1211
|
['prop', 'attr', 'removeAttr'].forEach(function(type){
|
@@ -1379,7 +1391,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1379
1391
|
var notLocal = /:\/\/|^\.*\//;
|
1380
1392
|
var loadRemoteLang = function(data, lang, options){
|
1381
1393
|
var langSrc;
|
1382
|
-
if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
|
1394
|
+
if(lang && options && $.inArray(lang, options.availableLangs || options.availabeLangs || []) !== -1){
|
1383
1395
|
data.loading = true;
|
1384
1396
|
langSrc = options.langSrc;
|
1385
1397
|
if(!notLocal.test(langSrc)){
|
@@ -1539,7 +1551,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
|
|
1539
1551
|
});
|
1540
1552
|
|
1541
1553
|
})(webshims.$, document);
|
1542
|
-
|
1543
1554
|
webshims.register('form-core', function($, webshims, window, document, undefined, options){
|
1544
1555
|
"use strict";
|
1545
1556
|
|
@@ -1753,7 +1764,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
|
|
1753
1764
|
|
1754
1765
|
});
|
1755
1766
|
|
1756
|
-
if(!Modernizr.formvalidation || webshims.bugs.bustedValidity){
|
1757
1767
|
webshims.register('form-shim-extend', function($, webshims, window, document, undefined, options){
|
1758
1768
|
"use strict";
|
1759
1769
|
webshims.inputTypes = webshims.inputTypes || {};
|
@@ -1848,7 +1858,7 @@ var isPlaceholderOptionSelected = function(select){
|
|
1848
1858
|
}
|
1849
1859
|
return false;
|
1850
1860
|
};
|
1851
|
-
|
1861
|
+
|
1852
1862
|
var emptyJ = $([]);
|
1853
1863
|
var getGroupElements = function(elem){
|
1854
1864
|
elem = $(elem);
|
@@ -1968,36 +1978,6 @@ $.event.special.invalid = {
|
|
1968
1978
|
}
|
1969
1979
|
};
|
1970
1980
|
|
1971
|
-
var supportSubmitBubbles = !('submitBubbles' in $.support) || $.support.submitBubbles;
|
1972
|
-
var addSubmitBubbles = function(form){
|
1973
|
-
if (!supportSubmitBubbles && form && typeof form == 'object' && !form._submit_attached ) {
|
1974
|
-
|
1975
|
-
$.event.add( form, 'submit._submit', function( event ) {
|
1976
|
-
event._submit_bubble = true;
|
1977
|
-
});
|
1978
|
-
|
1979
|
-
form._submit_attached = true;
|
1980
|
-
}
|
1981
|
-
};
|
1982
|
-
if(!supportSubmitBubbles && $.event.special.submit){
|
1983
|
-
$.event.special.submit.setup = function() {
|
1984
|
-
// Only need this for delegated form submit events
|
1985
|
-
if ( $.nodeName( this, "form" ) ) {
|
1986
|
-
return false;
|
1987
|
-
}
|
1988
|
-
|
1989
|
-
// Lazy-add a submit handler when a descendant form may potentially be submitted
|
1990
|
-
$.event.add( this, "click._submit keypress._submit", function( e ) {
|
1991
|
-
// Node name check avoids a VML-related crash in IE (#9807)
|
1992
|
-
var elem = e.target,
|
1993
|
-
form = $.nodeName( elem, 'input' ) || $.nodeName( elem, 'button' ) ? $.prop(elem, 'form') : undefined;
|
1994
|
-
addSubmitBubbles(form);
|
1995
|
-
|
1996
|
-
});
|
1997
|
-
// return undefined since we don't need an event listener
|
1998
|
-
};
|
1999
|
-
}
|
2000
|
-
|
2001
1981
|
$.event.special.submit = $.event.special.submit || {setup: function(){return false;}};
|
2002
1982
|
var submitSetup = $.event.special.submit.setup;
|
2003
1983
|
$.extend($.event.special.submit, {
|
@@ -2010,24 +1990,27 @@ $.extend($.event.special.submit, {
|
|
2010
1990
|
return submitSetup.apply(this, arguments);
|
2011
1991
|
}
|
2012
1992
|
});
|
2013
|
-
|
2014
|
-
$(window).on('invalid', $.noop);
|
1993
|
+
webshims.ready('form-shim-extend2 WINDOWLOAD', function(){
|
1994
|
+
$(window).on('invalid', $.noop);
|
1995
|
+
});
|
2015
1996
|
|
2016
1997
|
|
2017
1998
|
webshims.addInputType('email', {
|
2018
1999
|
mismatch: (function(){
|
2019
2000
|
//taken from http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
|
2020
2001
|
var test = cfg.emailReg || /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2002
|
+
var splitReg = /\s*,\s*/g;
|
2003
|
+
return function(val, input){
|
2004
|
+
var ret = false;
|
2005
|
+
val = $(input).prop('multiple') ? val.split(splitReg) : [val];
|
2006
|
+
|
2007
|
+
for(var i = 0; i < val.length; i++){
|
2008
|
+
if(!test.test(val[i])){
|
2009
|
+
ret = true;
|
2010
|
+
break;
|
2011
|
+
}
|
2029
2012
|
}
|
2030
|
-
return
|
2013
|
+
return ret;
|
2031
2014
|
};
|
2032
2015
|
})()
|
2033
2016
|
});
|
@@ -2189,106 +2172,184 @@ webshims.defineNodeNamesBooleanProperty(['input', 'textarea', 'select'], 'requir
|
|
2189
2172
|
},
|
2190
2173
|
initAttr: Modernizr.localstorage //only if we have aria-support
|
2191
2174
|
});
|
2175
|
+
webshims.defineNodeNamesBooleanProperty(['input'], 'multiple');
|
2192
2176
|
|
2193
|
-
webshims.
|
2194
|
-
|
2195
|
-
|
2196
|
-
if( !('maxLength' in document.createElement('textarea')) ){
|
2197
|
-
var constrainMaxLength = (function(){
|
2198
|
-
var timer;
|
2199
|
-
var curLength = 0;
|
2200
|
-
var lastElement = $([]);
|
2201
|
-
var max = 1e9;
|
2202
|
-
var constrainLength = function(){
|
2203
|
-
var nowValue = lastElement.prop('value');
|
2204
|
-
var nowLen = nowValue.length;
|
2205
|
-
if(nowLen > curLength && nowLen > max){
|
2206
|
-
nowLen = Math.max(curLength, max);
|
2207
|
-
lastElement.prop('value', nowValue.substr(0, nowLen ));
|
2208
|
-
}
|
2209
|
-
curLength = nowLen;
|
2210
|
-
};
|
2211
|
-
var remove = function(){
|
2212
|
-
clearTimeout(timer);
|
2213
|
-
lastElement.unbind('.maxlengthconstraint');
|
2214
|
-
};
|
2215
|
-
return function(element, maxLength){
|
2216
|
-
remove();
|
2217
|
-
if(maxLength > -1){
|
2218
|
-
max = maxLength;
|
2219
|
-
curLength = $.prop(element, 'value').length;
|
2220
|
-
lastElement = $(element);
|
2221
|
-
lastElement.on({
|
2222
|
-
'keydown.maxlengthconstraint keypress.maxlengthconstraint paste.maxlengthconstraint cut.maxlengthconstraint': function(e){
|
2223
|
-
setTimeout(constrainLength, 0);
|
2224
|
-
},
|
2225
|
-
'keyup.maxlengthconstraint': constrainLength,
|
2226
|
-
'blur.maxlengthconstraint': remove
|
2227
|
-
});
|
2228
|
-
timer = setInterval(constrainLength, 200);
|
2229
|
-
}
|
2230
|
-
};
|
2231
|
-
})();
|
2232
|
-
|
2233
|
-
constrainMaxLength.update = function(element, maxLength){
|
2234
|
-
if($(element).is(':focus')){
|
2235
|
-
if(!maxLength){
|
2236
|
-
maxLength = $.prop(element, 'maxlength');
|
2237
|
-
}
|
2238
|
-
constrainMaxLength(element, maxLength);
|
2239
|
-
}
|
2240
|
-
};
|
2241
|
-
|
2242
|
-
$(document).on('focusin', function(e){
|
2243
|
-
var maxLength;
|
2244
|
-
if(e.target.nodeName == "TEXTAREA" && (maxLength = $.prop(e.target, 'maxlength')) > -1){
|
2245
|
-
constrainMaxLength(e.target, maxLength);
|
2246
|
-
}
|
2247
|
-
});
|
2177
|
+
if(webshims.bugs.bustedValidity){
|
2248
2178
|
|
2249
|
-
webshims.defineNodeNameProperty('
|
2179
|
+
webshims.defineNodeNameProperty('form', 'novalidate', {
|
2250
2180
|
attr: {
|
2251
2181
|
set: function(val){
|
2252
|
-
|
2253
|
-
constrainMaxLength.update(this);
|
2182
|
+
webshims.data(this, 'bustedNoValidate', ''+val);
|
2254
2183
|
},
|
2255
2184
|
get: function(){
|
2256
|
-
var ret =
|
2185
|
+
var ret = webshims.data(this, 'bustedNoValidate');
|
2257
2186
|
return ret == null ? undefined : ret;
|
2258
2187
|
}
|
2259
2188
|
},
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2189
|
+
removeAttr: {
|
2190
|
+
value: function(){
|
2191
|
+
webshims.data(this, 'bustedNoValidate', null);
|
2192
|
+
}
|
2193
|
+
}
|
2194
|
+
});
|
2195
|
+
|
2196
|
+
$.each(['rangeUnderflow', 'rangeOverflow', 'stepMismatch'], function(i, name){
|
2197
|
+
validityRules[name] = function(elem){
|
2198
|
+
return (elem[0].validity || {})[name] || false;
|
2199
|
+
};
|
2200
|
+
});
|
2201
|
+
|
2202
|
+
}
|
2203
|
+
|
2204
|
+
webshims.defineNodeNameProperty('form', 'noValidate', {
|
2205
|
+
prop: {
|
2206
|
+
set: function(val){
|
2207
|
+
val = !!val;
|
2208
|
+
if(val){
|
2209
|
+
$.attr(this, 'novalidate', 'novalidate');
|
2210
|
+
} else {
|
2211
|
+
$(this).removeAttr('novalidate');
|
2212
|
+
}
|
2213
|
+
},
|
2214
|
+
get: function(){
|
2215
|
+
return $.attr(this, 'novalidate') != null;
|
2216
|
+
}
|
2217
|
+
}
|
2218
|
+
});
|
2219
|
+
|
2220
|
+
if(Modernizr.inputtypes.date && /webkit/i.test(navigator.userAgent)){
|
2221
|
+
(function(){
|
2222
|
+
|
2223
|
+
var noInputTriggerEvts = {updateInput: 1, input: 1},
|
2224
|
+
fixInputTypes = {
|
2225
|
+
date: 1,
|
2226
|
+
time: 1,
|
2227
|
+
month: 1,
|
2228
|
+
week: 1,
|
2229
|
+
"datetime-local": 1
|
2273
2230
|
},
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2231
|
+
noFocusEvents = {
|
2232
|
+
focusout: 1,
|
2233
|
+
blur: 1
|
2234
|
+
},
|
2235
|
+
changeEvts = {
|
2236
|
+
updateInput: 1,
|
2237
|
+
change: 1
|
2238
|
+
},
|
2239
|
+
observe = function(input){
|
2240
|
+
var timer,
|
2241
|
+
focusedin = true,
|
2242
|
+
lastInputVal = input.prop('value'),
|
2243
|
+
lastChangeVal = lastInputVal,
|
2244
|
+
trigger = function(e){
|
2245
|
+
//input === null
|
2246
|
+
if(!input){return;}
|
2247
|
+
var newVal = input.prop('value');
|
2248
|
+
|
2249
|
+
if(newVal !== lastInputVal){
|
2250
|
+
lastInputVal = newVal;
|
2251
|
+
if(!e || !noInputTriggerEvts[e.type]){
|
2252
|
+
input.trigger('input');
|
2253
|
+
}
|
2254
|
+
}
|
2255
|
+
if(e && changeEvts[e.type]){
|
2256
|
+
lastChangeVal = newVal;
|
2257
|
+
}
|
2258
|
+
if(!focusedin && newVal !== lastChangeVal){
|
2259
|
+
input.trigger('change');
|
2260
|
+
}
|
2261
|
+
},
|
2262
|
+
extraTimer,
|
2263
|
+
extraTest = function(){
|
2264
|
+
clearTimeout(extraTimer);
|
2265
|
+
extraTimer = setTimeout(trigger, 9);
|
2266
|
+
},
|
2267
|
+
unbind = function(e){
|
2268
|
+
clearInterval(timer);
|
2269
|
+
setTimeout(function(){
|
2270
|
+
if(e && noFocusEvents[e.type]){
|
2271
|
+
focusedin = false;
|
2272
|
+
}
|
2273
|
+
if(input){
|
2274
|
+
input.unbind('focusout blur', unbind).unbind('input change updateInput', trigger);
|
2275
|
+
trigger();
|
2276
|
+
}
|
2277
|
+
input = null;
|
2278
|
+
}, 1);
|
2279
|
+
|
2280
|
+
}
|
2281
|
+
;
|
2277
2282
|
|
2283
|
+
clearInterval(timer);
|
2284
|
+
timer = setInterval(trigger, 160);
|
2285
|
+
extraTest();
|
2286
|
+
input
|
2287
|
+
.off({
|
2288
|
+
'focusout blur': unbind,
|
2289
|
+
'input change updateInput': trigger
|
2290
|
+
})
|
2291
|
+
.on({
|
2292
|
+
'focusout blur': unbind,
|
2293
|
+
'input updateInput change': trigger
|
2294
|
+
})
|
2295
|
+
;
|
2296
|
+
}
|
2297
|
+
;
|
2298
|
+
|
2299
|
+
|
2300
|
+
$(document)
|
2301
|
+
.on('focusin', function(e){
|
2302
|
+
if( e.target && fixInputTypes[e.target.type] && !e.target.readOnly && !e.target.disabled ){
|
2303
|
+
observe($(e.target));
|
2304
|
+
}
|
2305
|
+
})
|
2306
|
+
;
|
2307
|
+
|
2308
|
+
|
2309
|
+
})();
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
webshims.addReady(function(context, contextElem){
|
2313
|
+
//start constrain-validation
|
2314
|
+
var focusElem;
|
2315
|
+
$('form', context)
|
2316
|
+
.add(contextElem.filter('form'))
|
2317
|
+
.bind('invalid', $.noop)
|
2318
|
+
;
|
2319
|
+
|
2320
|
+
try {
|
2321
|
+
if(context == document && !('form' in (document.activeElement || {}))) {
|
2322
|
+
focusElem = $('input[autofocus], select[autofocus], textarea[autofocus]', context).eq(0).getShadowFocusElement()[0];
|
2323
|
+
if (focusElem && focusElem.offsetHeight && focusElem.offsetWidth) {
|
2324
|
+
focusElem.focus();
|
2278
2325
|
}
|
2279
2326
|
}
|
2280
|
-
}
|
2281
|
-
|
2327
|
+
}
|
2328
|
+
catch (er) {}
|
2329
|
+
|
2330
|
+
});
|
2331
|
+
|
2332
|
+
if(!Modernizr.input.list){
|
2333
|
+
webshims.defineNodeNameProperty('datalist', 'options', {
|
2282
2334
|
prop: {
|
2283
|
-
|
2284
|
-
$.prop(this, 'maxlength', val);
|
2285
|
-
},
|
2335
|
+
writeable: false,
|
2286
2336
|
get: function(){
|
2287
|
-
|
2337
|
+
var elem = this;
|
2338
|
+
var select = $('select', elem);
|
2339
|
+
var options;
|
2340
|
+
if(select[0]){
|
2341
|
+
options = $.makeArray(select[0].options || []);
|
2342
|
+
} else {
|
2343
|
+
options = $('option', elem).get();
|
2344
|
+
if(options.length){
|
2345
|
+
webshims.warn('you should wrap your option-elements for a datalist in a select element to support IE and other old browsers.');
|
2346
|
+
}
|
2347
|
+
}
|
2348
|
+
return options;
|
2288
2349
|
}
|
2289
2350
|
}
|
2290
2351
|
});
|
2291
|
-
}
|
2352
|
+
}
|
2292
2353
|
|
2293
2354
|
|
2294
2355
|
|
@@ -2446,1119 +2507,16 @@ switch(desc.proptype) {
|
|
2446
2507
|
|
2447
2508
|
webshims.defineNodeNamesProperties(['input', 'button'], formSubmitterDescriptors);
|
2448
2509
|
|
2510
|
+
}); //webshims.ready end
|
2449
2511
|
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
get: function(){
|
2457
|
-
var ret = this.getAttribute('novalidate');
|
2458
|
-
return ret == null ? undefined : ret;
|
2459
|
-
}
|
2460
|
-
}
|
2461
|
-
});
|
2462
|
-
} else if(webshims.bugs.bustedValidity){
|
2463
|
-
|
2464
|
-
webshims.defineNodeNameProperty('form', 'novalidate', {
|
2465
|
-
attr: {
|
2466
|
-
set: function(val){
|
2467
|
-
webshims.data(this, 'bustedNoValidate', ''+val);
|
2468
|
-
},
|
2469
|
-
get: function(){
|
2470
|
-
var ret = webshims.data(this, 'bustedNoValidate');
|
2471
|
-
return ret == null ? undefined : ret;
|
2472
|
-
}
|
2473
|
-
},
|
2474
|
-
removeAttr: {
|
2475
|
-
value: function(){
|
2476
|
-
webshims.data(this, 'bustedNoValidate', null);
|
2477
|
-
}
|
2478
|
-
}
|
2479
|
-
});
|
2512
|
+
webshims.register('form-message', function($, webshims, window, document, undefined, options){
|
2513
|
+
"use strict";
|
2514
|
+
if(options.lazyCustomMessages){
|
2515
|
+
options.customMessages = true;
|
2516
|
+
}
|
2517
|
+
var validityMessages = webshims.validityMessages;
|
2480
2518
|
|
2481
|
-
|
2482
|
-
validityRules[name] = function(elem){
|
2483
|
-
return (elem[0].validity || {})[name] || false;
|
2484
|
-
};
|
2485
|
-
});
|
2486
|
-
|
2487
|
-
}
|
2488
|
-
|
2489
|
-
webshims.defineNodeNameProperty('form', 'noValidate', {
|
2490
|
-
prop: {
|
2491
|
-
set: function(val){
|
2492
|
-
val = !!val;
|
2493
|
-
if(val){
|
2494
|
-
$.attr(this, 'novalidate', 'novalidate');
|
2495
|
-
} else {
|
2496
|
-
$(this).removeAttr('novalidate');
|
2497
|
-
}
|
2498
|
-
},
|
2499
|
-
get: function(){
|
2500
|
-
return $.attr(this, 'novalidate') != null;
|
2501
|
-
}
|
2502
|
-
}
|
2503
|
-
});
|
2504
|
-
|
2505
|
-
if(Modernizr.inputtypes.date && /webkit/i.test(navigator.userAgent)){
|
2506
|
-
(function(){
|
2507
|
-
|
2508
|
-
var noInputTriggerEvts = {updateInput: 1, input: 1},
|
2509
|
-
fixInputTypes = {
|
2510
|
-
date: 1,
|
2511
|
-
time: 1,
|
2512
|
-
month: 1,
|
2513
|
-
week: 1,
|
2514
|
-
"datetime-local": 1
|
2515
|
-
},
|
2516
|
-
noFocusEvents = {
|
2517
|
-
focusout: 1,
|
2518
|
-
blur: 1
|
2519
|
-
},
|
2520
|
-
changeEvts = {
|
2521
|
-
updateInput: 1,
|
2522
|
-
change: 1
|
2523
|
-
},
|
2524
|
-
observe = function(input){
|
2525
|
-
var timer,
|
2526
|
-
focusedin = true,
|
2527
|
-
lastInputVal = input.prop('value'),
|
2528
|
-
lastChangeVal = lastInputVal,
|
2529
|
-
trigger = function(e){
|
2530
|
-
//input === null
|
2531
|
-
if(!input){return;}
|
2532
|
-
var newVal = input.prop('value');
|
2533
|
-
|
2534
|
-
if(newVal !== lastInputVal){
|
2535
|
-
lastInputVal = newVal;
|
2536
|
-
if(!e || !noInputTriggerEvts[e.type]){
|
2537
|
-
input.trigger('input');
|
2538
|
-
}
|
2539
|
-
}
|
2540
|
-
if(e && changeEvts[e.type]){
|
2541
|
-
lastChangeVal = newVal;
|
2542
|
-
}
|
2543
|
-
if(!focusedin && newVal !== lastChangeVal){
|
2544
|
-
input.trigger('change');
|
2545
|
-
}
|
2546
|
-
},
|
2547
|
-
extraTimer,
|
2548
|
-
extraTest = function(){
|
2549
|
-
clearTimeout(extraTimer);
|
2550
|
-
extraTimer = setTimeout(trigger, 9);
|
2551
|
-
},
|
2552
|
-
unbind = function(e){
|
2553
|
-
clearInterval(timer);
|
2554
|
-
setTimeout(function(){
|
2555
|
-
if(e && noFocusEvents[e.type]){
|
2556
|
-
focusedin = false;
|
2557
|
-
}
|
2558
|
-
if(input){
|
2559
|
-
input.unbind('focusout blur', unbind).unbind('input change updateInput', trigger);
|
2560
|
-
trigger();
|
2561
|
-
}
|
2562
|
-
input = null;
|
2563
|
-
}, 1);
|
2564
|
-
|
2565
|
-
}
|
2566
|
-
;
|
2567
|
-
|
2568
|
-
clearInterval(timer);
|
2569
|
-
timer = setInterval(trigger, 160);
|
2570
|
-
extraTest();
|
2571
|
-
input
|
2572
|
-
.off({
|
2573
|
-
'focusout blur': unbind,
|
2574
|
-
'input change updateInput': trigger
|
2575
|
-
})
|
2576
|
-
.on({
|
2577
|
-
'focusout blur': unbind,
|
2578
|
-
'input updateInput change': trigger
|
2579
|
-
})
|
2580
|
-
;
|
2581
|
-
}
|
2582
|
-
;
|
2583
|
-
|
2584
|
-
|
2585
|
-
$(document)
|
2586
|
-
.on('focusin', function(e){
|
2587
|
-
if( e.target && fixInputTypes[e.target.type] && !e.target.readOnly && !e.target.disabled ){
|
2588
|
-
observe($(e.target));
|
2589
|
-
}
|
2590
|
-
})
|
2591
|
-
;
|
2592
|
-
|
2593
|
-
|
2594
|
-
})();
|
2595
|
-
}
|
2596
|
-
|
2597
|
-
webshims.addReady(function(context, contextElem){
|
2598
|
-
//start constrain-validation
|
2599
|
-
var focusElem;
|
2600
|
-
$('form', context)
|
2601
|
-
.add(contextElem.filter('form'))
|
2602
|
-
.bind('invalid', $.noop)
|
2603
|
-
;
|
2604
|
-
|
2605
|
-
try {
|
2606
|
-
if(context == document && !('form' in (document.activeElement || {}))) {
|
2607
|
-
focusElem = $('input[autofocus], select[autofocus], textarea[autofocus]', context).eq(0).getShadowFocusElement()[0];
|
2608
|
-
if (focusElem && focusElem.offsetHeight && focusElem.offsetWidth) {
|
2609
|
-
focusElem.focus();
|
2610
|
-
}
|
2611
|
-
}
|
2612
|
-
}
|
2613
|
-
catch (er) {}
|
2614
|
-
|
2615
|
-
});
|
2616
|
-
|
2617
|
-
if(!Modernizr.input.list){
|
2618
|
-
webshims.defineNodeNameProperty('datalist', 'options', {
|
2619
|
-
prop: {
|
2620
|
-
writeable: false,
|
2621
|
-
get: function(){
|
2622
|
-
var elem = this;
|
2623
|
-
var select = $('select', elem);
|
2624
|
-
var options;
|
2625
|
-
if(select[0]){
|
2626
|
-
options = select[0].options;
|
2627
|
-
} else {
|
2628
|
-
options = $('option', elem).get();
|
2629
|
-
if(options.length){
|
2630
|
-
webshims.warn('you should wrap your option-elements for a datalist in a select element to support IE and other old browsers.');
|
2631
|
-
}
|
2632
|
-
}
|
2633
|
-
return options;
|
2634
|
-
}
|
2635
|
-
}
|
2636
|
-
});
|
2637
|
-
|
2638
|
-
webshims.ready('form-datalist', function(){
|
2639
|
-
webshims.defineNodeNameProperties('input', {
|
2640
|
-
list: {
|
2641
|
-
attr: {
|
2642
|
-
get: function(){
|
2643
|
-
var val = webshims.contentAttr(this, 'list');
|
2644
|
-
return (val == null) ? undefined : val;
|
2645
|
-
},
|
2646
|
-
set: function(value){
|
2647
|
-
var elem = this;
|
2648
|
-
webshims.contentAttr(elem, 'list', value);
|
2649
|
-
webshims.objectCreate(options.shadowListProto, undefined, {input: elem, id: value, datalist: $.prop(elem, 'list')});
|
2650
|
-
$(elem).triggerHandler('listdatalistchange');
|
2651
|
-
}
|
2652
|
-
},
|
2653
|
-
initAttr: true,
|
2654
|
-
reflect: true,
|
2655
|
-
propType: 'element',
|
2656
|
-
propNodeName: 'datalist'
|
2657
|
-
}
|
2658
|
-
});
|
2659
|
-
});
|
2660
|
-
|
2661
|
-
}
|
2662
|
-
|
2663
|
-
if(!Modernizr.formattribute || !Modernizr.fieldsetdisabled){
|
2664
|
-
(function(){
|
2665
|
-
(function(prop, undefined){
|
2666
|
-
$.prop = function(elem, name, value){
|
2667
|
-
var ret;
|
2668
|
-
if(elem && elem.nodeType == 1 && value === undefined && $.nodeName(elem, 'form') && elem.id){
|
2669
|
-
ret = document.getElementsByName(name);
|
2670
|
-
if(!ret || !ret.length){
|
2671
|
-
ret = document.getElementById(name);
|
2672
|
-
}
|
2673
|
-
if(ret){
|
2674
|
-
ret = $(ret).filter(function(){
|
2675
|
-
return $.prop(this, 'form') == elem;
|
2676
|
-
}).get();
|
2677
|
-
if(ret.length){
|
2678
|
-
return ret.length == 1 ? ret[0] : ret;
|
2679
|
-
}
|
2680
|
-
}
|
2681
|
-
}
|
2682
|
-
return prop.apply(this, arguments);
|
2683
|
-
};
|
2684
|
-
})($.prop, undefined);
|
2685
|
-
var removeAddedElements = function(form){
|
2686
|
-
var elements = $.data(form, 'webshimsAddedElements');
|
2687
|
-
if(elements){
|
2688
|
-
elements.remove();
|
2689
|
-
$.removeData(form, 'webshimsAddedElements');
|
2690
|
-
}
|
2691
|
-
};
|
2692
|
-
|
2693
|
-
|
2694
|
-
if(!Modernizr.formattribute){
|
2695
|
-
webshims.defineNodeNamesProperty(['input', 'textarea', 'select', 'button', 'fieldset'], 'form', {
|
2696
|
-
prop: {
|
2697
|
-
get: function(){
|
2698
|
-
var form = webshims.contentAttr(this, 'form');
|
2699
|
-
if(form){
|
2700
|
-
form = document.getElementById(form);
|
2701
|
-
if(form && !$.nodeName(form, 'form')){
|
2702
|
-
form = null;
|
2703
|
-
}
|
2704
|
-
}
|
2705
|
-
return form || this.form;
|
2706
|
-
},
|
2707
|
-
writeable: false
|
2708
|
-
}
|
2709
|
-
});
|
2710
|
-
|
2711
|
-
|
2712
|
-
webshims.defineNodeNamesProperty(['form'], 'elements', {
|
2713
|
-
prop: {
|
2714
|
-
get: function(){
|
2715
|
-
var id = this.id;
|
2716
|
-
var elements = $.makeArray(this.elements);
|
2717
|
-
if(id){
|
2718
|
-
elements = $(elements).add('input[form="'+ id +'"], select[form="'+ id +'"], textarea[form="'+ id +'"], button[form="'+ id +'"], fieldset[form="'+ id +'"]').not('.webshims-visual-hide > *').get();
|
2719
|
-
}
|
2720
|
-
return elements;
|
2721
|
-
},
|
2722
|
-
writeable: false
|
2723
|
-
}
|
2724
|
-
});
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
$(function(){
|
2729
|
-
var stopPropagation = function(e){
|
2730
|
-
e.stopPropagation();
|
2731
|
-
};
|
2732
|
-
$(document).on('submit', function(e){
|
2733
|
-
|
2734
|
-
if(!e.isDefaultPrevented()){
|
2735
|
-
var form = e.target;
|
2736
|
-
var id = form.id;
|
2737
|
-
var elements;
|
2738
|
-
|
2739
|
-
|
2740
|
-
if(id){
|
2741
|
-
removeAddedElements(form);
|
2742
|
-
|
2743
|
-
elements = $('input[form="'+ id +'"], select[form="'+ id +'"], textarea[form="'+ id +'"]')
|
2744
|
-
.filter(function(){
|
2745
|
-
return !this.disabled && this.name && this.form != form;
|
2746
|
-
})
|
2747
|
-
.clone()
|
2748
|
-
;
|
2749
|
-
if(elements.length){
|
2750
|
-
$.data(form, 'webshimsAddedElements', $('<div class="webshims-visual-hide" />').append(elements).appendTo(form));
|
2751
|
-
setTimeout(function(){
|
2752
|
-
removeAddedElements(form);
|
2753
|
-
}, 9);
|
2754
|
-
}
|
2755
|
-
elements = null;
|
2756
|
-
}
|
2757
|
-
}
|
2758
|
-
});
|
2759
|
-
|
2760
|
-
$(document).on('click', function(e){
|
2761
|
-
if(!e.isDefaultPrevented() && $(e.target).is('input[type="submit"][form], button[form], input[type="button"][form], input[type="image"][form], input[type="reset"][form]')){
|
2762
|
-
var trueForm = $.prop(e.target, 'form');
|
2763
|
-
var formIn = e.target.form;
|
2764
|
-
var clone;
|
2765
|
-
if(trueForm && trueForm != formIn){
|
2766
|
-
clone = $(e.target)
|
2767
|
-
.clone()
|
2768
|
-
.removeAttr('form')
|
2769
|
-
.addClass('webshims-visual-hide')
|
2770
|
-
.on('click', stopPropagation)
|
2771
|
-
.appendTo(trueForm)
|
2772
|
-
;
|
2773
|
-
if(formIn){
|
2774
|
-
e.preventDefault();
|
2775
|
-
}
|
2776
|
-
addSubmitBubbles(trueForm);
|
2777
|
-
clone.trigger('click');
|
2778
|
-
setTimeout(function(){
|
2779
|
-
clone.remove();
|
2780
|
-
clone = null;
|
2781
|
-
}, 9);
|
2782
|
-
}
|
2783
|
-
}
|
2784
|
-
});
|
2785
|
-
});
|
2786
|
-
}
|
2787
|
-
|
2788
|
-
if(!Modernizr.fieldsetdisabled){
|
2789
|
-
webshims.defineNodeNamesProperty(['fieldset'], 'elements', {
|
2790
|
-
prop: {
|
2791
|
-
get: function(){
|
2792
|
-
//add listed elements without keygen, object, output
|
2793
|
-
return $('input, select, textarea, button, fieldset', this).get() || [];
|
2794
|
-
},
|
2795
|
-
writeable: false
|
2796
|
-
}
|
2797
|
-
});
|
2798
|
-
}
|
2799
|
-
|
2800
|
-
if(!$.fn.finish && parseFloat($.fn.jquery, 10) < 1.9){
|
2801
|
-
var rCRLF = /\r?\n/g,
|
2802
|
-
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
|
2803
|
-
rselectTextarea = /^(?:select|textarea)/i;
|
2804
|
-
$.fn.serializeArray = function() {
|
2805
|
-
return this.map(function(){
|
2806
|
-
var elements = $.prop(this, 'elements');
|
2807
|
-
return elements ? $.makeArray( elements ) : this;
|
2808
|
-
})
|
2809
|
-
.filter(function(){
|
2810
|
-
return this.name && !this.disabled &&
|
2811
|
-
( this.checked || rselectTextarea.test( this.nodeName ) ||
|
2812
|
-
rinput.test( this.type ) );
|
2813
|
-
})
|
2814
|
-
.map(function( i, elem ){
|
2815
|
-
var val = $( this ).val();
|
2816
|
-
|
2817
|
-
return val == null ?
|
2818
|
-
null :
|
2819
|
-
$.isArray( val ) ?
|
2820
|
-
$.map( val, function( val, i ){
|
2821
|
-
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
|
2822
|
-
}) :
|
2823
|
-
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
|
2824
|
-
}).get();
|
2825
|
-
};
|
2826
|
-
}
|
2827
|
-
|
2828
|
-
})();
|
2829
|
-
}
|
2830
|
-
|
2831
|
-
if($('<input />').prop('labels') == null){
|
2832
|
-
webshims.defineNodeNamesProperty('button, input, keygen, meter, output, progress, select, textarea', 'labels', {
|
2833
|
-
prop: {
|
2834
|
-
get: function(){
|
2835
|
-
if(this.type == 'hidden'){return null;}
|
2836
|
-
var id = this.id;
|
2837
|
-
var labels = $(this)
|
2838
|
-
.closest('label')
|
2839
|
-
.filter(function(){
|
2840
|
-
var hFor = (this.attributes['for'] || {});
|
2841
|
-
return (!hFor.specified || hFor.value == id);
|
2842
|
-
})
|
2843
|
-
;
|
2844
|
-
|
2845
|
-
if(id) {
|
2846
|
-
labels = labels.add('label[for="'+ id +'"]');
|
2847
|
-
}
|
2848
|
-
return labels.get();
|
2849
|
-
},
|
2850
|
-
writeable: false
|
2851
|
-
}
|
2852
|
-
});
|
2853
|
-
}
|
2854
|
-
|
2855
|
-
if(!('value' in document.createElement('progress'))){
|
2856
|
-
(function(){
|
2857
|
-
|
2858
|
-
var nan = parseInt('NaN', 10);
|
2859
|
-
|
2860
|
-
var updateProgress = function(progress){
|
2861
|
-
var position;
|
2862
|
-
|
2863
|
-
|
2864
|
-
position = $.prop(progress, 'position');
|
2865
|
-
|
2866
|
-
$.attr(progress, 'data-position', position);
|
2867
|
-
$('> span', progress).css({width: (position < 0 ? 100 : position * 100) +'%'});
|
2868
|
-
};
|
2869
|
-
var desc = {
|
2870
|
-
position: {
|
2871
|
-
prop: {
|
2872
|
-
get: function(){
|
2873
|
-
var max;
|
2874
|
-
//jQuery 1.8.x try's to normalize "0" to 0
|
2875
|
-
var val = this.getAttribute('value');
|
2876
|
-
var ret = -1;
|
2877
|
-
|
2878
|
-
val = val ? (val * 1) : nan;
|
2879
|
-
if(!isNaN(val)){
|
2880
|
-
max = $.prop(this, 'max');
|
2881
|
-
ret = Math.max(Math.min(val / max, 1), 0);
|
2882
|
-
if(updateProgress.isInChange){
|
2883
|
-
$.attr(this, 'aria-valuenow', ret * 100);
|
2884
|
-
if(updateProgress.isInChange == 'max'){
|
2885
|
-
$.attr(this, 'aria-valuemax', max);
|
2886
|
-
}
|
2887
|
-
}
|
2888
|
-
} else if(updateProgress.isInChange) {
|
2889
|
-
$(this).removeAttr('aria-valuenow');
|
2890
|
-
}
|
2891
|
-
return ret;
|
2892
|
-
},
|
2893
|
-
writeable: false
|
2894
|
-
}
|
2895
|
-
}
|
2896
|
-
};
|
2897
|
-
|
2898
|
-
$.each({value: 0, max: 1}, function(name, defValue){
|
2899
|
-
var removeProp = (name == 'value' && !$.fn.finish);
|
2900
|
-
desc[name] = {
|
2901
|
-
attr: {
|
2902
|
-
set: function(value){
|
2903
|
-
var ret = desc[name].attr._supset.call(this, value);
|
2904
|
-
updateProgress.isInChange = name;
|
2905
|
-
updateProgress(this);
|
2906
|
-
updateProgress.isInChange = false;
|
2907
|
-
return ret;
|
2908
|
-
}
|
2909
|
-
},
|
2910
|
-
removeAttr: {
|
2911
|
-
value: function(){
|
2912
|
-
this.removeAttribute(name);
|
2913
|
-
if(removeProp){
|
2914
|
-
try {
|
2915
|
-
delete this.value;
|
2916
|
-
} catch(er){}
|
2917
|
-
}
|
2918
|
-
updateProgress.isInChange = name;
|
2919
|
-
updateProgress(this);
|
2920
|
-
updateProgress.isInChange = false;
|
2921
|
-
}
|
2922
|
-
},
|
2923
|
-
prop: {
|
2924
|
-
get: function(){
|
2925
|
-
var max;
|
2926
|
-
var ret = (desc[name].attr.get.call(this) * 1);
|
2927
|
-
if(ret < 0 || isNaN(ret)){
|
2928
|
-
ret = defValue;
|
2929
|
-
} else if(name == 'value'){
|
2930
|
-
ret = Math.min(ret, $.prop(this, 'max'));
|
2931
|
-
} else if(ret === 0){
|
2932
|
-
ret = defValue;
|
2933
|
-
}
|
2934
|
-
return ret;
|
2935
|
-
},
|
2936
|
-
set: function(value){
|
2937
|
-
value = value * 1;
|
2938
|
-
if(isNaN(value)){
|
2939
|
-
webshims.error('Floating-point value is not finite.');
|
2940
|
-
}
|
2941
|
-
return desc[name].attr.set.call(this, value);
|
2942
|
-
}
|
2943
|
-
}
|
2944
|
-
};
|
2945
|
-
});
|
2946
|
-
|
2947
|
-
webshims.createElement(
|
2948
|
-
'progress',
|
2949
|
-
function(){
|
2950
|
-
var labels = $(this)
|
2951
|
-
.attr({role: 'progressbar', 'aria-valuemin': '0'})
|
2952
|
-
.html('<span class="progress-value" />')
|
2953
|
-
.jProp('labels')
|
2954
|
-
.map(function(){
|
2955
|
-
return webshims.getID(this);
|
2956
|
-
})
|
2957
|
-
.get()
|
2958
|
-
;
|
2959
|
-
if(labels.length){
|
2960
|
-
$.attr(this, 'aria-labelledby', labels.join(' '));
|
2961
|
-
} else {
|
2962
|
-
webshims.info("you should use label elements for your prgogress elements");
|
2963
|
-
}
|
2964
|
-
|
2965
|
-
updateProgress.isInChange = 'max';
|
2966
|
-
updateProgress(this);
|
2967
|
-
updateProgress.isInChange = false;
|
2968
|
-
},
|
2969
|
-
desc
|
2970
|
-
);
|
2971
|
-
|
2972
|
-
})();
|
2973
|
-
}
|
2974
|
-
|
2975
|
-
try {
|
2976
|
-
document.querySelector(':checked');
|
2977
|
-
} catch(er){
|
2978
|
-
(function(){
|
2979
|
-
$('html').addClass('no-csschecked');
|
2980
|
-
var checkInputs = {
|
2981
|
-
radio: 1,
|
2982
|
-
checkbox: 1
|
2983
|
-
};
|
2984
|
-
var selectChange = function(){
|
2985
|
-
var options = this.options || [];
|
2986
|
-
var i, len, option;
|
2987
|
-
for(i = 0, len = options.length; i < len; i++){
|
2988
|
-
option = $(options[i]);
|
2989
|
-
option[$.prop(options[i], 'selected') ? 'addClass' : 'removeClass']('prop-checked');
|
2990
|
-
}
|
2991
|
-
};
|
2992
|
-
var checkChange = function(){
|
2993
|
-
var fn = $.prop(this, 'checked') ? 'addClass' : 'removeClass';
|
2994
|
-
var className = this.className || '';
|
2995
|
-
var parent;
|
2996
|
-
|
2997
|
-
//IE8- has problems to update styles, we help
|
2998
|
-
if( (className.indexOf('prop-checked') == -1) == (fn == 'addClass')){
|
2999
|
-
$(this)[fn]('prop-checked');
|
3000
|
-
if((parent = this.parentNode)){
|
3001
|
-
parent.className = parent.className;
|
3002
|
-
}
|
3003
|
-
}
|
3004
|
-
};
|
3005
|
-
|
3006
|
-
|
3007
|
-
webshims.onNodeNamesPropertyModify('select', 'value', selectChange);
|
3008
|
-
webshims.onNodeNamesPropertyModify('select', 'selectedIndex', selectChange);
|
3009
|
-
webshims.onNodeNamesPropertyModify('option', 'selected', function(){
|
3010
|
-
$(this).closest('select').each(selectChange);
|
3011
|
-
});
|
3012
|
-
webshims.onNodeNamesPropertyModify('input', 'checked', function(value, boolVal){
|
3013
|
-
var type = this.type;
|
3014
|
-
if(type == 'radio' && boolVal){
|
3015
|
-
getGroupElements(this).each(checkChange);
|
3016
|
-
} else if(checkInputs[type]) {
|
3017
|
-
$(this).each(checkChange);
|
3018
|
-
}
|
3019
|
-
});
|
3020
|
-
|
3021
|
-
$(document).on('change', function(e){
|
3022
|
-
|
3023
|
-
if(checkInputs[e.target.type]){
|
3024
|
-
if(e.target.type == 'radio'){
|
3025
|
-
getGroupElements(e.target).each(checkChange);
|
3026
|
-
} else {
|
3027
|
-
$(e.target)[$.prop(e.target, 'checked') ? 'addClass' : 'removeClass']('prop-checked');
|
3028
|
-
}
|
3029
|
-
} else if(e.target.nodeName.toLowerCase() == 'select'){
|
3030
|
-
$(e.target).each(selectChange);
|
3031
|
-
}
|
3032
|
-
});
|
3033
|
-
|
3034
|
-
webshims.addReady(function(context, contextElem){
|
3035
|
-
$('option, input', context)
|
3036
|
-
.add(contextElem.filter('option, input'))
|
3037
|
-
.each(function(){
|
3038
|
-
var prop;
|
3039
|
-
if(checkInputs[this.type]){
|
3040
|
-
prop = 'checked';
|
3041
|
-
} else if(this.nodeName.toLowerCase() == 'option'){
|
3042
|
-
prop = 'selected';
|
3043
|
-
}
|
3044
|
-
if(prop){
|
3045
|
-
$(this)[$.prop(this, prop) ? 'addClass' : 'removeClass']('prop-checked');
|
3046
|
-
}
|
3047
|
-
|
3048
|
-
})
|
3049
|
-
;
|
3050
|
-
});
|
3051
|
-
})();
|
3052
|
-
}
|
3053
|
-
|
3054
|
-
(function(){
|
3055
|
-
var bustedPlaceholder;
|
3056
|
-
Modernizr.textareaPlaceholder = !!('placeholder' in $('<textarea />')[0]);
|
3057
|
-
if(Modernizr.input.placeholder && options.overridePlaceholder){
|
3058
|
-
bustedPlaceholder = true;
|
3059
|
-
}
|
3060
|
-
if(Modernizr.input.placeholder && Modernizr.textareaPlaceholder && !bustedPlaceholder){
|
3061
|
-
(function(){
|
3062
|
-
var ua = navigator.userAgent;
|
3063
|
-
|
3064
|
-
if(ua.indexOf('Mobile') != -1 && ua.indexOf('Safari') != -1){
|
3065
|
-
$(window).on('orientationchange', (function(){
|
3066
|
-
var timer;
|
3067
|
-
var retVal = function(i, value){
|
3068
|
-
return value;
|
3069
|
-
};
|
3070
|
-
|
3071
|
-
var set = function(){
|
3072
|
-
$('input[placeholder], textarea[placeholder]').attr('placeholder', retVal);
|
3073
|
-
};
|
3074
|
-
return function(e){
|
3075
|
-
clearTimeout(timer);
|
3076
|
-
timer = setTimeout(set, 9);
|
3077
|
-
};
|
3078
|
-
})());
|
3079
|
-
}
|
3080
|
-
})();
|
3081
|
-
|
3082
|
-
//abort
|
3083
|
-
return;
|
3084
|
-
}
|
3085
|
-
|
3086
|
-
var isOver = (webshims.cfg.forms.placeholderType == 'over');
|
3087
|
-
var isResponsive = (webshims.cfg.forms.responsivePlaceholder);
|
3088
|
-
var polyfillElements = ['textarea'];
|
3089
|
-
var debug = webshims.debug !== false;
|
3090
|
-
if(!Modernizr.input.placeholder || bustedPlaceholder){
|
3091
|
-
polyfillElements.push('input');
|
3092
|
-
}
|
3093
|
-
|
3094
|
-
var setSelection = function(elem){
|
3095
|
-
try {
|
3096
|
-
if(elem.setSelectionRange){
|
3097
|
-
elem.setSelectionRange(0, 0);
|
3098
|
-
return true;
|
3099
|
-
} else if(elem.createTextRange){
|
3100
|
-
var range = elem.createTextRange();
|
3101
|
-
range.collapse(true);
|
3102
|
-
range.moveEnd('character', 0);
|
3103
|
-
range.moveStart('character', 0);
|
3104
|
-
range.select();
|
3105
|
-
return true;
|
3106
|
-
}
|
3107
|
-
} catch(er){}
|
3108
|
-
};
|
3109
|
-
|
3110
|
-
var hidePlaceholder = function(elem, data, value, _onFocus){
|
3111
|
-
if(value === false){
|
3112
|
-
value = $.prop(elem, 'value');
|
3113
|
-
}
|
3114
|
-
|
3115
|
-
if(!isOver && elem.type != 'password'){
|
3116
|
-
if(!value && _onFocus && setSelection(elem)){
|
3117
|
-
var selectTimer = setTimeout(function(){
|
3118
|
-
setSelection(elem);
|
3119
|
-
}, 9);
|
3120
|
-
$(elem)
|
3121
|
-
.off('.placeholderremove')
|
3122
|
-
.on({
|
3123
|
-
'keydown.placeholderremove keypress.placeholderremove paste.placeholderremove input.placeholderremove': function(e){
|
3124
|
-
if(e && (e.keyCode == 17 || e.keyCode == 16)){return;}
|
3125
|
-
elem.value = $.prop(elem, 'value');
|
3126
|
-
data.box.removeClass('placeholder-visible');
|
3127
|
-
clearTimeout(selectTimer);
|
3128
|
-
$(elem).unbind('.placeholderremove');
|
3129
|
-
},
|
3130
|
-
'mousedown.placeholderremove drag.placeholderremove select.placeholderremove': function(e){
|
3131
|
-
setSelection(elem);
|
3132
|
-
clearTimeout(selectTimer);
|
3133
|
-
selectTimer = setTimeout(function(){
|
3134
|
-
setSelection(elem);
|
3135
|
-
}, 9);
|
3136
|
-
},
|
3137
|
-
'blur.placeholderremove': function(){
|
3138
|
-
clearTimeout(selectTimer);
|
3139
|
-
$(elem).unbind('.placeholderremove');
|
3140
|
-
}
|
3141
|
-
})
|
3142
|
-
;
|
3143
|
-
return;
|
3144
|
-
} else if(!_onFocus && !value && elem.value){ //especially on submit
|
3145
|
-
elem.value = value;
|
3146
|
-
}
|
3147
|
-
} else if(!value && _onFocus){
|
3148
|
-
$(elem)
|
3149
|
-
.off('.placeholderremove')
|
3150
|
-
.on({
|
3151
|
-
'keydown.placeholderremove keypress.placeholderremove paste.placeholderremove input.placeholderremove': function(e){
|
3152
|
-
if(e && (e.keyCode == 17 || e.keyCode == 16)){return;}
|
3153
|
-
data.box.removeClass('placeholder-visible');
|
3154
|
-
$(elem).unbind('.placeholderremove');
|
3155
|
-
},
|
3156
|
-
'blur.placeholderremove': function(){
|
3157
|
-
$(elem).unbind('.placeholderremove');
|
3158
|
-
}
|
3159
|
-
})
|
3160
|
-
;
|
3161
|
-
return;
|
3162
|
-
}
|
3163
|
-
data.box.removeClass('placeholder-visible');
|
3164
|
-
},
|
3165
|
-
showPlaceholder = function(elem, data, placeholderTxt){
|
3166
|
-
if(placeholderTxt === false){
|
3167
|
-
placeholderTxt = $.prop(elem, 'placeholder');
|
3168
|
-
}
|
3169
|
-
|
3170
|
-
if(!isOver && elem.type != 'password'){
|
3171
|
-
elem.value = placeholderTxt;
|
3172
|
-
}
|
3173
|
-
data.box.addClass('placeholder-visible');
|
3174
|
-
},
|
3175
|
-
changePlaceholderVisibility = function(elem, value, placeholderTxt, data, type){
|
3176
|
-
if(!data){
|
3177
|
-
data = $.data(elem, 'placeHolder');
|
3178
|
-
if(!data){return;}
|
3179
|
-
}
|
3180
|
-
var isVisible = $(elem).hasClass('placeholder-visible');
|
3181
|
-
if(placeholderTxt === false){
|
3182
|
-
placeholderTxt = $.attr(elem, 'placeholder') || '';
|
3183
|
-
}
|
3184
|
-
|
3185
|
-
$(elem).unbind('.placeholderremove');
|
3186
|
-
|
3187
|
-
if(value === false){
|
3188
|
-
value = $.prop(elem, 'value');
|
3189
|
-
}
|
3190
|
-
|
3191
|
-
if(!value && (type == 'focus' || (!type && $(elem).is(':focus')))){
|
3192
|
-
if(elem.type == 'password' || isOver || isVisible){
|
3193
|
-
hidePlaceholder(elem, data, '', true);
|
3194
|
-
}
|
3195
|
-
return;
|
3196
|
-
}
|
3197
|
-
|
3198
|
-
if(value){
|
3199
|
-
hidePlaceholder(elem, data, value);
|
3200
|
-
return;
|
3201
|
-
}
|
3202
|
-
|
3203
|
-
if(placeholderTxt && !value){
|
3204
|
-
showPlaceholder(elem, data, placeholderTxt);
|
3205
|
-
} else {
|
3206
|
-
hidePlaceholder(elem, data, value);
|
3207
|
-
}
|
3208
|
-
},
|
3209
|
-
hasLabel = function(elem){
|
3210
|
-
elem = $(elem);
|
3211
|
-
return !!(elem.prop('title') || elem.attr('aria-labelledby') || elem.attr('aria-label') || elem.jProp('labels').length);
|
3212
|
-
},
|
3213
|
-
createPlaceholder = function(elem){
|
3214
|
-
elem = $(elem);
|
3215
|
-
return $( hasLabel(elem) ? '<span class="placeholder-text"></span>' : '<label for="'+ elem.prop('id') +'" class="placeholder-text"></label>');
|
3216
|
-
},
|
3217
|
-
pHolder = (function(){
|
3218
|
-
var delReg = /\n|\r|\f|\t/g,
|
3219
|
-
allowedPlaceholder = {
|
3220
|
-
text: 1,
|
3221
|
-
search: 1,
|
3222
|
-
url: 1,
|
3223
|
-
email: 1,
|
3224
|
-
password: 1,
|
3225
|
-
tel: 1,
|
3226
|
-
number: 1
|
3227
|
-
}
|
3228
|
-
;
|
3229
|
-
|
3230
|
-
if(modules["form-number-date-ui"].loaded){
|
3231
|
-
delete allowedPlaceholder.number;
|
3232
|
-
}
|
3233
|
-
|
3234
|
-
return {
|
3235
|
-
create: function(elem){
|
3236
|
-
var data = $.data(elem, 'placeHolder');
|
3237
|
-
var form;
|
3238
|
-
var responsiveElem;
|
3239
|
-
if(data){return data;}
|
3240
|
-
data = $.data(elem, 'placeHolder', {});
|
3241
|
-
|
3242
|
-
$(elem).on('focus.placeholder blur.placeholder', function(e){
|
3243
|
-
changePlaceholderVisibility(this, false, false, data, e.type );
|
3244
|
-
data.box[e.type == 'focus' ? 'addClass' : 'removeClass']('placeholder-focused');
|
3245
|
-
});
|
3246
|
-
|
3247
|
-
if((form = $.prop(elem, 'form'))){
|
3248
|
-
$(elem).onWSOff('reset.placeholder', function(e){
|
3249
|
-
setTimeout(function(){
|
3250
|
-
changePlaceholderVisibility(elem, false, false, data, e.type );
|
3251
|
-
}, 0);
|
3252
|
-
}, false, form);
|
3253
|
-
}
|
3254
|
-
|
3255
|
-
if(elem.type == 'password' || isOver){
|
3256
|
-
data.text = createPlaceholder(elem);
|
3257
|
-
if(isResponsive || $(elem).is('.responsive-width') || (elem.currentStyle || {width: ''}).width.indexOf('%') != -1){
|
3258
|
-
responsiveElem = true;
|
3259
|
-
data.box = data.text;
|
3260
|
-
} else {
|
3261
|
-
data.box = $(elem)
|
3262
|
-
.wrap('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />')
|
3263
|
-
.parent()
|
3264
|
-
;
|
3265
|
-
}
|
3266
|
-
data.text
|
3267
|
-
.insertAfter(elem)
|
3268
|
-
.on('mousedown.placeholder', function(){
|
3269
|
-
changePlaceholderVisibility(this, false, false, data, 'focus');
|
3270
|
-
try {
|
3271
|
-
setTimeout(function(){
|
3272
|
-
elem.focus();
|
3273
|
-
}, 0);
|
3274
|
-
} catch(e){}
|
3275
|
-
return false;
|
3276
|
-
})
|
3277
|
-
;
|
3278
|
-
|
3279
|
-
|
3280
|
-
$.each(['lineHeight', 'fontSize', 'fontFamily', 'fontWeight'], function(i, style){
|
3281
|
-
var prop = $.css(elem, style);
|
3282
|
-
if(data.text.css(style) != prop){
|
3283
|
-
data.text.css(style, prop);
|
3284
|
-
}
|
3285
|
-
});
|
3286
|
-
$.each(['Left', 'Top'], function(i, side){
|
3287
|
-
var size = (parseInt($.css(elem, 'padding'+ side), 10) || 0) + Math.max((parseInt($.css(elem, 'margin'+ side), 10) || 0), 0) + (parseInt($.css(elem, 'border'+ side +'Width'), 10) || 0);
|
3288
|
-
data.text.css('padding'+ side, size);
|
3289
|
-
});
|
3290
|
-
|
3291
|
-
$(elem)
|
3292
|
-
.onWSOff('updateshadowdom', function(){
|
3293
|
-
var height, width;
|
3294
|
-
if((width = elem.offsetWidth) || (height = elem.offsetHeight)){
|
3295
|
-
data.text
|
3296
|
-
.css({
|
3297
|
-
width: width,
|
3298
|
-
height: height
|
3299
|
-
})
|
3300
|
-
.css($(elem).position())
|
3301
|
-
;
|
3302
|
-
}
|
3303
|
-
}, true)
|
3304
|
-
;
|
3305
|
-
|
3306
|
-
} else {
|
3307
|
-
var reset = function(e){
|
3308
|
-
if($(elem).hasClass('placeholder-visible')){
|
3309
|
-
hidePlaceholder(elem, data, '');
|
3310
|
-
|
3311
|
-
setTimeout(function(){
|
3312
|
-
if(!e || e.type != 'submit' || e.isDefaultPrevented()){
|
3313
|
-
changePlaceholderVisibility(elem, false, false, data );
|
3314
|
-
}
|
3315
|
-
}, 9);
|
3316
|
-
}
|
3317
|
-
};
|
3318
|
-
|
3319
|
-
$(elem).onWSOff('beforeunload', reset, false, window);
|
3320
|
-
data.box = $(elem);
|
3321
|
-
if(form){
|
3322
|
-
$(elem).onWSOff('submit', reset, false, form);
|
3323
|
-
}
|
3324
|
-
}
|
3325
|
-
|
3326
|
-
return data;
|
3327
|
-
},
|
3328
|
-
update: function(elem, val){
|
3329
|
-
var type = ($.attr(elem, 'type') || $.prop(elem, 'type') || '').toLowerCase();
|
3330
|
-
if(!allowedPlaceholder[type] && !$.nodeName(elem, 'textarea')){
|
3331
|
-
webshims.warn('placeholder not allowed on input[type="'+type+'"], but it is a good fallback :-)');
|
3332
|
-
return;
|
3333
|
-
}
|
3334
|
-
|
3335
|
-
|
3336
|
-
var data = pHolder.create(elem);
|
3337
|
-
if(data.text){
|
3338
|
-
data.text.text(val);
|
3339
|
-
}
|
3340
|
-
|
3341
|
-
changePlaceholderVisibility(elem, false, val, data);
|
3342
|
-
}
|
3343
|
-
};
|
3344
|
-
})()
|
3345
|
-
;
|
3346
|
-
|
3347
|
-
$.webshims.publicMethods = {
|
3348
|
-
pHolder: pHolder
|
3349
|
-
};
|
3350
|
-
polyfillElements.forEach(function(nodeName){
|
3351
|
-
var desc = webshims.defineNodeNameProperty(nodeName, 'placeholder', {
|
3352
|
-
attr: {
|
3353
|
-
set: function(val){
|
3354
|
-
var elem = this;
|
3355
|
-
if(bustedPlaceholder){
|
3356
|
-
webshims.data(elem, 'bustedPlaceholder', val);
|
3357
|
-
elem.placeholder = '';
|
3358
|
-
} else {
|
3359
|
-
webshims.contentAttr(elem, 'placeholder', val);
|
3360
|
-
}
|
3361
|
-
pHolder.update(elem, val);
|
3362
|
-
},
|
3363
|
-
get: function(){
|
3364
|
-
var placeholder;
|
3365
|
-
if(bustedPlaceholder){
|
3366
|
-
placeholder = webshims.data(this, 'bustedPlaceholder');
|
3367
|
-
}
|
3368
|
-
return placeholder || webshims.contentAttr(this, 'placeholder');
|
3369
|
-
}
|
3370
|
-
},
|
3371
|
-
reflect: true,
|
3372
|
-
initAttr: true
|
3373
|
-
});
|
3374
|
-
});
|
3375
|
-
|
3376
|
-
|
3377
|
-
polyfillElements.forEach(function(name){
|
3378
|
-
var placeholderValueDesc = {};
|
3379
|
-
var desc;
|
3380
|
-
['attr', 'prop'].forEach(function(propType){
|
3381
|
-
placeholderValueDesc[propType] = {
|
3382
|
-
set: function(val){
|
3383
|
-
var elem = this;
|
3384
|
-
var placeholder;
|
3385
|
-
if(bustedPlaceholder){
|
3386
|
-
placeholder = webshims.data(elem, 'bustedPlaceholder');
|
3387
|
-
}
|
3388
|
-
if(!placeholder){
|
3389
|
-
placeholder = webshims.contentAttr(elem, 'placeholder');
|
3390
|
-
}
|
3391
|
-
$.removeData(elem, 'cachedValidity');
|
3392
|
-
var ret = desc[propType]._supset.call(elem, val);
|
3393
|
-
if(placeholder && 'value' in elem){
|
3394
|
-
changePlaceholderVisibility(elem, val, placeholder);
|
3395
|
-
}
|
3396
|
-
return ret;
|
3397
|
-
},
|
3398
|
-
get: function(){
|
3399
|
-
var elem = this;
|
3400
|
-
return $(elem).hasClass('placeholder-visible') ? '' : desc[propType]._supget.call(elem);
|
3401
|
-
}
|
3402
|
-
};
|
3403
|
-
});
|
3404
|
-
desc = webshims.defineNodeNameProperty(name, 'value', placeholderValueDesc);
|
3405
|
-
});
|
3406
|
-
|
3407
|
-
})();
|
3408
|
-
|
3409
|
-
(function(){
|
3410
|
-
var doc = document;
|
3411
|
-
if( 'value' in document.createElement('output') ){return;}
|
3412
|
-
|
3413
|
-
webshims.defineNodeNameProperty('output', 'value', {
|
3414
|
-
prop: {
|
3415
|
-
set: function(value){
|
3416
|
-
var setVal = $.data(this, 'outputShim');
|
3417
|
-
if(!setVal){
|
3418
|
-
setVal = outputCreate(this);
|
3419
|
-
}
|
3420
|
-
setVal(value);
|
3421
|
-
},
|
3422
|
-
get: function(){
|
3423
|
-
return webshims.contentAttr(this, 'value') || $(this).text() || '';
|
3424
|
-
}
|
3425
|
-
}
|
3426
|
-
});
|
3427
|
-
|
3428
|
-
|
3429
|
-
webshims.onNodeNamesPropertyModify('input', 'value', function(value, boolVal, type){
|
3430
|
-
if(type == 'removeAttr'){return;}
|
3431
|
-
var setVal = $.data(this, 'outputShim');
|
3432
|
-
if(setVal){
|
3433
|
-
setVal(value);
|
3434
|
-
}
|
3435
|
-
});
|
3436
|
-
|
3437
|
-
var outputCreate = function(elem){
|
3438
|
-
if(elem.getAttribute('aria-live')){return;}
|
3439
|
-
elem = $(elem);
|
3440
|
-
var value = (elem.text() || '').trim();
|
3441
|
-
var id = elem.prop('id');
|
3442
|
-
var htmlFor = elem.attr('for');
|
3443
|
-
var shim = $('<input class="output-shim" type="text" disabled name="'+ (elem.attr('name') || '')+'" value="'+value+'" style="display: none !important;" />').insertAfter(elem);
|
3444
|
-
var form = shim[0].form || doc;
|
3445
|
-
var setValue = function(val){
|
3446
|
-
shim[0].value = val;
|
3447
|
-
val = shim[0].value;
|
3448
|
-
elem.text(val);
|
3449
|
-
webshims.contentAttr(elem[0], 'value', val);
|
3450
|
-
};
|
3451
|
-
|
3452
|
-
elem[0].defaultValue = value;
|
3453
|
-
webshims.contentAttr(elem[0], 'value', value);
|
3454
|
-
|
3455
|
-
elem.attr({'aria-live': 'polite'});
|
3456
|
-
if(id){
|
3457
|
-
shim.attr('id', id);
|
3458
|
-
elem.attr('aria-labelledby', elem.jProp('labels').map(function(){
|
3459
|
-
return webshims.getID(this);
|
3460
|
-
}).get().join(' '));
|
3461
|
-
}
|
3462
|
-
if(htmlFor){
|
3463
|
-
id = webshims.getID(elem);
|
3464
|
-
htmlFor.split(' ').forEach(function(control){
|
3465
|
-
control = document.getElementById(control);
|
3466
|
-
if(control){
|
3467
|
-
control.setAttribute('aria-controls', id);
|
3468
|
-
}
|
3469
|
-
});
|
3470
|
-
}
|
3471
|
-
elem.data('outputShim', setValue );
|
3472
|
-
shim.data('outputShim', setValue );
|
3473
|
-
return setValue;
|
3474
|
-
};
|
3475
|
-
|
3476
|
-
webshims.addReady(function(context, contextElem){
|
3477
|
-
$('output', context).add(contextElem.filter('output')).each(function(){
|
3478
|
-
outputCreate(this);
|
3479
|
-
});
|
3480
|
-
});
|
3481
|
-
|
3482
|
-
/*
|
3483
|
-
* Implements input event in all browsers
|
3484
|
-
*/
|
3485
|
-
(function(){
|
3486
|
-
var noInputTriggerEvts = {updateInput: 1, input: 1},
|
3487
|
-
noInputTypes = {
|
3488
|
-
radio: 1,
|
3489
|
-
checkbox: 1,
|
3490
|
-
submit: 1,
|
3491
|
-
button: 1,
|
3492
|
-
image: 1,
|
3493
|
-
reset: 1,
|
3494
|
-
file: 1
|
3495
|
-
|
3496
|
-
//pro forma
|
3497
|
-
,color: 1
|
3498
|
-
//,range: 1
|
3499
|
-
},
|
3500
|
-
observe = function(input){
|
3501
|
-
var timer,
|
3502
|
-
lastVal = input.prop('value'),
|
3503
|
-
trigger = function(e){
|
3504
|
-
//input === null
|
3505
|
-
if(!input){return;}
|
3506
|
-
var newVal = input.prop('value');
|
3507
|
-
if(newVal !== lastVal){
|
3508
|
-
lastVal = newVal;
|
3509
|
-
if(!e || !noInputTriggerEvts[e.type]){
|
3510
|
-
webshims.triggerInlineForm && webshims.triggerInlineForm(input[0], 'input');
|
3511
|
-
}
|
3512
|
-
}
|
3513
|
-
},
|
3514
|
-
extraTimer,
|
3515
|
-
extraTest = function(){
|
3516
|
-
clearTimeout(extraTimer);
|
3517
|
-
extraTimer = setTimeout(trigger, 9);
|
3518
|
-
},
|
3519
|
-
unbind = function(){
|
3520
|
-
input.unbind('focusout', unbind).unbind('keyup keypress keydown paste cut', extraTest).unbind('input change updateInput', trigger);
|
3521
|
-
clearInterval(timer);
|
3522
|
-
setTimeout(function(){
|
3523
|
-
trigger();
|
3524
|
-
input = null;
|
3525
|
-
}, 1);
|
3526
|
-
|
3527
|
-
}
|
3528
|
-
;
|
3529
|
-
|
3530
|
-
clearInterval(timer);
|
3531
|
-
timer = setInterval(trigger, 200);
|
3532
|
-
extraTest();
|
3533
|
-
input.on({
|
3534
|
-
'keyup keypress keydown paste cut': extraTest,
|
3535
|
-
focusout: unbind,
|
3536
|
-
'input updateInput change': trigger
|
3537
|
-
});
|
3538
|
-
}
|
3539
|
-
;
|
3540
|
-
|
3541
|
-
$(doc)
|
3542
|
-
.on('focusin', function(e){
|
3543
|
-
if( e.target && !e.target.readOnly && !e.target.disabled && (e.target.nodeName || '').toLowerCase() == 'input' && !noInputTypes[e.target.type] && !(webshims.data(e.target, 'implemented') || {}).inputwidgets){
|
3544
|
-
observe($(e.target));
|
3545
|
-
}
|
3546
|
-
})
|
3547
|
-
;
|
3548
|
-
})();
|
3549
|
-
})();
|
3550
|
-
|
3551
|
-
}); //webshims.ready end
|
3552
|
-
}//end formvalidation
|
3553
|
-
|
3554
|
-
webshims.register('form-message', function($, webshims, window, document, undefined, options){
|
3555
|
-
"use strict";
|
3556
|
-
if(options.lazyCustomMessages){
|
3557
|
-
options.customMessages = true;
|
3558
|
-
}
|
3559
|
-
var validityMessages = webshims.validityMessages;
|
3560
|
-
|
3561
|
-
var implementProperties = options.customMessages ? ['customValidationMessage'] : [];
|
2519
|
+
var implementProperties = options.customMessages ? ['customValidationMessage'] : [];
|
3562
2520
|
|
3563
2521
|
validityMessages.en = $.extend(true, {
|
3564
2522
|
typeMismatch: {
|
@@ -3819,12 +2777,12 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
|
|
3819
2777
|
/*
|
3820
2778
|
* implement propType "element" currently only used for list-attribute (will be moved to dom-extend, if needed)
|
3821
2779
|
*/
|
3822
|
-
webshims.propTypes.element = function(descs){
|
2780
|
+
webshims.propTypes.element = function(descs, name){
|
3823
2781
|
webshims.createPropDefault(descs, 'attr');
|
3824
2782
|
if(descs.prop){return;}
|
3825
2783
|
descs.prop = {
|
3826
2784
|
get: function(){
|
3827
|
-
var elem = $.attr(this,
|
2785
|
+
var elem = $.attr(this, name);
|
3828
2786
|
if(elem){
|
3829
2787
|
elem = document.getElementById(elem);
|
3830
2788
|
if(elem && descs.propNodeName && !$.nodeName(elem, descs.propNodeName)){
|
@@ -3848,7 +2806,15 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
|
|
3848
2806
|
if(listSupport && !formsCFG.customDatalist){return;}
|
3849
2807
|
|
3850
2808
|
var initializeDatalist = function(){
|
3851
|
-
|
2809
|
+
|
2810
|
+
var updateDatlistAndOptions = function(){
|
2811
|
+
var id;
|
2812
|
+
if(!$.data(this, 'datalistWidgetData') && (id = $.prop(this, 'id'))){
|
2813
|
+
$('input[list="'+ id +'"], input[data-wslist="'+ id +'"]').eq(0).attr('list', id);
|
2814
|
+
} else {
|
2815
|
+
$(this).triggerHandler('updateDatalist');
|
2816
|
+
}
|
2817
|
+
};
|
3852
2818
|
|
3853
2819
|
var inputListProto = {
|
3854
2820
|
//override autocomplete
|
@@ -3926,6 +2892,7 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
|
|
3926
2892
|
id: value,
|
3927
2893
|
datalist: $.prop(elem, 'list')
|
3928
2894
|
});
|
2895
|
+
elem.setAttribute('data-wslist', value);
|
3929
2896
|
} else {
|
3930
2897
|
elem.setAttribute('list', value);
|
3931
2898
|
}
|
@@ -3937,6 +2904,27 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
|
|
3937
2904
|
propType: 'element',
|
3938
2905
|
propNodeName: 'datalist'
|
3939
2906
|
};
|
2907
|
+
} else {
|
2908
|
+
webshims.defineNodeNameProperties('input', {
|
2909
|
+
list: {
|
2910
|
+
attr: {
|
2911
|
+
get: function(){
|
2912
|
+
var val = webshims.contentAttr(this, 'list');
|
2913
|
+
return (val == null) ? undefined : val;
|
2914
|
+
},
|
2915
|
+
set: function(value){
|
2916
|
+
var elem = this;
|
2917
|
+
webshims.contentAttr(elem, 'list', value);
|
2918
|
+
webshims.objectCreate(options.shadowListProto, undefined, {input: elem, id: value, datalist: $.prop(elem, 'list')});
|
2919
|
+
$(elem).triggerHandler('listdatalistchange');
|
2920
|
+
}
|
2921
|
+
},
|
2922
|
+
initAttr: true,
|
2923
|
+
reflect: true,
|
2924
|
+
propType: 'element',
|
2925
|
+
propNodeName: 'datalist'
|
2926
|
+
}
|
2927
|
+
});
|
3940
2928
|
}
|
3941
2929
|
|
3942
2930
|
webshims.defineNodeNameProperties('input', inputListProto);
|
@@ -3945,9 +2933,7 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
|
|
3945
2933
|
contextElem
|
3946
2934
|
.filter('datalist > select, datalist, datalist > option, datalist > select > option')
|
3947
2935
|
.closest('datalist')
|
3948
|
-
.each(
|
3949
|
-
$(this).triggerHandler('updateDatalist');
|
3950
|
-
})
|
2936
|
+
.each(updateDatlistAndOptions)
|
3951
2937
|
;
|
3952
2938
|
});
|
3953
2939
|
};
|
@@ -3992,6 +2978,7 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
|
|
3992
2978
|
this.hasViewableData = true;
|
3993
2979
|
this._autocomplete = $.attr(opts.input, 'autocomplete');
|
3994
2980
|
$.data(opts.input, 'datalistWidget', this);
|
2981
|
+
$.data(datalist, 'datalistWidgetData', this);
|
3995
2982
|
|
3996
2983
|
lazyLoad('WINDOWLOAD');
|
3997
2984
|
|