diff --git a/Gemfile.lock b/Gemfile.lock index e07c1d58988e3a29fba98a7a550c3fb820544df1..9c56b5d738fd9a7db5f2efd2fc3f01f3b28a7b15 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -290,7 +290,7 @@ GEM warden (1.2.3) rack (>= 1.0) webrick (1.3.1) - webshims-rails (1.14.4) + webshims-rails (1.14.5) rails (> 3.1.0) PLATFORMS diff --git a/public/webshims/polyfiller.js b/public/webshims/polyfiller.js index ff5a555b288404cd6086639929787f6b35e05f80..195268376c1b412cce5e647a7e5cbf297f1be623 100644 --- a/public/webshims/polyfiller.js +++ b/public/webshims/polyfiller.js @@ -104,6 +104,11 @@ var getAutoEnhance = function(prop){ return !webCFG.enhanceAuto && prop == 'auto' ? false : prop; }; + var featureAlias = { + matchmedia: 'matchMedia', + xhr2: 'filereader', + promise: 'es6' + }; clearInterval(webshims.timer); support.advancedObjectProperties = support.objectAccessor = support.ES5 = !!('create' in Object && 'seal' in Object); @@ -121,7 +126,7 @@ } $.extend(webshims, { - version: '1.14.4', + version: '1.14.5', cfg: { enhanceAuto: window.Audio && (!window.matchMedia || matchMedia('(min-device-width: 721px)').matches), @@ -244,12 +249,9 @@ } $.each(features, function(i, feature){ - if(feature == 'xhr2'){ - feature = 'filereader'; - } - if(feature == 'promise'){ - feature = 'es6'; - } + + feature = featureAlias[feature] || feature; + if(!webshimsFeatures[feature]){ WSDEBUG && webshims.error("could not find webshims-feature (aborted): "+ feature); isReady(feature, true); @@ -1010,7 +1012,7 @@ support.inputtypes = inputtypes; - $.each(['number', 'range', 'date', 'datetime-local', 'month', 'color'], function(i, type){ + $.each(['range', 'date', 'datetime-local', 'month', 'color', 'number'], function(i, type){ input.setAttribute('type', type); inputtypes[type] = (input.type == type && (input.value = '(') && input.value != '('); }); @@ -1026,7 +1028,7 @@ try { if(fieldset.querySelector(':invalid')){ fieldset.disabled = true; - tmp = !fieldset.querySelector(':invalid'); + tmp = !fieldset.querySelector(':invalid') && fieldset.querySelector(':disabled'); } } catch(er){} support.fieldsetdisabled = !!tmp; @@ -1035,15 +1037,39 @@ if(support[formvalidation]){ bustedWidgetUi = !support.fieldsetdisabled || !support.fieldsetelements || !('value' in progress) || !('value' in output); replaceBustedUI = bustedWidgetUi && (/Android/i).test(navigator.userAgent); - bugs.bustedValidity = bustedValidity = window.opera || bugs.bustedValidity || bustedWidgetUi || !support.datalist; - } else { - bugs.bustedValidity = false; + bustedValidity = window.opera || bugs.bustedValidity || bustedWidgetUi || !support.datalist; + + if(!bustedValidity && inputtypes.number){ + bustedValidity = true; + try { + input.type = 'number'; + input.value = ''; + input.stepUp(); + bustedValidity = input.value != '1'; + } catch(e){} + } + } + bugs.bustedValidity = bustedValidity; + formExtend = support[formvalidation] && !bustedValidity ? 'form-native-extend' : fShim; initialFormTest = $.noop; return false; }; + var typeTest = function(o){ + var ret = true; + if(!o._types){ + o._types = o.types.split(' '); + } + $.each(o._types, function(i, name){ + if((name in inputtypes) && !inputtypes[name]){ + ret = false; + return false; + } + }); + return ret; + }; webshims.validationMessages = webshims.validityMessages = { @@ -1129,19 +1155,13 @@ types: 'date time range number' }, test: function(){ - var ret = true; - var o = this.options; - if(!o._types){ - o._types = o.types.split(' '); - } initialFormTest(); - $.each(o._types, function(i, name){ - if((name in inputtypes) && !inputtypes[name]){ - ret = false; - return false; - } - }); - + var ret = !bustedValidity; + + if(ret){ + ret = typeTest(this.options); + } + return ret; }, methodNames: ['stepUp', 'stepDown'], @@ -1169,7 +1189,7 @@ if(!o.replaceUI && replaceBustedUI){ o.replaceUI = true; } - return !o.replaceUI && modules[fNuAPI].test(); + return !o.replaceUI && typeTest(o); }, d: ['forms', DOMSUPPORT, fNuAPI, 'range-ui'], options: { @@ -1177,7 +1197,6 @@ calculateWidth: true, animate: true } - // ,replaceUI: false }, c: [6, 5, 9, 10, 17, 11] }); diff --git a/public/webshims/shims/combos/1.js b/public/webshims/shims/combos/1.js index fe985ac2fcf70175ce41c5e9856ad036c5433ab1..c9d3cb750d6970cd23cc60bdb3323b3f26b33a4b 100644 --- a/public/webshims/shims/combos/1.js +++ b/public/webshims/shims/combos/1.js @@ -250,6 +250,9 @@ webshims.isReady('swfmini', true); }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -264,7 +267,6 @@ webshims.isReady('swfmini', true); toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -321,11 +323,11 @@ webshims.isReady('swfmini', true); }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -504,8 +506,7 @@ webshims.isReady('swfmini', true); }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -536,6 +537,14 @@ webshims.isReady('swfmini', true); }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;(function(webshims){ "use strict"; @@ -1070,6 +1079,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/10.js b/public/webshims/shims/combos/10.js index 53bcdc832c7dd985d25383840f1b394cb2f5fe86..c75e0de94226b9347cc381d6e053a4ce35306fc2 100644 --- a/public/webshims/shims/combos/10.js +++ b/public/webshims/shims/combos/10.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -2015,9 +2016,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -3675,7 +3678,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -3705,28 +3708,28 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -3737,12 +3740,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/combos/11.js b/public/webshims/shims/combos/11.js index 5cf4e07b8e8e28ddd4aad3aae673b9f2bfed1092..8cce4d98319a4706a82aeb345fa0deee0ab9a2f3 100644 --- a/public/webshims/shims/combos/11.js +++ b/public/webshims/shims/combos/11.js @@ -803,9 +803,11 @@ $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -2463,7 +2465,7 @@ }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -2493,28 +2495,28 @@ } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -2525,12 +2527,13 @@ ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/combos/12.js b/public/webshims/shims/combos/12.js index df50d5e5c5a034416ced92bdc661ce29d9a40237..a07ba6b8c39a69d5e89aaf2fa39348a7dd2d0209 100644 --- a/public/webshims/shims/combos/12.js +++ b/public/webshims/shims/combos/12.js @@ -754,6 +754,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/13.js b/public/webshims/shims/combos/13.js index d086575f600e54918dfa32fbba25f72d17443609..d255d0aeca2dab3b575e9fe5e480c101e8049c6b 100644 --- a/public/webshims/shims/combos/13.js +++ b/public/webshims/shims/combos/13.js @@ -531,6 +531,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/14.js b/public/webshims/shims/combos/14.js index b19bf9e00e368d8ada4bcee8b81f7c84093e6675..f9ad00e8a1dd2359f4d7c0a375868be6deb10778 100644 --- a/public/webshims/shims/combos/14.js +++ b/public/webshims/shims/combos/14.js @@ -553,7 +553,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); diff --git a/public/webshims/shims/combos/15.js b/public/webshims/shims/combos/15.js index 9c061c3f543f114a3ac2b36f80983568c4c95245..b6532e8468f3b2449fbd385cf1740bf81fa61a90 100644 --- a/public/webshims/shims/combos/15.js +++ b/public/webshims/shims/combos/15.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1493,8 +1496,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1525,6 +1527,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-shim-extend', function($, webshims, window, document, undefined, options){ "use strict"; @@ -1920,7 +1930,7 @@ var rsubmittable = /^(?:select|textarea|input)/i; ; return function(){ var elem = $(this).getNativeElement()[0]; - return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') ); + return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') ); }; })() }, diff --git a/public/webshims/shims/combos/16.js b/public/webshims/shims/combos/16.js index 51b3f0368ae44a481d7a3667f2e0745550648cd5..5d2dc1f6a6645dc44c0c42cc6a77ef4d8bfca804 100644 --- a/public/webshims/shims/combos/16.js +++ b/public/webshims/shims/combos/16.js @@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1716,8 +1719,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1748,6 +1750,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-shim-extend', function($, webshims, window, document, undefined, options){ "use strict"; @@ -2143,7 +2153,7 @@ var rsubmittable = /^(?:select|textarea|input)/i; ; return function(){ var elem = $(this).getNativeElement()[0]; - return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') ); + return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') ); }; })() }, @@ -3698,6 +3708,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/17.js b/public/webshims/shims/combos/17.js index c16af12f713fe5bbbf93dc419a0e70ca4ccb8bea..4693fb62779ce2ed0af5c571a9c9992684548bbc 100644 --- a/public/webshims/shims/combos/17.js +++ b/public/webshims/shims/combos/17.js @@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); @@ -1420,9 +1419,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -3080,7 +3081,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -3110,28 +3111,28 @@ webshims.register('form-number-date-api', function($, webshims, window, document } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -3142,12 +3143,13 @@ webshims.register('form-number-date-api', function($, webshims, window, document ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/combos/18.js b/public/webshims/shims/combos/18.js index c17ec71ad6ff0152fa63c17993a161622e3bf925..d7e6900e79491bc6b4cfe59db5d791ac976d4175 100644 --- a/public/webshims/shims/combos/18.js +++ b/public/webshims/shims/combos/18.js @@ -10,23 +10,65 @@ webshim.isReady('picture', true); setTimeout(function(){ - webshim.ready('matchMedia', function(){ - if(window.picturefill){ - var sel = 'picture, img[srcset]'; - webshim.addReady(function(context){ - if(context.querySelector(sel)){ - window.picturefill(); - } - }); - } - }); + if(window.picturefill){ + var sel = 'picture, img[srcset]'; + webshim.addReady(function(context){ + if(context.querySelector(sel)){ + window.picturefill(); + } + }); + } }); })(); - -/*! Picturefill - v2.1.0-beta - 2014-06-03 +/*! Picturefill - v2.1.0-beta - 2014-07-15 * http://scottjehl.github.io/picturefill * Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ +/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ + +window.matchMedia || (window.matchMedia = function() { + "use strict"; + + // For browsers that support matchMedium api such as IE 9 and webkit + var styleMedia = (window.styleMedia || window.media); + + // For those that don't support matchMedium + if (!styleMedia) { + var style = document.createElement('style'), + script = document.getElementsByTagName('script')[0], + info = null; + + style.type = 'text/css'; + style.id = 'matchmediajs-test'; + script.parentNode.insertBefore(style, script); + + // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers + info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; + + styleMedia = { + matchMedium: function(media) { + var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; + + // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers + if (style.styleSheet) { + style.styleSheet.cssText = text; + } else { + style.textContent = text; + } + + // Test if media query is true or false + return info.width === '1px'; + } + }; + } + + return function(media) { + return { + matches: styleMedia.matchMedium(media || 'all'), + media: media || 'all' + }; + }; +}()); /*! Picturefill - Responsive Images that work today. * Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar ) * License: MIT/GPLv2 @@ -38,6 +80,7 @@ // If picture is supported, well, that's awesome. Let's get outta here... if ( w.HTMLPictureElement ) { + w.picturefill = function() { }; return; } @@ -51,7 +94,8 @@ pf.ns = "picturefill"; // srcset support test - pf.srcsetSupported = new w.Image().srcset !== undefined; + pf.srcsetSupported = "srcset" in doc.createElement( "img" ); + pf.sizesSupported = w.HTMLImageElement.sizes; // just a string trim workaround pf.trim = function( str ) { @@ -82,8 +126,8 @@ * http://dev.w3.org/csswg/css-values-3/#length-value */ pf.getWidthFromLength = function( length ) { - // If no length was specified, or it is 0, default to `100vw` (per the spec). - length = length && parseFloat( length ) > 0 ? length : "100vw"; + // If no length was specified, or it is 0 or negative, default to `100vw` (per the spec). + length = length && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 ) ? length : "100vw"; /** * If length is specified in `vw` units, use `%` instead since the div we’re measuring @@ -101,7 +145,12 @@ // Positioning styles help prevent padding/margin/width on `html` from throwing calculations off. pf.lengthEl.style.cssText = "position: absolute; left: 0; width: " + length + ";"; - // Using offsetWidth to get width from CSS + + if ( pf.lengthEl.offsetWidth <= 0 ) { + // Something has gone wrong. `calc()` is in use and unsupported, most likely. Default to `100vw` (`100%`, for broader support.): + pf.lengthEl.style.cssText = "width: 100%;"; + } + return pf.lengthEl.offsetWidth; }; @@ -263,38 +312,32 @@ return candidates; }; - pf.parseDescriptor = function( descriptor, sizes ) { + pf.parseDescriptor = function( descriptor, sizesattr ) { // 11. Descriptor parser: Let candidates be an initially empty source set. The order of entries in the list // is the order in which entries are added to the list. - var sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""), - widthInCssPixels = sizes ? pf.findWidthFromSourceSize( sizes ) : "100%", + var sizes = sizesattr || "100vw", + sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""), + widthInCssPixels = pf.findWidthFromSourceSize( sizes ), resCandidate; if ( sizeDescriptor ) { var splitDescriptor = sizeDescriptor.split(" "); for (var i = splitDescriptor.length + 1; i >= 0; i--) { - - var curr = splitDescriptor[ i ], - lastchar = curr && curr.slice( curr.length - 1 ); - - if ( lastchar === "w" || lastchar === "x" ) { - resCandidate = curr; - } - if ( sizes && resCandidate ) { - // get the dpr by taking the length / width in css pixels - resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) ); - } else { - // get the dpr by grabbing the value of Nx - var res = curr && parseFloat( curr, 10 ); - - resCandidate = res && !isNaN( res ) && lastchar === "x" || lastchar === "w" ? res : 1; + if ( splitDescriptor[ i ] !== undefined ) { + var curr = splitDescriptor[ i ], + lastchar = curr && curr.slice( curr.length - 1 ); + + if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) { + resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) ); + } else if ( lastchar === "x" ) { + var res = curr && parseFloat( curr, 10 ); + resCandidate = res && !isNaN( res ) ? res : 1; + } } } - } else { - resCandidate = 1; } - return resCandidate; + return resCandidate || 1; }; /** @@ -372,7 +415,7 @@ } } - if ( !pf.endsWith( picImg.src, bestCandidate.url ) ) { + if ( bestCandidate && !pf.endsWith( picImg.src, bestCandidate.url ) ) { picImg.src = bestCandidate.url; // currentSrc attribute and property to match // http://picture.responsiveimages.org/#the-img-element @@ -405,32 +448,26 @@ }; /* - * Find all picture elements and, - * in browsers that don't natively support srcset, find all img elements - * with srcset attrs that don't have picture parents + * Find all `img` elements, and add them to the candidate list if they have + * a `picture` parent, a `sizes` attribute in basic `srcset` supporting browsers, + * a `srcset` attribute at all, and they haven’t been evaluated already. */ pf.getAllElements = function() { - var pictures = doc.getElementsByTagName( "picture" ), - elems = [], + var elems = [], imgs = doc.getElementsByTagName( "img" ); - for ( var h = 0, len = pictures.length + imgs.length; h < len; h++ ) { - if ( h < pictures.length ) { - elems[ h ] = pictures[ h ]; - } else { - var currImg = imgs[ h - pictures.length ]; + for ( var h = 0, len = imgs.length; h < len; h++ ) { + var currImg = imgs[ h ]; - if ( currImg.parentNode.nodeName.toUpperCase() !== "PICTURE" && - ( ( pf.srcsetSupported && currImg.getAttribute( "sizes" ) ) || - currImg.getAttribute( "srcset" ) !== null ) ) { - elems.push( currImg ); - } + if ( currImg.parentNode.nodeName.toUpperCase() === "PICTURE" || + ( currImg.getAttribute( "srcset" ) !== null ) || currImg[ pf.ns ] && currImg[ pf.ns ].srcset !== null ) { + elems.push( currImg ); } } return elems; }; - pf.getMatch = function( picture ) { + pf.getMatch = function( img, picture ) { var sources = picture.childNodes, match; @@ -443,9 +480,9 @@ continue; } - // Hitting an `img` element stops the search for `sources`. + // Hitting the `img` element that started everything stops the search for `sources`. // If no previous `source` matches, the `img` itself is evaluated later. - if ( source.nodeName.toUpperCase() === "IMG" ) { + if ( source === img ) { return match; } @@ -477,24 +514,22 @@ return match; }; - function picturefill( options ) { + function picturefill( opt ) { var elements, element, - elemType, + parent, firstMatch, candidates, - picImg; - options = options || {}; + options = opt || {}; elements = options.elements || pf.getAllElements(); // Loop through all elements for ( var i = 0, plen = elements.length; i < plen; i++ ) { element = elements[ i ]; - elemType = element.nodeName.toUpperCase(); + parent = element.parentNode; firstMatch = undefined; candidates = undefined; - picImg = undefined; // expando for caching data on the img if ( !element[ pf.ns ] ) { @@ -508,16 +543,16 @@ continue; } - // if element is a picture element - if ( elemType === "PICTURE" ) { + // if `img` is in a `picture` element + if ( parent.nodeName.toUpperCase() === "PICTURE" ) { // IE9 video workaround - pf.removeVideoShim( element ); + pf.removeVideoShim( parent ); // return the first match which might undefined // returns false if there is a pending source // TODO the return type here is brutal, cleanup - firstMatch = pf.getMatch( element ); + firstMatch = pf.getMatch( element, parent ); // if any sources are pending in this picture due to async type test(s) // remove the evaluated attr and skip for now ( the pending test will @@ -525,43 +560,32 @@ if ( firstMatch === false ) { continue; } - - // Find any existing img element in the picture element - picImg = element.getElementsByTagName( "img" )[ 0 ]; } else { - // if it's an img element firstMatch = undefined; - picImg = element; } - if ( picImg ) { - - // expando for caching data on the img - if ( !picImg[ pf.ns ] ) { - picImg[ pf.ns ] = {}; - } - - // Cache and remove `srcset` if present and we’re going to be doing `sizes`/`picture` polyfilling to it. - if ( picImg.srcset && ( elemType === "PICTURE" || picImg.getAttribute( "sizes" ) ) ) { - pf.dodgeSrcset( picImg ); - } - - if ( firstMatch ) { - candidates = pf.processSourceSet( firstMatch ); - pf.applyBestCandidate( candidates, picImg ); - } else { - // No sources matched, so we’re down to processing the inner `img` as a source. - candidates = pf.processSourceSet( picImg ); + // Cache and remove `srcset` if present and we’re going to be doing `picture`/`srcset`/`sizes` polyfilling to it. + if ( parent.nodeName.toUpperCase() === "PICTURE" || + ( element.srcset && !pf.srcsetSupported ) || + ( !pf.sizesSupported && ( element.srcset && element.srcset.indexOf("w") > -1 ) ) ) { + pf.dodgeSrcset( element ); + } - if ( picImg.srcset === undefined || picImg[ pf.ns ].srcset ) { - // Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality. - pf.applyBestCandidate( candidates, picImg ); - } // Else, resolution-only `srcset` is supported natively. - } + if ( firstMatch ) { + candidates = pf.processSourceSet( firstMatch ); + pf.applyBestCandidate( candidates, element ); + } else { + // No sources matched, so we’re down to processing the inner `img` as a source. + candidates = pf.processSourceSet( element ); - // set evaluated to true to avoid unnecessary reparsing - element[ pf.ns ].evaluated = true; + if ( element.srcset === undefined || element[ pf.ns ].srcset ) { + // Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality. + pf.applyBestCandidate( candidates, element ); + } // Else, resolution-only `srcset` is supported natively. } + + // set evaluated to true to avoid unnecessary reparsing + element[ pf.ns ].evaluated = true; } } @@ -596,7 +620,7 @@ } } - webshim.ready('matchMedia', runPicturefill); + runPicturefill(); /* expose methods for testing */ picturefill._ = pf; @@ -615,6 +639,7 @@ } )( this, this.document ); + ;/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ window.matchMedia || (window.matchMedia = function() { diff --git a/public/webshims/shims/combos/2.js b/public/webshims/shims/combos/2.js index d90e9e8b2e91371e2b5b2fc14499bc28bdc21edf..c3b8873f109a7f738615da0fbc60e21c2613ce33 100644 --- a/public/webshims/shims/combos/2.js +++ b/public/webshims/shims/combos/2.js @@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1716,8 +1719,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1748,6 +1750,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){ "use strict"; @@ -2579,6 +2589,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/21.js b/public/webshims/shims/combos/21.js index 1751efb6a65ee1e53fcc01788ecff5536bacb5f6..84afc847723e2103b70c72dbf3cd53df23e41b37 100644 --- a/public/webshims/shims/combos/21.js +++ b/public/webshims/shims/combos/21.js @@ -462,6 +462,7 @@ var onEvent = { onPlayPause: function(jaris, data, override){ var playing, type; + var idled = data.paused || data.ended; if(override == null){ try { playing = data.api.api_get("isPlaying"); @@ -469,7 +470,7 @@ } else { playing = override; } - if(playing == data.paused){ + if(playing == idled || playing == null){ data.paused = !playing; type = data.paused ? 'pause' : 'play'; @@ -1546,11 +1547,11 @@ var media, error, parent; if( ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) && - (media = $(e.target).closest('audio, video')) && !media.is('.nonnative-api-active') + (media = $(e.target).closest('audio, video')) && !media.hasClass('nonnative-api-active') ){ error = media.prop('error'); setTimeout(function(){ - if(!media.is('.nonnative-api-active')){ + if(!media.hasClass('nonnative-api-active')){ if(error && switchErrors[error.code]){ options.preferFlash = true; document.removeEventListener('error', switchOptions, true); diff --git a/public/webshims/shims/combos/23.js b/public/webshims/shims/combos/23.js index 3992851ad35f4b9a1ef4c827376afc20232f1a99..52b1a59294c7801fb4d0c569ec0321f94ec19706 100644 --- a/public/webshims/shims/combos/23.js +++ b/public/webshims/shims/combos/23.js @@ -754,6 +754,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/25.js b/public/webshims/shims/combos/25.js index 1ea35b04de87dd455f7bd59e2d97c596d101b36f..d365f0f682958a7591093ede3870128e31c6bd1f 100644 --- a/public/webshims/shims/combos/25.js +++ b/public/webshims/shims/combos/25.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1549,7 +1550,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine writeable: false, get: function(){ if(this.type != 'file'){return null;} - if(!$(this).is('.ws-filereader')){ + if(!$(this).hasClass('ws-filereader')){ webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property"); } return webshim.data(this, 'fileList') || []; @@ -1808,6 +1809,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine var onEvent = { onPlayPause: function(jaris, data, override){ var playing, type; + var idled = data.paused || data.ended; if(override == null){ try { playing = data.api.api_get("isPlaying"); @@ -1815,7 +1817,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine } else { playing = override; } - if(playing == data.paused){ + if(playing == idled || playing == null){ data.paused = !playing; type = data.paused ? 'pause' : 'play'; @@ -2892,11 +2894,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine var media, error, parent; if( ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) && - (media = $(e.target).closest('audio, video')) && !media.is('.nonnative-api-active') + (media = $(e.target).closest('audio, video')) && !media.hasClass('nonnative-api-active') ){ error = media.prop('error'); setTimeout(function(){ - if(!media.is('.nonnative-api-active')){ + if(!media.hasClass('nonnative-api-active')){ if(error && switchErrors[error.code]){ options.preferFlash = true; document.removeEventListener('error', switchOptions, true); diff --git a/public/webshims/shims/combos/26.js b/public/webshims/shims/combos/26.js index c96f1be920d65d7edee980ab3e2e6b716f49f3b8..39131ada92c5b1e7e3d623509e0fc55388a1753e 100644 --- a/public/webshims/shims/combos/26.js +++ b/public/webshims/shims/combos/26.js @@ -7570,7 +7570,7 @@ Globally exposed namespace with the most frequently used public classes and hand writeable: false, get: function(){ if(this.type != 'file'){return null;} - if(!$(this).is('.ws-filereader')){ + if(!$(this).hasClass('ws-filereader')){ webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property"); } return webshim.data(this, 'fileList') || []; diff --git a/public/webshims/shims/combos/27.js b/public/webshims/shims/combos/27.js index 1d6a5d8a1e952d1e5fe10c85a2ff564e8f980376..64a45b36c41e30c7f0f2797574634e5aa545bafb 100644 --- a/public/webshims/shims/combos/27.js +++ b/public/webshims/shims/combos/27.js @@ -156,18 +156,37 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(!support.fieldsetdisabled || !support.fieldsetelements){ (function(){ if(!support.fieldsetdisabled){ + var hasIsDisabled = 'isDisabled' in document.createElement('div'); var isFieldsetGroup = { fieldset: 1, FIELDSET: 1 }; var disableElementsSel = 'input, textarea, select, button'; + + var isDisabledChild = function(elem){ + if(hasIsDisabled && !elem.isDisabled){ + return false; + } + return $.find.matchesSelector(elem, 'fieldset[disabled] *' ); + }; + var isDisabledChildFilter = hasIsDisabled ? + function(){ + return this.isDisabled && $.find.matchesSelector(this, 'fieldset[disabled] *' ); + } : + 'fieldset[disabled] *'; + var isEnableChildFilter = hasIsDisabled ? + function(){ + return !this.isDisabled && !$.find.matchesSelector(this, 'fieldset[disabled] *' ); + } : + ':not(fieldset[disabled] *)'; + $.extend($.expr[":"], { "enabled": function( elem ) { - return elem.disabled === false || (isFieldsetGroup[elem.nodeName] && webshims.contentAttr(elem, 'disabled') == null && !$(elem).is('fieldset[disabled] *')) ; + return isFieldsetGroup[elem.nodeName] ? (webshims.contentAttr(elem, 'disabled') == null && !isDisabledChild(elem)) : elem.disabled === false; }, "disabled": function( elem ) { - return elem.disabled === true || (isFieldsetGroup[elem.nodeName] && (webshims.contentAttr(elem, 'disabled') != null || $(elem).is('fieldset[disabled] *'))); + return isFieldsetGroup[elem.nodeName] ? (webshims.contentAttr(elem, 'disabled') != null || isDisabledChild(elem)) : elem.disabled === true; } }); @@ -197,11 +216,12 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(value){ $(this.querySelectorAll(disableElementsSel)).each(groupControl.disable); - } else if(!$(this).is('fieldset[disabled] *')){ + + } else if(!isDisabledChild(this)){ var elements = $(this.querySelectorAll(disableElementsSel)); if( this.querySelector('fieldset[disabled]') ){ - elements = elements.not('fieldset[disabled] *'); + elements = elements.filter(isEnableChildFilter); } elements.each(groupControl.enable); @@ -218,7 +238,8 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(value){ webshims.data(this, 'groupedisabled', false); desc.prop._supset.call(this, value); - } else if($(this).is('fieldset[disabled] *')){ + + } else if(isDisabledChild(this)){ webshims.data(this, 'groupedisabled', true); desc.prop._supset.call(this, true); } else { @@ -242,7 +263,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u webshims.addReady(function(context){ $(context) - .filter('fieldset[disabled], fieldset[disabled] *') + .filter(isDisabledChildFilter) .find(disableElementsSel) .each(groupControl.disable) ; @@ -254,7 +275,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u var isForm = {form: 1, FORM: 1}; $.prop = function(elem, name, value){ var ret; - //TODO: cache + perftest if(elem && elem.nodeType == 1 && value === undefined && isForm[elem.nodeName] && elem.id){ ret = document.getElementsByName(name); if(!ret || !ret.length){ @@ -896,7 +916,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(elem.type == 'password' || isOver){ data.text = createPlaceholder(elem); - if(isResponsive || $(elem).is('.responsive-width') || (elem.currentStyle || {width: ''}).width.indexOf('%') != -1){ + if(isResponsive || $(elem).hasClass('responsive-width') || (elem.currentStyle || {width: ''}).width.indexOf('%') != -1){ data.box = data.text; } else { data.box = $('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />') @@ -1569,7 +1589,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u writeable: false, get: function(){ if(this.type != 'file'){return null;} - if(!$(this).is('.ws-filereader')){ + if(!$(this).hasClass('ws-filereader')){ webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property"); } return webshim.data(this, 'fileList') || []; diff --git a/public/webshims/shims/combos/28.js b/public/webshims/shims/combos/28.js index bf386879e072074baa6eab7c3f09abb5edeb2ba3..de2b950b4f099cb0992925568a786ef9d70e3d51 100644 --- a/public/webshims/shims/combos/28.js +++ b/public/webshims/shims/combos/28.js @@ -392,7 +392,7 @@ var rsubmittable = /^(?:select|textarea|input)/i; ; return function(){ var elem = $(this).getNativeElement()[0]; - return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') ); + return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') ); }; })() }, @@ -1149,7 +1149,6 @@ webshims.defineNodeNamesProperties(['input', 'button'], formSubmitterDescriptors } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); diff --git a/public/webshims/shims/combos/29.js b/public/webshims/shims/combos/29.js index 1d78f5c71193bb0970e22ea5cc0be08cd8e6e0fa..89b5f4bccfd868b8417e8f7659d98b0e4c5e967a 100644 --- a/public/webshims/shims/combos/29.js +++ b/public/webshims/shims/combos/29.js @@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); diff --git a/public/webshims/shims/combos/3.js b/public/webshims/shims/combos/3.js index 863d0ed6704345352ed02bfd4f6ac3dc29a7c1b8..0f9493ccdfe76e772ab4bdcb2e54ef28cc072b3f 100644 --- a/public/webshims/shims/combos/3.js +++ b/public/webshims/shims/combos/3.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1493,8 +1496,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1525,6 +1527,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-message', function($, webshims, window, document, undefined, options){ "use strict"; diff --git a/public/webshims/shims/combos/30.js b/public/webshims/shims/combos/30.js index b911fbd1b299388ec2f16f5bb7b3152f5874a1ba..e727d2d4245152b6fff0d9bae9c3ac405c04393a 100644 --- a/public/webshims/shims/combos/30.js +++ b/public/webshims/shims/combos/30.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1493,8 +1496,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1525,6 +1527,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-message', function($, webshims, window, document, undefined, options){ "use strict"; diff --git a/public/webshims/shims/combos/31.js b/public/webshims/shims/combos/31.js index 6e0cbbd36ffd89b28542695a46bbd2b0c77b2455..c9a8430bc316110681aa8fecc48d4518ae5da58f 100644 --- a/public/webshims/shims/combos/31.js +++ b/public/webshims/shims/combos/31.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1493,8 +1496,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1525,6 +1527,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){ "use strict"; diff --git a/public/webshims/shims/combos/33.js b/public/webshims/shims/combos/33.js index dae36d021f316b1703f02b942bb76d179a2e5889..bcf855194e6298b3aa7b68ebc28163aadc0721a9 100644 --- a/public/webshims/shims/combos/33.js +++ b/public/webshims/shims/combos/33.js @@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); diff --git a/public/webshims/shims/combos/34.js b/public/webshims/shims/combos/34.js index 66b477f7010ea38e699e9b02aa1d937b80c051bd..e1d716e99e381394da09b73c467c38f003cf7b1a 100644 --- a/public/webshims/shims/combos/34.js +++ b/public/webshims/shims/combos/34.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ diff --git a/public/webshims/shims/combos/4.js b/public/webshims/shims/combos/4.js index 2814e04a332bc11a85b3f558a7eef58ee07b7fdd..55c0fc60276145a81697e656ec55df42a3721ec9 100644 --- a/public/webshims/shims/combos/4.js +++ b/public/webshims/shims/combos/4.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ diff --git a/public/webshims/shims/combos/5.js b/public/webshims/shims/combos/5.js index 560759d8829685b4fd8c7255c13b2bac26f30b48..d0e17a45a2a691c958c6b1ef78c4a808b67ed6b4 100644 --- a/public/webshims/shims/combos/5.js +++ b/public/webshims/shims/combos/5.js @@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); @@ -1631,9 +1630,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -3291,7 +3292,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -3321,28 +3322,28 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -3353,12 +3354,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/combos/6.js b/public/webshims/shims/combos/6.js index b56cf277c55dfcc6617deb978753eb316e32a19c..221b886af2d1f2f57bb814b6aaccc4a5b0c94651 100644 --- a/public/webshims/shims/combos/6.js +++ b/public/webshims/shims/combos/6.js @@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); @@ -1631,9 +1630,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -3291,7 +3292,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -3321,28 +3322,28 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -3353,12 +3354,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/combos/7.js b/public/webshims/shims/combos/7.js index f89597d89ec2d111574fb591223a6531cbf95504..2fbf0b80187499d925c09f8f006ef479fbd2ba96 100644 --- a/public/webshims/shims/combos/7.js +++ b/public/webshims/shims/combos/7.js @@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1716,8 +1719,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1748,6 +1750,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-message', function($, webshims, window, document, undefined, options){ "use strict"; @@ -2891,6 +2901,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/8.js b/public/webshims/shims/combos/8.js index 62df89e3d64b05048857bf9d9784ed8c4dd33b49..9d79224991161d8b596c6f9fe5bb16a915c330cd 100644 --- a/public/webshims/shims/combos/8.js +++ b/public/webshims/shims/combos/8.js @@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -1716,8 +1719,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -1748,6 +1750,14 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); ;webshims.register('form-message', function($, webshims, window, document, undefined, options){ "use strict"; @@ -2594,6 +2604,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/combos/9.js b/public/webshims/shims/combos/9.js index 2099a7b331d72dedd82557b8199ad7a0d5edfc18..7cce200f940a3cd3f2aed88d17a42cffb0930b62 100644 --- a/public/webshims/shims/combos/9.js +++ b/public/webshims/shims/combos/9.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ @@ -2015,9 +2016,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -3675,7 +3678,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -3705,28 +3708,28 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -3737,12 +3740,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/combos/97.js b/public/webshims/shims/combos/97.js index 41dc387cd7e5c8eb15248fc86cdf3cc7fe7ef1d7..b604593ab147f454e3e1a7391937d9777c265efc 100644 --- a/public/webshims/shims/combos/97.js +++ b/public/webshims/shims/combos/97.js @@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ jmeData.media = media; jmeData.player = base; media - .on('ended emptied play', (function(){ - var timer; - var releaseEmptied = function(){ - stopEmptiedEvent = false; - }; - var ended = function(){ - removeCanPlay(); - media.jmeFn('pause'); - if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - stopEmptiedEvent = true; - media.jmeFn('load'); - base.attr('data-state', 'ended'); - setTimeout(releaseEmptied); - - } - }; - return function(e){ - - clearTimeout(timer); - if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - timer = setTimeout(ended); - } - }; - })()) .on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn) .on('volumechange updateJMEState', function(){ var volume = $.prop(this, 'volume'); diff --git a/public/webshims/shims/combos/98.js b/public/webshims/shims/combos/98.js index 2936fa897826469602409587d1767d5d29258201..d5c33ef525de06ee2e445c122bf8b637b25bee70 100644 --- a/public/webshims/shims/combos/98.js +++ b/public/webshims/shims/combos/98.js @@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ jmeData.media = media; jmeData.player = base; media - .on('ended emptied play', (function(){ - var timer; - var releaseEmptied = function(){ - stopEmptiedEvent = false; - }; - var ended = function(){ - removeCanPlay(); - media.jmeFn('pause'); - if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - stopEmptiedEvent = true; - media.jmeFn('load'); - base.attr('data-state', 'ended'); - setTimeout(releaseEmptied); - - } - }; - return function(e){ - - clearTimeout(timer); - if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - timer = setTimeout(ended); - } - }; - })()) .on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn) .on('volumechange updateJMEState', function(){ var volume = $.prop(this, 'volume'); @@ -598,17 +574,33 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ var regYt = /youtube\.com\/[watch\?|v\/]+/i; var isInitial = data.media.prop('paused'); + var isEnded = data.media.prop('ended'); if(isInitial){ data.player.addClass('initial-state'); } + if(isEnded){ + data.player.addClass('ended-state'); + } if(!('backgroundSize' in $poster[0].style)){ data.player.addClass('no-backgroundsize'); } - data.media.on('playing waiting seeked seeking', function(){ + data.media.on('play playing waiting seeked seeking', function(e){ + if(isInitial){ isInitial = false; data.player.removeClass('initial-state'); } + + if(isEnded){ + isEnded = false; + data.player.removeClass('ended-state'); + } + }); + data.media.on('ended', function(){ + if(!isEnded && !data.media.prop('loop') && data.media.prop('ended')){ + isEnded = true; + data.player.addClass('ended-state'); + } }); return function(){ var poster = data.media.attr('poster'); @@ -640,6 +632,11 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ isInitial = true; } + if(isEnded){ + isEnded = false; + data.player.removeClass('ended-state'); + } + if(lastYoutubeState !== hasYt){ lastYoutubeState = hasYt; data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); diff --git a/public/webshims/shims/combos/99.js b/public/webshims/shims/combos/99.js index 560becfa565dd6afc6e7f8f87edbfad792875f01..cb811d853a30c10004ecdbf463e0fd4a32365441 100644 --- a/public/webshims/shims/combos/99.js +++ b/public/webshims/shims/combos/99.js @@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ jmeData.media = media; jmeData.player = base; media - .on('ended emptied play', (function(){ - var timer; - var releaseEmptied = function(){ - stopEmptiedEvent = false; - }; - var ended = function(){ - removeCanPlay(); - media.jmeFn('pause'); - if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - stopEmptiedEvent = true; - media.jmeFn('load'); - base.attr('data-state', 'ended'); - setTimeout(releaseEmptied); - - } - }; - return function(e){ - - clearTimeout(timer); - if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - timer = setTimeout(ended); - } - }; - })()) .on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn) .on('volumechange updateJMEState', function(){ var volume = $.prop(this, 'volume'); @@ -598,17 +574,33 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ var regYt = /youtube\.com\/[watch\?|v\/]+/i; var isInitial = data.media.prop('paused'); + var isEnded = data.media.prop('ended'); if(isInitial){ data.player.addClass('initial-state'); } + if(isEnded){ + data.player.addClass('ended-state'); + } if(!('backgroundSize' in $poster[0].style)){ data.player.addClass('no-backgroundsize'); } - data.media.on('playing waiting seeked seeking', function(){ + data.media.on('play playing waiting seeked seeking', function(e){ + if(isInitial){ isInitial = false; data.player.removeClass('initial-state'); } + + if(isEnded){ + isEnded = false; + data.player.removeClass('ended-state'); + } + }); + data.media.on('ended', function(){ + if(!isEnded && !data.media.prop('loop') && data.media.prop('ended')){ + isEnded = true; + data.player.addClass('ended-state'); + } }); return function(){ var poster = data.media.attr('poster'); @@ -640,6 +632,11 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ isInitial = true; } + if(isEnded){ + isEnded = false; + data.player.removeClass('ended-state'); + } + if(lastYoutubeState !== hasYt){ lastYoutubeState = hasYt; data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); diff --git a/public/webshims/shims/dom-extend.js b/public/webshims/shims/dom-extend.js index bad678ea0ffa13c300723173b1c2599a9675b571..ac2ba76371161f128b6ae59169c930f92e69ca31 100644 --- a/public/webshims/shims/dom-extend.js +++ b/public/webshims/shims/dom-extend.js @@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine webshims.warn(type +' already implemented for element #'+elem.id); return false; } + data[type] = true; - return true; + return !$(elem).hasClass('ws-nopolyfill'); }, extendUNDEFProp: function(obj, props){ $.each(props, function(name, prop){ diff --git a/public/webshims/shims/filereader.js b/public/webshims/shims/filereader.js index 5d78544f2710459265380687397659bf5f838be7..f8da375dcf3afcb04c224df0c837e684d76e4da4 100644 --- a/public/webshims/shims/filereader.js +++ b/public/webshims/shims/filereader.js @@ -337,7 +337,7 @@ webshim.register('filereader', function($, webshim, window, document, undefined, writeable: false, get: function(){ if(this.type != 'file'){return null;} - if(!$(this).is('.ws-filereader')){ + if(!$(this).hasClass('ws-filereader')){ webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property"); } return webshim.data(this, 'fileList') || []; diff --git a/public/webshims/shims/form-core.js b/public/webshims/shims/form-core.js index 6ee29874c1398a802fdef7d835419d3e24985cf7..5e5d824b775199729637d361044fb58ce87fabb3 100644 --- a/public/webshims/shims/form-core.js +++ b/public/webshims/shims/form-core.js @@ -27,6 +27,9 @@ webshims.register('form-core', function($, webshims, window, document, undefined }; var lazyLoad = function(){ var toLoad = ['form-validation']; + + $(document).off('.lazyloadvalidation'); + if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); @@ -41,7 +44,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined toLoad.push('form-validators'); } webshims.reTest(toLoad); - $(document).off('.lazyloadvalidation'); }; /* * Selectors for all browsers @@ -98,11 +100,11 @@ webshims.register('form-core', function($, webshims, window, document, undefined }; $.extend(exp, { "enabled": function( elem ) { - return elem.disabled === false && !$(elem).is('fieldset[disabled] *'); + return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *'); }, "disabled": function( elem ) { - return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *')); + return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *')); } }); } @@ -281,8 +283,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined }; - - $(document).on('focusin.lazyloadvalidation', function(e){ + $(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } @@ -313,4 +314,12 @@ webshims.register('form-core', function($, webshims, window, document, undefined }); } }); + + if(options.addValidators && options.fastValidators){ + webshims.reTest(['form-validators', 'form-validation']); + } + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); diff --git a/public/webshims/shims/form-datalist-lazy.js b/public/webshims/shims/form-datalist-lazy.js index c979dd12f1710562580aee0b75f3c413ec7b559f..715fe7d801d1fb6473ebc4935d446fc451c68793 100644 --- a/public/webshims/shims/form-datalist-lazy.js +++ b/public/webshims/shims/form-datalist-lazy.js @@ -268,13 +268,17 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document, this.popover.contentElement.html('<div class="datalist-box"><ul role="listbox">'+ list.join("\n") +'</ul></div>'); $(this.input).removeAttr('aria-activedescendant').triggerHandler('datalistcreated', [{instance: this}]); - + if(_forceShow || this.popover.isVisible){ - if(this.options.valueCompletion && this.lastCompletedValue && !$.prop(this.input, 'value').indexOf(this.lastCompletedValue)){ + + if(this.options.valueCompletion && this.lastCompletedValue && (value = $.prop(this.input, 'value')) && !value.indexOf(this.lastCompletedValue)){ $.prop(this.input, 'value', this.lastCompletedValue); $(this.input).triggerHandler('updateInput'); } - this.lastCompletedValue = ""; + + if(value != this.lastCompletedValue){ + this.lastCompletedValue = ""; + } this.showHideOptions(); } else { this.lastCompletedValue = ""; @@ -545,7 +549,7 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document, } items.removeClass('active-item'); this.shadowList.addClass('list-item-active'); - activeItem = items.filter(':eq('+ index +')').addClass('active-item'); + activeItem = items.eq(index).addClass('active-item'); if(doValue){ if(doValue != 'onlyScroll'){ diff --git a/public/webshims/shims/form-number-date-api.js b/public/webshims/shims/form-number-date-api.js index 479be7a0221bb077b8297a3efd9a2fd3bd6e33db..47edd48ebff0fafdbc807e6a999f00c4a99fd82d 100644 --- a/public/webshims/shims/form-number-date-api.js +++ b/public/webshims/shims/form-number-date-api.js @@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document } var nan = parseInt('NaN', 10), - doc = document, typeModels = webshims.inputTypes, isNumber = function(string){ return (typeof string == 'number' || (string && string == string * 1)); diff --git a/public/webshims/shims/form-number-date-ui.js b/public/webshims/shims/form-number-date-ui.js index 320d0177d27fa21a550a7aef804eed254e04248e..c720d5f122d43a38ca10d2849700003cc84901f5 100644 --- a/public/webshims/shims/form-number-date-ui.js +++ b/public/webshims/shims/form-number-date-ui.js @@ -183,9 +183,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document, $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); if(!noFocus){ labels.on('click', function(e){ - element.getShadowFocusElement().focus(); - e.preventDefault(); - return false; + if(!e.isDefaultPrevented()){ + element.getShadowFocusElement().focus(); + e.preventDefault(); + return false; + } }); } }; @@ -1843,7 +1845,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document, }); }); } - + if(opts.calculateWidth){ sizeInput(data.shim); } else { @@ -1873,28 +1875,28 @@ webshims.register('form-number-date-ui', function($, webshims, window, document, } var replace = {}; - - + if(options.replaceUI){ - if( $.isPlainObject(options.replaceUI) ){ - $.extend(replace, options.replaceUI); - } else { - $.extend(replace, { - 'range': 1, - 'number': 1, - 'time': 1, - 'month': 1, - 'date': 1, - 'color': 1, - 'datetime-local': 1 - }); - } + $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : { + 'range': 1, + 'number': 1, + 'time': 1, + 'month': 1, + 'date': 1, + 'color': 1, + 'datetime-local': 1 + }), function(name, val){ + if(supportInputTypes[name] && val == 'auto'){ + replace[name] = webshims._getAutoEnhance(val); + } + }); } + if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){ replace.number = 1; } - if(!supportInputTypes.range || replace.range){ + if(replace.range !== false && (!supportInputTypes.range || replace.range)){ extendType('range', { _create: function(opts, set){ var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); @@ -1905,12 +1907,13 @@ webshims.register('form-number-date-ui', function($, webshims, window, document, ['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ - if(!supportInputTypes[name] || replace[name]){ + if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){ extendType(name, { _create: function(opts, set){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){ opts.splitInput = true; } + if(opts.splitInput && !splitInputs[name]){ webshims.warn('splitInput not supported for '+ name); opts.splitInput = false; diff --git a/public/webshims/shims/form-shim-extend.js b/public/webshims/shims/form-shim-extend.js index 3e59059dc83f4f1716a4f43950cd95281f7cb773..c2e72c073719b281166f9b342f85d46e3842babe 100644 --- a/public/webshims/shims/form-shim-extend.js +++ b/public/webshims/shims/form-shim-extend.js @@ -392,7 +392,7 @@ var rsubmittable = /^(?:select|textarea|input)/i; ; return function(){ var elem = $(this).getNativeElement()[0]; - return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') ); + return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') ); }; })() }, diff --git a/public/webshims/shims/form-shim-extend2.js b/public/webshims/shims/form-shim-extend2.js index 42f9c6d66db012967c637690d78ed36e73bbc5ca..a121da017c2df39f9729385f7156f1315a90da10 100644 --- a/public/webshims/shims/form-shim-extend2.js +++ b/public/webshims/shims/form-shim-extend2.js @@ -156,18 +156,37 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(!support.fieldsetdisabled || !support.fieldsetelements){ (function(){ if(!support.fieldsetdisabled){ + var hasIsDisabled = 'isDisabled' in document.createElement('div'); var isFieldsetGroup = { fieldset: 1, FIELDSET: 1 }; var disableElementsSel = 'input, textarea, select, button'; + + var isDisabledChild = function(elem){ + if(hasIsDisabled && !elem.isDisabled){ + return false; + } + return $.find.matchesSelector(elem, 'fieldset[disabled] *' ); + }; + var isDisabledChildFilter = hasIsDisabled ? + function(){ + return this.isDisabled && $.find.matchesSelector(this, 'fieldset[disabled] *' ); + } : + 'fieldset[disabled] *'; + var isEnableChildFilter = hasIsDisabled ? + function(){ + return !this.isDisabled && !$.find.matchesSelector(this, 'fieldset[disabled] *' ); + } : + ':not(fieldset[disabled] *)'; + $.extend($.expr[":"], { "enabled": function( elem ) { - return elem.disabled === false || (isFieldsetGroup[elem.nodeName] && webshims.contentAttr(elem, 'disabled') == null && !$(elem).is('fieldset[disabled] *')) ; + return isFieldsetGroup[elem.nodeName] ? (webshims.contentAttr(elem, 'disabled') == null && !isDisabledChild(elem)) : elem.disabled === false; }, "disabled": function( elem ) { - return elem.disabled === true || (isFieldsetGroup[elem.nodeName] && (webshims.contentAttr(elem, 'disabled') != null || $(elem).is('fieldset[disabled] *'))); + return isFieldsetGroup[elem.nodeName] ? (webshims.contentAttr(elem, 'disabled') != null || isDisabledChild(elem)) : elem.disabled === true; } }); @@ -197,11 +216,12 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(value){ $(this.querySelectorAll(disableElementsSel)).each(groupControl.disable); - } else if(!$(this).is('fieldset[disabled] *')){ + + } else if(!isDisabledChild(this)){ var elements = $(this.querySelectorAll(disableElementsSel)); if( this.querySelector('fieldset[disabled]') ){ - elements = elements.not('fieldset[disabled] *'); + elements = elements.filter(isEnableChildFilter); } elements.each(groupControl.enable); @@ -218,7 +238,8 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(value){ webshims.data(this, 'groupedisabled', false); desc.prop._supset.call(this, value); - } else if($(this).is('fieldset[disabled] *')){ + + } else if(isDisabledChild(this)){ webshims.data(this, 'groupedisabled', true); desc.prop._supset.call(this, true); } else { @@ -242,7 +263,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u webshims.addReady(function(context){ $(context) - .filter('fieldset[disabled], fieldset[disabled] *') + .filter(isDisabledChildFilter) .find(disableElementsSel) .each(groupControl.disable) ; @@ -254,7 +275,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u var isForm = {form: 1, FORM: 1}; $.prop = function(elem, name, value){ var ret; - //TODO: cache + perftest if(elem && elem.nodeType == 1 && value === undefined && isForm[elem.nodeName] && elem.id){ ret = document.getElementsByName(name); if(!ret || !ret.length){ @@ -896,7 +916,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u if(elem.type == 'password' || isOver){ data.text = createPlaceholder(elem); - if(isResponsive || $(elem).is('.responsive-width') || (elem.currentStyle || {width: ''}).width.indexOf('%') != -1){ + if(isResponsive || $(elem).hasClass('responsive-width') || (elem.currentStyle || {width: ''}).width.indexOf('%') != -1){ data.box = data.text; } else { data.box = $('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />') diff --git a/public/webshims/shims/form-validation.js b/public/webshims/shims/form-validation.js index 9ea67ac6257fd09648685a89312b2a4c3fd3f08c..279601ebff597523e4d71741139eee3cc2370c30 100644 --- a/public/webshims/shims/form-validation.js +++ b/public/webshims/shims/form-validation.js @@ -111,7 +111,7 @@ webshims.register('form-validation', function($, webshims, window, document, und shadowType = shadowElem.prop('type'); } if( - (chromeBugs && (e.type == 'change' || webkitVersion < 537.36) && noFocusWidgets[shadowType] && $(e.target).is(':focus')) || + (chromeBugs && (e.type == 'change' || webkitVersion < 537.36) && noFocusWidgets[shadowType] && $.find.matchesSelector(e.target, ':focus')) || (e.type == 'focusout' && elem.type == 'radio' && isInGroup(elem.name)) ){ return; @@ -438,9 +438,9 @@ webshims.register('form-validation', function($, webshims, window, document, und this.lastElement = $(element).getShadowFocusElement(); if(!this.prepared || !this.options.prepareFor){ if(opts.appendTo == 'element' || (opts.inline && opts.appendTo == 'auto')){ - parentElem = element.parent(); + parentElem = visual.parent(); } else if(opts.appendTo == 'auto'){ - parentElem = this._getAutoAppendElement(element); + parentElem = this._getAutoAppendElement(visual); } else { parentElem = $(opts.appendTo); } @@ -679,7 +679,7 @@ webshims.register('form-validation', function($, webshims, window, document, und var ret = $(elem).data('errortype'); if(!ret){ $.each(fields, function(errorName, cNames){ - if($(elem).is(cNames)){ + if($.find.matchesSelector(elem, cNames)){ ret = errorName; return false; } @@ -724,7 +724,8 @@ webshims.register('form-validation', function($, webshims, window, document, und }; })(), initIvalContentMessage: function(elem){ - if($(elem).jProp('form').is(iVal.sel)){ + var form; + if(iVal.sel && (form = $.prop(elem, 'form')) && $.find.matchesSelector(form, iVal.sel)){ this.get(elem); } }, @@ -794,7 +795,7 @@ webshims.register('form-validation', function($, webshims, window, document, und switchValidityClass({type: 'input', target: input}); }; $(input) - .filter('input:not([type="checkbox"]):not([type="radio"])') + .filter('input:not([type="checkbox"]):not([type="radio"]), textarea') .off('.recheckinvalid') .on('input.recheckinvalid', function(){ clearTimeout(timer); @@ -840,7 +841,7 @@ webshims.register('form-validation', function($, webshims, window, document, und this.hideError(elem, true).removeClass(successWrapperClass); }, toggle: function(elem){ - if($(elem).is(':invalid')){ + if($.find.matchesSelector(elem, ':invalid')){ this.showError(elem); } else { this.hideError(elem); @@ -851,25 +852,21 @@ webshims.register('form-validation', function($, webshims, window, document, und $(document.body) .on({ 'changedvaliditystate': function(e){ - if(iVal.sel){ - var form = $(e.target).jProp('form'); - if(form.is(iVal.sel)){ - webshims.errorbox.toggle(e.target); - } + var form; + if(iVal.sel && (form = $.prop(e.target, 'form')) && $.find.matchesSelector(form, iVal.sel)){ + webshims.errorbox.toggle(e.target); } }, 'resetvalidityui.webshims': function(e){ - if (iVal.sel) { - var form = $(e.target).jProp('form'); - if (form.is(iVal.sel)) { - webshims.errorbox.reset(e.target); - } + var form; + if(iVal.sel && (form = $.prop(e.target, 'form')) && $.find.matchesSelector(form, iVal.sel)){ + webshims.errorbox.reset(e.target); } }, firstinvalid: function(e){ + var form; if(iVal.sel && iVal.handleBubble){ - var form = $(e.target).jProp('form'); - if(form.is(iVal.sel)){ + if(iVal.sel && (form = $.prop(e.target, 'form')) && $.find.matchesSelector(form, iVal.sel)){ e.preventDefault(); if(iVal.handleBubble != 'none'){ webshims.validityAlert.showFor( e.target, false, false, iVal.handleBubble == 'hide' ); @@ -878,7 +875,7 @@ webshims.register('form-validation', function($, webshims, window, document, und } }, submit: function(e){ - if(iVal.sel && iVal.submitCheck && $(e.target).is(iVal.sel) && $.prop(e.target, 'noValidate') && !$(e.target).checkValidity()){ + if(iVal.sel && iVal.submitCheck && $.find.matchesSelector(e.target, iVal.sel) && $.prop(e.target, 'noValidate') && !$(e.target).checkValidity()){ e.stopImmediatePropagation(); return false; } diff --git a/public/webshims/shims/form-validators.js b/public/webshims/shims/form-validators.js index f5716f1a8fbd89a5a54b6cbc183e78b7a4c14ce3..54d5dc6669868217e94abd0063eb8705d6c92647 100644 --- a/public/webshims/shims/form-validators.js +++ b/public/webshims/shims/form-validators.js @@ -1,6 +1,11 @@ webshims.register('form-validators', function($, webshims, window, document, undefined, options){ "use strict"; -var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; + +var iValClasses; +webshims.ready('form-validation', function(){ + iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; +}); + (function(){ if(webshims.refreshCustomValidityRules){ webshims.error("form-validators already included. please remove custom-validity.js"); @@ -30,7 +35,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; elem = elements[id].elem; if(elem != noTest && elements[id].val != (val = elem.value)){ elements[id].val = val; - if($(elem).hasClass(iValClasses)){ + if(iValClasses && $.find.matchesSelector(elem, iValClasses)){ $(elem).trigger('updatevalidation.webshims'); } else { testValidityRules(elem); @@ -337,7 +342,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; val = !val; } $.prop( elem, data.prop, val); - if(e){ + if(iValClasses && e){ $(elem).getShadowElement().filter(iValClasses).trigger('updatevalidation.webshims'); } }; @@ -377,11 +382,13 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; } else { $(data.masterElement).on('change', function(){ webshims.refreshCustomValidityRules(elem); - $(elem) - .getShadowElement() - .filter(iValClasses) - .trigger('updatevalidation.webshims') - ; + if(iValClasses){ + $(elem) + .getShadowElement() + .filter(iValClasses) + .trigger('updatevalidation.webshims') + ; + } }); } } @@ -416,7 +423,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; } data.ajaxvalidate.depends.on('change', function(){ - if($(this).is(':valid')){ + if($.find.matchesSelector(this, ':valid')){ webshims.refreshCustomValidityRules(elem); } }); @@ -479,7 +486,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass; data = {}; data[$.prop(elem, 'name') || $.prop(elem, 'id')] = $(elem).val(); opts.depends.each(function(){ - if($(this).is(':invalid')){ + if($.find.matchesSelector(this, ':invalid')){ data = false; return false; } diff --git a/public/webshims/shims/forms-picker.js b/public/webshims/shims/forms-picker.js index 1b5156f5003c35a680beb8243a1e076ef90c9fbf..a8647858b7cb4e69716f267a67139b392432bc0d 100644 --- a/public/webshims/shims/forms-picker.js +++ b/public/webshims/shims/forms-picker.js @@ -1495,7 +1495,7 @@ webshims.register('forms-picker', function($, webshims, window, document, undefi data._commonDateInit = true; var o = data.options; var actionfn = function(e){ - if(!$(this).is('.othermonth') || $(this).css('cursor') == 'pointer'){ + if(!$(this).hasClass('othermonth') || $(this).css('cursor') == 'pointer'){ popover.actionFn({ 'data-action': $.attr(this, 'data-action'), value: $(this).val() || $.attr(this, 'value') @@ -1550,13 +1550,13 @@ webshims.register('forms-picker', function($, webshims, window, document, undefi $('button', popover.buttonRow).each(function(){ var text; - if($(this).is('.ws-empty')){ + if($(this).hasClass('ws-empty')){ text = curCfg.date.clear; if(!text){ text = formcfg[''].date.clear || 'clear'; webshims.warn("could not get clear text from form cfg"); } - } else if($(this).is('.ws-current')){ + } else if($(this).hasClass('ws-current')){ text = (curCfg[data.type] || {}).currentText; if(!text){ text = (formcfg[''][[data.type]] || {}).currentText || (curCfg.date || {}).currentText || 'current'; diff --git a/public/webshims/shims/jme/base.js b/public/webshims/shims/jme/base.js index b3dbf046daa820aedcc44d353c9c9a6e389a78bd..6c254a280f00166d3b6a1f74f0968cff8b87b94a 100644 --- a/public/webshims/shims/jme/base.js +++ b/public/webshims/shims/jme/base.js @@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){ jmeData.media = media; jmeData.player = base; media - .on('ended emptied play', (function(){ - var timer; - var releaseEmptied = function(){ - stopEmptiedEvent = false; - }; - var ended = function(){ - removeCanPlay(); - media.jmeFn('pause'); - if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - stopEmptiedEvent = true; - media.jmeFn('load'); - base.attr('data-state', 'ended'); - setTimeout(releaseEmptied); - - } - }; - return function(e){ - - clearTimeout(timer); - if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){ - timer = setTimeout(ended); - } - }; - })()) .on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn) .on('volumechange updateJMEState', function(){ var volume = $.prop(this, 'volume'); diff --git a/public/webshims/shims/jme/controls.css b/public/webshims/shims/jme/controls.css index b130c1582bfa01b8ffcd1b407c9936543714525b..6ee5c50e77fe34ccf2427a1666464c4addab8e7e 100644 --- a/public/webshims/shims/jme/controls.css +++ b/public/webshims/shims/jme/controls.css @@ -1,5 +1,5 @@ /* thx to http://icomoon.io */ -.mediaplayer[data-state="waiting"] > .jme-media-overlay, .mediaplayer .fullscreen, .mediaplayer .fullscreen.state-exitfullscreen, .mediaplayer .mediaconfigmenu, .mediaplayer[data-state="idle"] > .jme-media-overlay, .mediaplayer button.play-pause, .mediaplayer button.play-pause.state-playing, .mediaplayer .mute-unmute, .mediaplayer[data-volume="medium"] .mute-unmute, .mediaplayer[data-volume="low"] .mute-unmute, .mediaplayer[data-volume="no"] .mute-unmute, .mediaplayer .state-unmute.mute-unmute, .mediaplayer .captions, .mediaplayer .subtitle-menu button[aria-checked="true"], .mediaplayer .subtitle-menu button, .mediaplayer .playlist-next, .mediaplayer .playlist-prev, .mediaplayer .chapters, .mediaplayer[data-state="ended"] > .jme-media-overlay { +.mediaplayer[data-state="waiting"] > .jme-media-overlay, .mediaplayer .fullscreen, .mediaplayer .fullscreen.state-exitfullscreen, .mediaplayer .mediaconfigmenu, .mediaplayer.initial-state > .jme-media-overlay, .mediaplayer button.play-pause, .mediaplayer button.play-pause.state-playing, .mediaplayer .mute-unmute, .mediaplayer[data-volume="medium"] .mute-unmute, .mediaplayer[data-volume="low"] .mute-unmute, .mediaplayer[data-volume="no"] .mute-unmute, .mediaplayer .state-unmute.mute-unmute, .mediaplayer .captions, .mediaplayer .subtitle-menu button[aria-checked="true"], .mediaplayer .subtitle-menu button, .mediaplayer .playlist-next, .mediaplayer .playlist-prev, .mediaplayer .chapters, .mediaplayer.ended-state > .jme-media-overlay { font-family: 'jme'; speak: none; font-style: normal; @@ -29,7 +29,7 @@ content: "\e606"; } -.mediaplayer[data-state="idle"] > .jme-media-overlay:before { +.mediaplayer.initial-state > .jme-media-overlay:before { content: "\e608"; } @@ -85,7 +85,7 @@ content: "\e615"; } -.mediaplayer[data-state="ended"] > .jme-media-overlay:before { +.mediaplayer.ended-state > .jme-media-overlay:before { content: "\e601"; } @@ -99,6 +99,15 @@ font-weight: normal; font-style: normal; } +@-webkit-keyframes jmespin { + 0% { + -webkit-transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + } +} @keyframes jmespin { 0% { -webkit-transform: rotate(0deg); @@ -264,17 +273,17 @@ .mediaplayer[data-state="idle"] { cursor: pointer; } -.mediaplayer[data-state="idle"] > .jme-media-overlay { +.mediaplayer.initial-state > .jme-media-overlay { background-position: 1px 1px; } -.mediaplayer[data-state="idle"].has-ytposter.no-backgroundsize > .jme-media-overlay:before { +.mediaplayer.initial-state.has-ytposter.no-backgroundsize > .jme-media-overlay:before { content: ""; background-position: 2px 2px; } -.mediaplayer[data-state="ended"] { +.mediaplayer.ended-state { cursor: pointer; } -.mediaplayer[data-state="ended"] > .jme-media-overlay { +.mediaplayer.ended-state > .jme-media-overlay { background-position: 3px 3px; } .mediaplayer[data-state="waiting"] { @@ -284,6 +293,10 @@ background-position: 4px 4px; } .mediaplayer[data-state="waiting"] > .jme-media-overlay:before { + -webkit-animation-name: jmespin; + -webkit-animation-iteration-count: infinite; + -webkit-animation-duration: 1100ms; + -webkit-animation-timing-function: linear; animation-name: jmespin; animation-iteration-count: infinite; animation-duration: 1100ms; @@ -308,9 +321,10 @@ left: 0; right: 0; bottom: 0; - background: #000 no-repeat center / contain; + background: #000 no-repeat center; + background-size: contain; } -.mediaplayer.initial-state .ws-poster { +.mediaplayer.initial-state .ws-poster, .mediaplayer.ended-state .ws-poster { display: block; } .mediaplayer.no-poster .ws-poster, .mediaplayer.no-backgroundsize div.ws-poster { diff --git a/public/webshims/shims/jme/controls.scss b/public/webshims/shims/jme/controls.scss index ced58aaed18cab492faff137a1aac1ddb2102805..38efd8894ea98b6cc211e3531bddad5893f32052 100644 --- a/public/webshims/shims/jme/controls.scss +++ b/public/webshims/shims/jme/controls.scss @@ -30,6 +30,15 @@ $browser-context: 16; // Default @return #{$pixels/$context}em } +@-webkit-keyframes jmespin { + 0% { + -webkit-transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + } +} @keyframes jmespin { 0% { @@ -186,7 +195,9 @@ $browser-context: 16; // Default &[data-state="idle"] { cursor: pointer; + } + &.initial-state { > .jme-media-overlay { @extend %icon-play-circle; background-position: 1px 1px; @@ -198,7 +209,7 @@ $browser-context: 16; // Default } } - &[data-state="ended"] { + &.ended-state { cursor: pointer; > .jme-media-overlay { @extend %icon-loop; @@ -213,6 +224,11 @@ $browser-context: 16; // Default background-position: 4px 4px; &:before { + -webkit-animation-name: jmespin; + -webkit-animation-iteration-count: infinite; + -webkit-animation-duration: 1100ms; + -webkit-animation-timing-function: linear; + animation-name: jmespin; animation-iteration-count: infinite; animation-duration: 1100ms; @@ -243,10 +259,12 @@ $browser-context: 16; // Default left: 0; right: 0; bottom: 0; - background: #000 no-repeat center / contain; + background: #000 no-repeat center; + background-size: contain; } - &.initial-state .ws-poster { + &.initial-state .ws-poster, + &.ended-state .ws-poster { display: block; } diff --git a/public/webshims/shims/jme/mediacontrols-lazy.js b/public/webshims/shims/jme/mediacontrols-lazy.js index 5665164c80957cb69181753a8bcc0012becff86a..fbcacafdb81c32a4232d979974090668625dcb0c 100644 --- a/public/webshims/shims/jme/mediacontrols-lazy.js +++ b/public/webshims/shims/jme/mediacontrols-lazy.js @@ -353,6 +353,7 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef delete base._seekpause; } wasPaused = null; + media.triggerHandler('updateprogress'); } }); @@ -1316,10 +1317,11 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef $.jme.registerPlugin('buffer-progress', { _create: function(control, media, base, options){ + var progressTimer; var indicator = $('<div class="buffer-progress-indicator" />').appendTo(control); var drawBufferProgress = function(){ var progress = media.jmeProp('progress'); - + clearTimeout(progressTimer); if(options.progress !== progress){ options.progress = progress; @@ -1332,7 +1334,14 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef indicator.css('width', 0); options.progress = 0; }, - playing: drawBufferProgress + playing: drawBufferProgress, + 'seeked seeking updateprogress': function(e){ + clearTimeout(progressTimer); + if(e.type != 'seeking'){ + progressTimer = setTimeout(drawBufferProgress, 100); + } + } + }); drawBufferProgress(); } @@ -1418,8 +1427,8 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef var buttons = this.buttons.not(':disabled'); var activeButton = buttons.filter(':focus'); - activeButton = buttons[buttons.index(activeButton) + dir] || buttons.filter(dir > 0 ? ':first' : ':last'); - activeButton.trigger('focus'); + activeButton = (activeButton[0] && buttons[buttons.index(activeButton) + dir]) || buttons[dir > 0 ? 'first' : 'last'](); + $(activeButton).trigger('focus'); e.preventDefault(); } }, diff --git a/public/webshims/shims/jme/mediacontrols.js b/public/webshims/shims/jme/mediacontrols.js index 1cda94fa1a79e40dd4be9f64795d2595ee443cf6..7859f70502138d8269fa2e031b594873510c0699 100644 --- a/public/webshims/shims/jme/mediacontrols.js +++ b/public/webshims/shims/jme/mediacontrols.js @@ -151,17 +151,33 @@ webshims.register('mediacontrols', function($, webshims, window){ var regYt = /youtube\.com\/[watch\?|v\/]+/i; var isInitial = data.media.prop('paused'); + var isEnded = data.media.prop('ended'); if(isInitial){ data.player.addClass('initial-state'); } + if(isEnded){ + data.player.addClass('ended-state'); + } if(!('backgroundSize' in $poster[0].style)){ data.player.addClass('no-backgroundsize'); } - data.media.on('playing waiting seeked seeking', function(){ + data.media.on('play playing waiting seeked seeking', function(e){ + if(isInitial){ isInitial = false; data.player.removeClass('initial-state'); } + + if(isEnded){ + isEnded = false; + data.player.removeClass('ended-state'); + } + }); + data.media.on('ended', function(){ + if(!isEnded && !data.media.prop('loop') && data.media.prop('ended')){ + isEnded = true; + data.player.addClass('ended-state'); + } }); return function(){ var poster = data.media.attr('poster'); @@ -193,6 +209,11 @@ webshims.register('mediacontrols', function($, webshims, window){ isInitial = true; } + if(isEnded){ + isEnded = false; + data.player.removeClass('ended-state'); + } + if(lastYoutubeState !== hasYt){ lastYoutubeState = hasYt; data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); diff --git a/public/webshims/shims/mediaelement-core.js b/public/webshims/shims/mediaelement-core.js index f1f2aaa454788e379c80d26ab9338a30cc2a8c1b..a5ded212d69e59ad8b018f1344a7d8f6e3e64db0 100644 --- a/public/webshims/shims/mediaelement-core.js +++ b/public/webshims/shims/mediaelement-core.js @@ -531,6 +531,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u webshims.ready(swfType, initMediaElements); } webshims.ready('track', loadTrackUi); + + if(document.readyState == 'complete'){ + webshims.isReady('WINDOWLOAD', true); + } }); })(webshims); diff --git a/public/webshims/shims/mediaelement-jaris.js b/public/webshims/shims/mediaelement-jaris.js index a12b6cbe28b5761acaa17f1720e31885cd319b58..f2e58ccec4ca7d6ed3b0f60a855155b59dc44cf3 100644 --- a/public/webshims/shims/mediaelement-jaris.js +++ b/public/webshims/shims/mediaelement-jaris.js @@ -127,6 +127,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document, var onEvent = { onPlayPause: function(jaris, data, override){ var playing, type; + var idled = data.paused || data.ended; if(override == null){ try { playing = data.api.api_get("isPlaying"); @@ -134,7 +135,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document, } else { playing = override; } - if(playing == data.paused){ + if(playing == idled || playing == null){ data.paused = !playing; type = data.paused ? 'pause' : 'play'; @@ -1211,11 +1212,11 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document, var media, error, parent; if( ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) && - (media = $(e.target).closest('audio, video')) && !media.is('.nonnative-api-active') + (media = $(e.target).closest('audio, video')) && !media.hasClass('nonnative-api-active') ){ error = media.prop('error'); setTimeout(function(){ - if(!media.is('.nonnative-api-active')){ + if(!media.hasClass('nonnative-api-active')){ if(error && switchErrors[error.code]){ options.preferFlash = true; document.removeEventListener('error', switchOptions, true); diff --git a/public/webshims/shims/picture.js b/public/webshims/shims/picture.js index 458c4e2c60cac4c0ef40bb5aa1b66ea9fcddb362..0be63903146fd52a11a084b3818fa9597e4eedc4 100644 --- a/public/webshims/shims/picture.js +++ b/public/webshims/shims/picture.js @@ -10,23 +10,65 @@ webshim.isReady('picture', true); setTimeout(function(){ - webshim.ready('matchMedia', function(){ - if(window.picturefill){ - var sel = 'picture, img[srcset]'; - webshim.addReady(function(context){ - if(context.querySelector(sel)){ - window.picturefill(); - } - }); - } - }); + if(window.picturefill){ + var sel = 'picture, img[srcset]'; + webshim.addReady(function(context){ + if(context.querySelector(sel)){ + window.picturefill(); + } + }); + } }); })(); - -/*! Picturefill - v2.1.0-beta - 2014-06-03 +/*! Picturefill - v2.1.0-beta - 2014-07-15 * http://scottjehl.github.io/picturefill * Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ +/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ + +window.matchMedia || (window.matchMedia = function() { + "use strict"; + + // For browsers that support matchMedium api such as IE 9 and webkit + var styleMedia = (window.styleMedia || window.media); + + // For those that don't support matchMedium + if (!styleMedia) { + var style = document.createElement('style'), + script = document.getElementsByTagName('script')[0], + info = null; + + style.type = 'text/css'; + style.id = 'matchmediajs-test'; + + script.parentNode.insertBefore(style, script); + // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers + info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; + + styleMedia = { + matchMedium: function(media) { + var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; + + // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers + if (style.styleSheet) { + style.styleSheet.cssText = text; + } else { + style.textContent = text; + } + + // Test if media query is true or false + return info.width === '1px'; + } + }; + } + + return function(media) { + return { + matches: styleMedia.matchMedium(media || 'all'), + media: media || 'all' + }; + }; +}()); /*! Picturefill - Responsive Images that work today. * Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar ) * License: MIT/GPLv2 @@ -38,6 +80,7 @@ // If picture is supported, well, that's awesome. Let's get outta here... if ( w.HTMLPictureElement ) { + w.picturefill = function() { }; return; } @@ -51,7 +94,8 @@ pf.ns = "picturefill"; // srcset support test - pf.srcsetSupported = new w.Image().srcset !== undefined; + pf.srcsetSupported = "srcset" in doc.createElement( "img" ); + pf.sizesSupported = w.HTMLImageElement.sizes; // just a string trim workaround pf.trim = function( str ) { @@ -82,8 +126,8 @@ * http://dev.w3.org/csswg/css-values-3/#length-value */ pf.getWidthFromLength = function( length ) { - // If no length was specified, or it is 0, default to `100vw` (per the spec). - length = length && parseFloat( length ) > 0 ? length : "100vw"; + // If no length was specified, or it is 0 or negative, default to `100vw` (per the spec). + length = length && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 ) ? length : "100vw"; /** * If length is specified in `vw` units, use `%` instead since the div we’re measuring @@ -101,7 +145,12 @@ // Positioning styles help prevent padding/margin/width on `html` from throwing calculations off. pf.lengthEl.style.cssText = "position: absolute; left: 0; width: " + length + ";"; - // Using offsetWidth to get width from CSS + + if ( pf.lengthEl.offsetWidth <= 0 ) { + // Something has gone wrong. `calc()` is in use and unsupported, most likely. Default to `100vw` (`100%`, for broader support.): + pf.lengthEl.style.cssText = "width: 100%;"; + } + return pf.lengthEl.offsetWidth; }; @@ -263,38 +312,32 @@ return candidates; }; - pf.parseDescriptor = function( descriptor, sizes ) { + pf.parseDescriptor = function( descriptor, sizesattr ) { // 11. Descriptor parser: Let candidates be an initially empty source set. The order of entries in the list // is the order in which entries are added to the list. - var sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""), - widthInCssPixels = sizes ? pf.findWidthFromSourceSize( sizes ) : "100%", + var sizes = sizesattr || "100vw", + sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""), + widthInCssPixels = pf.findWidthFromSourceSize( sizes ), resCandidate; if ( sizeDescriptor ) { var splitDescriptor = sizeDescriptor.split(" "); for (var i = splitDescriptor.length + 1; i >= 0; i--) { - - var curr = splitDescriptor[ i ], - lastchar = curr && curr.slice( curr.length - 1 ); - - if ( lastchar === "w" || lastchar === "x" ) { - resCandidate = curr; - } - if ( sizes && resCandidate ) { - // get the dpr by taking the length / width in css pixels - resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) ); - } else { - // get the dpr by grabbing the value of Nx - var res = curr && parseFloat( curr, 10 ); - - resCandidate = res && !isNaN( res ) && lastchar === "x" || lastchar === "w" ? res : 1; + if ( splitDescriptor[ i ] !== undefined ) { + var curr = splitDescriptor[ i ], + lastchar = curr && curr.slice( curr.length - 1 ); + + if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) { + resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) ); + } else if ( lastchar === "x" ) { + var res = curr && parseFloat( curr, 10 ); + resCandidate = res && !isNaN( res ) ? res : 1; + } } } - } else { - resCandidate = 1; } - return resCandidate; + return resCandidate || 1; }; /** @@ -372,7 +415,7 @@ } } - if ( !pf.endsWith( picImg.src, bestCandidate.url ) ) { + if ( bestCandidate && !pf.endsWith( picImg.src, bestCandidate.url ) ) { picImg.src = bestCandidate.url; // currentSrc attribute and property to match // http://picture.responsiveimages.org/#the-img-element @@ -405,32 +448,26 @@ }; /* - * Find all picture elements and, - * in browsers that don't natively support srcset, find all img elements - * with srcset attrs that don't have picture parents + * Find all `img` elements, and add them to the candidate list if they have + * a `picture` parent, a `sizes` attribute in basic `srcset` supporting browsers, + * a `srcset` attribute at all, and they haven’t been evaluated already. */ pf.getAllElements = function() { - var pictures = doc.getElementsByTagName( "picture" ), - elems = [], + var elems = [], imgs = doc.getElementsByTagName( "img" ); - for ( var h = 0, len = pictures.length + imgs.length; h < len; h++ ) { - if ( h < pictures.length ) { - elems[ h ] = pictures[ h ]; - } else { - var currImg = imgs[ h - pictures.length ]; + for ( var h = 0, len = imgs.length; h < len; h++ ) { + var currImg = imgs[ h ]; - if ( currImg.parentNode.nodeName.toUpperCase() !== "PICTURE" && - ( ( pf.srcsetSupported && currImg.getAttribute( "sizes" ) ) || - currImg.getAttribute( "srcset" ) !== null ) ) { - elems.push( currImg ); - } + if ( currImg.parentNode.nodeName.toUpperCase() === "PICTURE" || + ( currImg.getAttribute( "srcset" ) !== null ) || currImg[ pf.ns ] && currImg[ pf.ns ].srcset !== null ) { + elems.push( currImg ); } } return elems; }; - pf.getMatch = function( picture ) { + pf.getMatch = function( img, picture ) { var sources = picture.childNodes, match; @@ -443,9 +480,9 @@ continue; } - // Hitting an `img` element stops the search for `sources`. + // Hitting the `img` element that started everything stops the search for `sources`. // If no previous `source` matches, the `img` itself is evaluated later. - if ( source.nodeName.toUpperCase() === "IMG" ) { + if ( source === img ) { return match; } @@ -477,24 +514,22 @@ return match; }; - function picturefill( options ) { + function picturefill( opt ) { var elements, element, - elemType, + parent, firstMatch, candidates, - picImg; - options = options || {}; + options = opt || {}; elements = options.elements || pf.getAllElements(); // Loop through all elements for ( var i = 0, plen = elements.length; i < plen; i++ ) { element = elements[ i ]; - elemType = element.nodeName.toUpperCase(); + parent = element.parentNode; firstMatch = undefined; candidates = undefined; - picImg = undefined; // expando for caching data on the img if ( !element[ pf.ns ] ) { @@ -508,16 +543,16 @@ continue; } - // if element is a picture element - if ( elemType === "PICTURE" ) { + // if `img` is in a `picture` element + if ( parent.nodeName.toUpperCase() === "PICTURE" ) { // IE9 video workaround - pf.removeVideoShim( element ); + pf.removeVideoShim( parent ); // return the first match which might undefined // returns false if there is a pending source // TODO the return type here is brutal, cleanup - firstMatch = pf.getMatch( element ); + firstMatch = pf.getMatch( element, parent ); // if any sources are pending in this picture due to async type test(s) // remove the evaluated attr and skip for now ( the pending test will @@ -525,43 +560,32 @@ if ( firstMatch === false ) { continue; } - - // Find any existing img element in the picture element - picImg = element.getElementsByTagName( "img" )[ 0 ]; } else { - // if it's an img element firstMatch = undefined; - picImg = element; } - if ( picImg ) { - - // expando for caching data on the img - if ( !picImg[ pf.ns ] ) { - picImg[ pf.ns ] = {}; - } - - // Cache and remove `srcset` if present and we’re going to be doing `sizes`/`picture` polyfilling to it. - if ( picImg.srcset && ( elemType === "PICTURE" || picImg.getAttribute( "sizes" ) ) ) { - pf.dodgeSrcset( picImg ); - } - - if ( firstMatch ) { - candidates = pf.processSourceSet( firstMatch ); - pf.applyBestCandidate( candidates, picImg ); - } else { - // No sources matched, so we’re down to processing the inner `img` as a source. - candidates = pf.processSourceSet( picImg ); + // Cache and remove `srcset` if present and we’re going to be doing `picture`/`srcset`/`sizes` polyfilling to it. + if ( parent.nodeName.toUpperCase() === "PICTURE" || + ( element.srcset && !pf.srcsetSupported ) || + ( !pf.sizesSupported && ( element.srcset && element.srcset.indexOf("w") > -1 ) ) ) { + pf.dodgeSrcset( element ); + } - if ( picImg.srcset === undefined || picImg[ pf.ns ].srcset ) { - // Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality. - pf.applyBestCandidate( candidates, picImg ); - } // Else, resolution-only `srcset` is supported natively. - } + if ( firstMatch ) { + candidates = pf.processSourceSet( firstMatch ); + pf.applyBestCandidate( candidates, element ); + } else { + // No sources matched, so we’re down to processing the inner `img` as a source. + candidates = pf.processSourceSet( element ); - // set evaluated to true to avoid unnecessary reparsing - element[ pf.ns ].evaluated = true; + if ( element.srcset === undefined || element[ pf.ns ].srcset ) { + // Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality. + pf.applyBestCandidate( candidates, element ); + } // Else, resolution-only `srcset` is supported natively. } + + // set evaluated to true to avoid unnecessary reparsing + element[ pf.ns ].evaluated = true; } } @@ -596,7 +620,7 @@ } } - webshim.ready('matchMedia', runPicturefill); + runPicturefill(); /* expose methods for testing */ picturefill._ = pf; @@ -615,3 +639,4 @@ } )( this, this.document ); + diff --git a/public/webshims/shims/plugins/jquery.ui.position.js b/public/webshims/shims/plugins/jquery.ui.position.js index b5a4e84c3d55b68ed747a7e62c4d15cf2430ebe0..12c4e7dfeda5ca984a38b51e263a85bb4601030a 100644 --- a/public/webshims/shims/plugins/jquery.ui.position.js +++ b/public/webshims/shims/plugins/jquery.ui.position.js @@ -1,497 +1,515 @@ /*! - * jQuery UI Position 1.10.3 + * jQuery UI Position 1.11.0 * http://jqueryui.com * - * Copyright 2013 jQuery Foundation and other contributors + * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/position/ */ -(function( $, undefined ) { - -$.ui = $.ui || {}; - -var cachedScrollbarWidth, - max = Math.max, - abs = Math.abs, - round = Math.round, - rhorizontal = /left|center|right/, - rvertical = /top|center|bottom/, - roffset = /[\+\-]\d+(\.[\d]+)?%?/, - rposition = /^\w+/, - rpercent = /%$/, - _position = $.fn.position; - -function getOffsets( offsets, width, height ) { - return [ - parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), - parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) - ]; -} - -function parseCss( element, property ) { - return parseInt( $.css( element, property ), 10 ) || 0; -} - -function getDimensions( elem ) { - var raw = elem[0]; - if ( raw.nodeType === 9 ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: 0, left: 0 } - }; - } - if ( $.isWindow( raw ) ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: elem.scrollTop(), left: elem.scrollLeft() } - }; - } - if ( raw.preventDefault ) { - return { - width: 0, - height: 0, - offset: { top: raw.pageY, left: raw.pageX } - }; +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( window.webshims && window.webshims.$ || jQuery ); } - return { - width: elem.outerWidth(), - height: elem.outerHeight(), - offset: elem.offset() - }; -} - -$.position = { - scrollbarWidth: function() { - if ( cachedScrollbarWidth !== undefined ) { - return cachedScrollbarWidth; +}(function( $ ) { + (function() { + + $.ui = $.ui || {}; + + var cachedScrollbarWidth, supportsOffsetFractions, + max = Math.max, + abs = Math.abs, + round = Math.round, + rhorizontal = /left|center|right/, + rvertical = /top|center|bottom/, + roffset = /[\+\-]\d+(\.[\d]+)?%?/, + rposition = /^\w+/, + rpercent = /%$/, + _position = $.fn.position; + + function getOffsets( offsets, width, height ) { + return [ + parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), + parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) + ]; } - var w1, w2, - div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), - innerDiv = div.children()[0]; - - $( "body" ).append( div ); - w1 = innerDiv.offsetWidth; - div.css( "overflow", "scroll" ); - w2 = innerDiv.offsetWidth; + function parseCss( element, property ) { + return parseInt( $.css( element, property ), 10 ) || 0; + } - if ( w1 === w2 ) { - w2 = div[0].clientWidth; + function getDimensions( elem ) { + var raw = elem[0]; + if ( raw.nodeType === 9 ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: 0, left: 0 } + }; + } + if ( $.isWindow( raw ) ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: elem.scrollTop(), left: elem.scrollLeft() } + }; + } + if ( raw.preventDefault ) { + return { + width: 0, + height: 0, + offset: { top: raw.pageY, left: raw.pageX } + }; + } + return { + width: elem.outerWidth(), + height: elem.outerHeight(), + offset: elem.offset() + }; } - div.remove(); - - return (cachedScrollbarWidth = w1 - w2); - }, - getScrollInfo: function( within ) { - var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), - overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), - hasOverflowX = overflowX === "scroll" || - ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), - hasOverflowY = overflowY === "scroll" || - ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); - return { - width: hasOverflowY ? $.position.scrollbarWidth() : 0, - height: hasOverflowX ? $.position.scrollbarWidth() : 0 - }; - }, - getWithinInfo: function( element ) { - var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ); - return { - element: withinElement, - isWindow: isWindow, - offset: withinElement.offset() || { left: 0, top: 0 }, - scrollLeft: withinElement.scrollLeft(), - scrollTop: withinElement.scrollTop(), - width: isWindow ? withinElement.width() : withinElement.outerWidth(), - height: isWindow ? withinElement.height() : withinElement.outerHeight() - }; - } -}; + $.position = { + scrollbarWidth: function() { + if ( cachedScrollbarWidth !== undefined ) { + return cachedScrollbarWidth; + } + var w1, w2, + div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), + innerDiv = div.children()[0]; -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } + $( "body" ).append( div ); + w1 = innerDiv.offsetWidth; + div.css( "overflow", "scroll" ); - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); + w2 = innerDiv.offsetWidth; - var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), - within = $.position.getWithinInfo( options.within ), - scrollInfo = $.position.getScrollInfo( within ), - collision = ( options.collision || "flip" ).split( " " ), - offsets = {}; + if ( w1 === w2 ) { + w2 = div[0].clientWidth; + } - dimensions = getDimensions( target ); - if ( target[0].preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - } - targetWidth = dimensions.width; - targetHeight = dimensions.height; - targetOffset = dimensions.offset; - // clone to reuse original targetOffset later - basePosition = $.extend( {}, targetOffset ); - - // force my and at to have valid horizontal and vertical positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[ this ] || "" ).split( " " ), - horizontalOffset, - verticalOffset; - - if ( pos.length === 1) { - pos = rhorizontal.test( pos[ 0 ] ) ? - pos.concat( [ "center" ] ) : - rvertical.test( pos[ 0 ] ) ? - [ "center" ].concat( pos ) : - [ "center", "center" ]; - } - pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; - pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; - - // calculate offsets - horizontalOffset = roffset.exec( pos[ 0 ] ); - verticalOffset = roffset.exec( pos[ 1 ] ); - offsets[ this ] = [ - horizontalOffset ? horizontalOffset[ 0 ] : 0, - verticalOffset ? verticalOffset[ 0 ] : 0 - ]; - - // reduce to just the positions without the offsets - options[ this ] = [ - rposition.exec( pos[ 0 ] )[ 0 ], - rposition.exec( pos[ 1 ] )[ 0 ] - ]; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } + div.remove(); + + return (cachedScrollbarWidth = w1 - w2); + }, + getScrollInfo: function( within ) { + var overflowX = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-x" ), + overflowY = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-y" ), + hasOverflowX = overflowX === "scroll" || + ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), + hasOverflowY = overflowY === "scroll" || + ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); + return { + width: hasOverflowY ? $.position.scrollbarWidth() : 0, + height: hasOverflowX ? $.position.scrollbarWidth() : 0 + }; + }, + getWithinInfo: function( element ) { + var withinElement = $( element || window ), + isWindow = $.isWindow( withinElement[0] ), + isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; + return { + element: withinElement, + isWindow: isWindow, + isDocument: isDocument, + offset: withinElement.offset() || { left: 0, top: 0 }, + scrollLeft: withinElement.scrollLeft(), + scrollTop: withinElement.scrollTop(), + width: isWindow ? withinElement.width() : withinElement.outerWidth(), + height: isWindow ? withinElement.height() : withinElement.outerHeight() + }; + } + }; - if ( options.at[ 0 ] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[ 0 ] === "center" ) { - basePosition.left += targetWidth / 2; - } + $.fn.position = function( options ) { + if ( !options || !options.of ) { + return _position.apply( this, arguments ); + } - if ( options.at[ 1 ] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[ 1 ] === "center" ) { - basePosition.top += targetHeight / 2; - } + // make a copy, we don't want to modify arguments + options = $.extend( {}, options ); - atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); - basePosition.left += atOffset[ 0 ]; - basePosition.top += atOffset[ 1 ]; - - return this.each(function() { - var collisionPosition, using, - elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseCss( this, "marginLeft" ), - marginTop = parseCss( this, "marginTop" ), - collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, - collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, - position = $.extend( {}, basePosition ), - myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); - - if ( options.my[ 0 ] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[ 0 ] === "center" ) { - position.left -= elemWidth / 2; - } + var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, + target = $( options.of ), + within = $.position.getWithinInfo( options.within ), + scrollInfo = $.position.getScrollInfo( within ), + collision = ( options.collision || "flip" ).split( " " ), + offsets = {}; - if ( options.my[ 1 ] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[ 1 ] === "center" ) { - position.top -= elemHeight / 2; - } + dimensions = getDimensions( target ); + if ( target[0].preventDefault ) { + // force left top to allow flipping + options.at = "left top"; + } + targetWidth = dimensions.width; + targetHeight = dimensions.height; + targetOffset = dimensions.offset; + // clone to reuse original targetOffset later + basePosition = $.extend( {}, targetOffset ); + + // force my and at to have valid horizontal and vertical positions + // if a value is missing or invalid, it will be converted to center + $.each( [ "my", "at" ], function() { + var pos = ( options[ this ] || "" ).split( " " ), + horizontalOffset, + verticalOffset; + + if ( pos.length === 1) { + pos = rhorizontal.test( pos[ 0 ] ) ? + pos.concat( [ "center" ] ) : + rvertical.test( pos[ 0 ] ) ? + [ "center" ].concat( pos ) : + [ "center", "center" ]; + } + pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; + pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; + + // calculate offsets + horizontalOffset = roffset.exec( pos[ 0 ] ); + verticalOffset = roffset.exec( pos[ 1 ] ); + offsets[ this ] = [ + horizontalOffset ? horizontalOffset[ 0 ] : 0, + verticalOffset ? verticalOffset[ 0 ] : 0 + ]; + + // reduce to just the positions without the offsets + options[ this ] = [ + rposition.exec( pos[ 0 ] )[ 0 ], + rposition.exec( pos[ 1 ] )[ 0 ] + ]; + }); + + // normalize collision option + if ( collision.length === 1 ) { + collision[ 1 ] = collision[ 0 ]; + } - position.left += myOffset[ 0 ]; - position.top += myOffset[ 1 ]; + if ( options.at[ 0 ] === "right" ) { + basePosition.left += targetWidth; + } else if ( options.at[ 0 ] === "center" ) { + basePosition.left += targetWidth / 2; + } - // if the browser doesn't support fractions, then round for consistent results - if ( !$.support.offsetFractions ) { - position.left = round( position.left ); - position.top = round( position.top ); - } + if ( options.at[ 1 ] === "bottom" ) { + basePosition.top += targetHeight; + } else if ( options.at[ 1 ] === "center" ) { + basePosition.top += targetHeight / 2; + } - collisionPosition = { - marginLeft: marginLeft, - marginTop: marginTop - }; + atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); + basePosition.left += atOffset[ 0 ]; + basePosition.top += atOffset[ 1 ]; + + return this.each(function() { + var collisionPosition, using, + elem = $( this ), + elemWidth = elem.outerWidth(), + elemHeight = elem.outerHeight(), + marginLeft = parseCss( this, "marginLeft" ), + marginTop = parseCss( this, "marginTop" ), + collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, + collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, + position = $.extend( {}, basePosition ), + myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); + + if ( options.my[ 0 ] === "right" ) { + position.left -= elemWidth; + } else if ( options.my[ 0 ] === "center" ) { + position.left -= elemWidth / 2; + } - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[ i ] ] ) { - $.ui.position[ collision[ i ] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], - my: options.my, - at: options.at, - within: within, - elem : elem - }); - } - }); - - if ( options.using ) { - // adds feedback as second argument to using callback, if present - using = function( props ) { - var left = targetOffset.left - position.left, - right = left + targetWidth - elemWidth, - top = targetOffset.top - position.top, - bottom = top + targetHeight - elemHeight, - feedback = { - target: { - element: target, - left: targetOffset.left, - top: targetOffset.top, - width: targetWidth, - height: targetHeight - }, - element: { - element: elem, - left: position.left, - top: position.top, - width: elemWidth, - height: elemHeight - }, - horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", - vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" - }; - if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { - feedback.horizontal = "center"; + if ( options.my[ 1 ] === "bottom" ) { + position.top -= elemHeight; + } else if ( options.my[ 1 ] === "center" ) { + position.top -= elemHeight / 2; } - if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { - feedback.vertical = "middle"; + + position.left += myOffset[ 0 ]; + position.top += myOffset[ 1 ]; + + // if the browser doesn't support fractions, then round for consistent results + if ( !supportsOffsetFractions ) { + position.left = round( position.left ); + position.top = round( position.top ); } - if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { - feedback.important = "horizontal"; - } else { - feedback.important = "vertical"; + + collisionPosition = { + marginLeft: marginLeft, + marginTop: marginTop + }; + + $.each( [ "left", "top" ], function( i, dir ) { + if ( $.ui.position[ collision[ i ] ] ) { + $.ui.position[ collision[ i ] ][ dir ]( position, { + targetWidth: targetWidth, + targetHeight: targetHeight, + elemWidth: elemWidth, + elemHeight: elemHeight, + collisionPosition: collisionPosition, + collisionWidth: collisionWidth, + collisionHeight: collisionHeight, + offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], + my: options.my, + at: options.at, + within: within, + elem: elem + }); + } + }); + + if ( options.using ) { + // adds feedback as second argument to using callback, if present + using = function( props ) { + var left = targetOffset.left - position.left, + right = left + targetWidth - elemWidth, + top = targetOffset.top - position.top, + bottom = top + targetHeight - elemHeight, + feedback = { + target: { + element: target, + left: targetOffset.left, + top: targetOffset.top, + width: targetWidth, + height: targetHeight + }, + element: { + element: elem, + left: position.left, + top: position.top, + width: elemWidth, + height: elemHeight + }, + horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", + vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" + }; + if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { + feedback.horizontal = "center"; + } + if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { + feedback.vertical = "middle"; + } + if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { + feedback.important = "horizontal"; + } else { + feedback.important = "vertical"; + } + options.using.call( this, props, feedback ); + }; } - options.using.call( this, props, feedback ); - }; - } - elem.offset( $.extend( position, { using: using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, - outerWidth = within.width, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = withinOffset - collisionPosLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, - newOverRight; - - // element is wider than within - if ( data.collisionWidth > outerWidth ) { - // element is initially over the left side of within - if ( overLeft > 0 && overRight <= 0 ) { - newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; - position.left += overLeft - newOverRight; - // element is initially over right side of within - } else if ( overRight > 0 && overLeft <= 0 ) { - position.left = withinOffset; - // element is initially over both left and right sides of within - } else { - if ( overLeft > overRight ) { - position.left = withinOffset + outerWidth - data.collisionWidth; + elem.offset( $.extend( position, { using: using } ) ); + }); + }; + + $.ui.position = { + fit: { + left: function( position, data ) { + var within = data.within, + withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, + outerWidth = within.width, + collisionPosLeft = position.left - data.collisionPosition.marginLeft, + overLeft = withinOffset - collisionPosLeft, + overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, + newOverRight; + + // element is wider than within + if ( data.collisionWidth > outerWidth ) { + // element is initially over the left side of within + if ( overLeft > 0 && overRight <= 0 ) { + newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; + position.left += overLeft - newOverRight; + // element is initially over right side of within + } else if ( overRight > 0 && overLeft <= 0 ) { + position.left = withinOffset; + // element is initially over both left and right sides of within + } else { + if ( overLeft > overRight ) { + position.left = withinOffset + outerWidth - data.collisionWidth; + } else { + position.left = withinOffset; + } + } + // too far left -> align with left edge + } else if ( overLeft > 0 ) { + position.left += overLeft; + // too far right -> align with right edge + } else if ( overRight > 0 ) { + position.left -= overRight; + // adjust based on position and margin } else { - position.left = withinOffset; + position.left = max( position.left - collisionPosLeft, position.left ); } - } - // too far left -> align with left edge - } else if ( overLeft > 0 ) { - position.left += overLeft; - // too far right -> align with right edge - } else if ( overRight > 0 ) { - position.left -= overRight; - // adjust based on position and margin - } else { - position.left = max( position.left - collisionPosLeft, position.left ); - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollTop : within.offset.top, - outerHeight = data.within.height, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = withinOffset - collisionPosTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, - newOverBottom; - - // element is taller than within - if ( data.collisionHeight > outerHeight ) { - // element is initially over the top of within - if ( overTop > 0 && overBottom <= 0 ) { - newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; - position.top += overTop - newOverBottom; - // element is initially over bottom of within - } else if ( overBottom > 0 && overTop <= 0 ) { - position.top = withinOffset; - // element is initially over both top and bottom of within - } else { - if ( overTop > overBottom ) { - position.top = withinOffset + outerHeight - data.collisionHeight; + }, + top: function( position, data ) { + var within = data.within, + withinOffset = within.isWindow ? within.scrollTop : within.offset.top, + outerHeight = data.within.height, + collisionPosTop = position.top - data.collisionPosition.marginTop, + overTop = withinOffset - collisionPosTop, + overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, + newOverBottom; + + // element is taller than within + if ( data.collisionHeight > outerHeight ) { + // element is initially over the top of within + if ( overTop > 0 && overBottom <= 0 ) { + newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; + position.top += overTop - newOverBottom; + // element is initially over bottom of within + } else if ( overBottom > 0 && overTop <= 0 ) { + position.top = withinOffset; + // element is initially over both top and bottom of within + } else { + if ( overTop > overBottom ) { + position.top = withinOffset + outerHeight - data.collisionHeight; + } else { + position.top = withinOffset; + } + } + // too far up -> align with top + } else if ( overTop > 0 ) { + position.top += overTop; + // too far down -> align with bottom edge + } else if ( overBottom > 0 ) { + position.top -= overBottom; + // adjust based on position and margin } else { - position.top = withinOffset; + position.top = max( position.top - collisionPosTop, position.top ); } } - // too far up -> align with top - } else if ( overTop > 0 ) { - position.top += overTop; - // too far down -> align with bottom edge - } else if ( overBottom > 0 ) { - position.top -= overBottom; - // adjust based on position and margin - } else { - position.top = max( position.top - collisionPosTop, position.top ); - } - } - }, - flip: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.offset.left + within.scrollLeft, - outerWidth = within.width, - offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = collisionPosLeft - offsetLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - data.at[ 0 ] === "right" ? - -data.targetWidth : - 0, - offset = -2 * data.offset[ 0 ], - newOverRight, - newOverLeft; - - if ( overLeft < 0 ) { - newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; - if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { - position.left += myOffset + atOffset + offset; + }, + flip: { + left: function( position, data ) { + var within = data.within, + withinOffset = within.offset.left + within.scrollLeft, + outerWidth = within.width, + offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, + collisionPosLeft = position.left - data.collisionPosition.marginLeft, + overLeft = collisionPosLeft - offsetLeft, + overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, + myOffset = data.my[ 0 ] === "left" ? + -data.elemWidth : + data.my[ 0 ] === "right" ? + data.elemWidth : + 0, + atOffset = data.at[ 0 ] === "left" ? + data.targetWidth : + data.at[ 0 ] === "right" ? + -data.targetWidth : + 0, + offset = -2 * data.offset[ 0 ], + newOverRight, + newOverLeft; + + if ( overLeft < 0 ) { + newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; + if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { + position.left += myOffset + atOffset + offset; + } + } else if ( overRight > 0 ) { + newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; + if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { + position.left += myOffset + atOffset + offset; + } + } + }, + top: function( position, data ) { + var within = data.within, + withinOffset = within.offset.top + within.scrollTop, + outerHeight = within.height, + offsetTop = within.isWindow ? within.scrollTop : within.offset.top, + collisionPosTop = position.top - data.collisionPosition.marginTop, + overTop = collisionPosTop - offsetTop, + overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, + top = data.my[ 1 ] === "top", + myOffset = top ? + -data.elemHeight : + data.my[ 1 ] === "bottom" ? + data.elemHeight : + 0, + atOffset = data.at[ 1 ] === "top" ? + data.targetHeight : + data.at[ 1 ] === "bottom" ? + -data.targetHeight : + 0, + offset = -2 * data.offset[ 1 ], + newOverTop, + newOverBottom; + if ( overTop < 0 ) { + newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; + if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { + position.top += myOffset + atOffset + offset; + } + } else if ( overBottom > 0 ) { + newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; + if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { + position.top += myOffset + atOffset + offset; + } + } } - } - else if ( overRight > 0 ) { - newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; - if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { - position.left += myOffset + atOffset + offset; + }, + flipfit: { + left: function() { + $.ui.position.flip.left.apply( this, arguments ); + $.ui.position.fit.left.apply( this, arguments ); + }, + top: function() { + $.ui.position.flip.top.apply( this, arguments ); + $.ui.position.fit.top.apply( this, arguments ); } } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.offset.top + within.scrollTop, - outerHeight = within.height, - offsetTop = within.isWindow ? within.scrollTop : within.offset.top, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = collisionPosTop - offsetTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, - top = data.my[ 1 ] === "top", - myOffset = top ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - data.at[ 1 ] === "bottom" ? - -data.targetHeight : - 0, - offset = -2 * data.offset[ 1 ], - newOverTop, - newOverBottom; - if ( overTop < 0 ) { - newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; - if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { - position.top += myOffset + atOffset + offset; - } + }; + +// fraction support test + (function() { + var testElement, testElementParent, testElementStyle, offsetLeft, i, + body = document.getElementsByTagName( "body" )[ 0 ], + div = document.createElement( "div" ); + + //Create a "fake body" for testing based on method used in jQuery.support + testElement = document.createElement( body ? "div" : "body" ); + testElementStyle = { + visibility: "hidden", + width: 0, + height: 0, + border: 0, + margin: 0, + background: "none" + }; + if ( body ) { + $.extend( testElementStyle, { + position: "absolute", + left: "-1000px", + top: "-1000px" + }); } - else if ( overBottom > 0 ) { - newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; - if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { - position.top += myOffset + atOffset + offset; - } + for ( i in testElementStyle ) { + testElement.style[ i ] = testElementStyle[ i ]; } - } - }, - flipfit: { - left: function() { - $.ui.position.flip.left.apply( this, arguments ); - $.ui.position.fit.left.apply( this, arguments ); - }, - top: function() { - $.ui.position.flip.top.apply( this, arguments ); - $.ui.position.fit.top.apply( this, arguments ); - } - } -}; + testElement.appendChild( div ); + testElementParent = body || document.documentElement; + testElementParent.insertBefore( testElement, testElementParent.firstChild ); -// fraction support test -(function () { - var testElement, testElementParent, testElementStyle, offsetLeft, i, - body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ); - - //Create a "fake body" for testing based on method used in jQuery.support - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - $.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || document.documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); + div.style.cssText = "position: absolute; left: 10.7432222px;"; + + offsetLeft = $( div ).offset().left; + supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; + + testElement.innerHTML = ""; + testElementParent.removeChild( testElement ); + })(); - div.style.cssText = "position: absolute; left: 10.7432222px;"; + })(); - offsetLeft = $( div ).offset().left; - $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; + return $.ui.position; - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); -})(); +})); -}( window.webshims && window.webshims.$ || jQuery ) ); diff --git a/public/webshims/shims/promise.js b/public/webshims/shims/promise.js deleted file mode 100644 index 5619cfa53ee5c1d14234f2d34b625a31f151a86b..0000000000000000000000000000000000000000 --- a/public/webshims/shims/promise.js +++ /dev/null @@ -1,684 +0,0 @@ -(function() { -var define, requireModule, require, requirejs; - -(function() { - var registry = {}, seen = {}; - - define = function(name, deps, callback) { - registry[name] = { deps: deps, callback: callback }; - }; - - requirejs = require = requireModule = function(name) { - requirejs._eak_seen = registry; - - if (seen[name]) { return seen[name]; } - seen[name] = {}; - - if (!registry[name]) { - throw new Error("Could not find module " + name); - } - - var mod = registry[name], - deps = mod.deps, - callback = mod.callback, - reified = [], - exports; - - for (var i=0, l=deps.length; i<l; i++) { - if (deps[i] === 'exports') { - reified.push(exports = {}); - } else { - reified.push(requireModule(resolve(deps[i]))); - } - } - - var value = callback.apply(this, reified); - return seen[name] = exports || value; - - function resolve(child) { - if (child.charAt(0) !== '.') { return child; } - var parts = child.split("/"); - var parentBase = name.split("/").slice(0, -1); - - for (var i=0, l=parts.length; i<l; i++) { - var part = parts[i]; - - if (part === '..') { parentBase.pop(); } - else if (part === '.') { continue; } - else { parentBase.push(part); } - } - - return parentBase.join("/"); - } - }; -})(); - -define("promise/all", - ["./utils","exports"], - function(__dependency1__, __exports__) { - "use strict"; - /* global toString */ - - var isArray = __dependency1__.isArray; - var isFunction = __dependency1__.isFunction; - - /** - Returns a promise that is fulfilled when all the given promises have been - fulfilled, or rejected if any of them become rejected. The return promise - is fulfilled with an array that gives all the values in the order they were - passed in the `promises` array argument. - - Example: - - ```javascript - var promise1 = RSVP.resolve(1); - var promise2 = RSVP.resolve(2); - var promise3 = RSVP.resolve(3); - var promises = [ promise1, promise2, promise3 ]; - - RSVP.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `RSVP.all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - var promise1 = RSVP.resolve(1); - var promise2 = RSVP.reject(new Error("2")); - var promise3 = RSVP.reject(new Error("3")); - var promises = [ promise1, promise2, promise3 ]; - - RSVP.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @for RSVP - @param {Array} promises - @param {String} label - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - */ - function all(promises) { - /*jshint validthis:true */ - var Promise = this; - - if (!isArray(promises)) { - throw new TypeError('You must pass an array to all.'); - } - - return new Promise(function(resolve, reject) { - var results = [], remaining = promises.length, - promise; - - if (remaining === 0) { - resolve([]); - } - - function resolver(index) { - return function(value) { - resolveAll(index, value); - }; - } - - function resolveAll(index, value) { - results[index] = value; - if (--remaining === 0) { - resolve(results); - } - } - - for (var i = 0; i < promises.length; i++) { - promise = promises[i]; - - if (promise && isFunction(promise.then)) { - promise.then(resolver(i), reject); - } else { - resolveAll(i, promise); - } - } - }); - } - - __exports__.all = all; - }); -define("promise/asap", - ["exports"], - function(__exports__) { - "use strict"; - var browserGlobal = (typeof window !== 'undefined') ? window : {}; - var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; - var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this); - - // node - function useNextTick() { - return function() { - process.nextTick(flush); - }; - } - - function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - function useSetTimeout() { - return function() { - local.setTimeout(flush, 1); - }; - } - - var queue = []; - function flush() { - for (var i = 0; i < queue.length; i++) { - var tuple = queue[i]; - var callback = tuple[0], arg = tuple[1]; - callback(arg); - } - queue = []; - } - - var scheduleFlush; - - // Decide what async method to use to triggering processing of queued callbacks: - if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { - scheduleFlush = useNextTick(); - } else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); - } else { - scheduleFlush = useSetTimeout(); - } - - function asap(callback, arg) { - var length = queue.push([callback, arg]); - if (length === 1) { - // If length is 1, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - scheduleFlush(); - } - } - - __exports__.asap = asap; - }); -define("promise/config", - ["exports"], - function(__exports__) { - "use strict"; - var config = { - instrument: false - }; - - function configure(name, value) { - if (arguments.length === 2) { - config[name] = value; - } else { - return config[name]; - } - } - - __exports__.config = config; - __exports__.configure = configure; - }); -define("promise/polyfill", - ["./promise","./utils","exports"], - function(__dependency1__, __dependency2__, __exports__) { - "use strict"; - /*global self*/ - var RSVPPromise = __dependency1__.Promise; - var isFunction = __dependency2__.isFunction; - - function polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof window !== 'undefined' && window.document) { - local = window; - } else { - local = self; - } - - var es6PromiseSupport = - "Promise" in local && - // Some of these methods are missing from - // Firefox/Chrome experimental implementations - "resolve" in local.Promise && - "reject" in local.Promise && - "all" in local.Promise && - "race" in local.Promise && - // Older version of the spec had a resolver object - // as the arg rather than a function - (function() { - var resolve; - new local.Promise(function(r) { resolve = r; }); - return isFunction(resolve); - }()); - - if (!es6PromiseSupport) { - local.Promise = RSVPPromise; - } - } - - __exports__.polyfill = polyfill; - }); -define("promise/promise", - ["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"], - function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __exports__) { - "use strict"; - var config = __dependency1__.config; - var configure = __dependency1__.configure; - var objectOrFunction = __dependency2__.objectOrFunction; - var isFunction = __dependency2__.isFunction; - var now = __dependency2__.now; - var all = __dependency3__.all; - var race = __dependency4__.race; - var staticResolve = __dependency5__.resolve; - var staticReject = __dependency6__.reject; - var asap = __dependency7__.asap; - - var counter = 0; - - config.async = asap; // default async is asap; - - function Promise(resolver) { - if (!isFunction(resolver)) { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - if (!(this instanceof Promise)) { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - this._subscribers = []; - - invokeResolver(resolver, this); - } - - function invokeResolver(resolver, promise) { - function resolvePromise(value) { - resolve(promise, value); - } - - function rejectPromise(reason) { - reject(promise, reason); - } - - try { - resolver(resolvePromise, rejectPromise); - } catch(e) { - rejectPromise(e); - } - } - - function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - try { - value = callback(detail); - succeeded = true; - } catch(e) { - failed = true; - error = e; - } - } else { - value = detail; - succeeded = true; - } - - if (handleThenable(promise, value)) { - return; - } else if (hasCallback && succeeded) { - resolve(promise, value); - } else if (failed) { - reject(promise, error); - } else if (settled === FULFILLED) { - resolve(promise, value); - } else if (settled === REJECTED) { - reject(promise, value); - } - } - - var PENDING = void 0; - var SEALED = 0; - var FULFILLED = 1; - var REJECTED = 2; - - function subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - subscribers[length] = child; - subscribers[length + FULFILLED] = onFulfillment; - subscribers[length + REJECTED] = onRejection; - } - - function publish(promise, settled) { - var child, callback, subscribers = promise._subscribers, detail = promise._detail; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - invokeCallback(settled, child, callback, detail); - } - - promise._subscribers = null; - } - - Promise.prototype = { - constructor: Promise, - - _state: undefined, - _detail: undefined, - _subscribers: undefined, - - then: function(onFulfillment, onRejection) { - var promise = this; - - var thenPromise = new this.constructor(function() {}); - - if (this._state) { - var callbacks = arguments; - config.async(function invokePromiseCallback() { - invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail); - }); - } else { - subscribe(this, thenPromise, onFulfillment, onRejection); - } - - return thenPromise; - }, - - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - - Promise.all = all; - Promise.race = race; - Promise.resolve = staticResolve; - Promise.reject = staticReject; - - function handleThenable(promise, value) { - var then = null, - resolved; - - try { - if (promise === value) { - throw new TypeError("A promises callback cannot return that same promise."); - } - - if (objectOrFunction(value)) { - then = value.then; - - if (isFunction(then)) { - then.call(value, function(val) { - if (resolved) { return true; } - resolved = true; - - if (value !== val) { - resolve(promise, val); - } else { - fulfill(promise, val); - } - }, function(val) { - if (resolved) { return true; } - resolved = true; - - reject(promise, val); - }); - - return true; - } - } - } catch (error) { - if (resolved) { return true; } - reject(promise, error); - return true; - } - - return false; - } - - function resolve(promise, value) { - if (promise === value) { - fulfill(promise, value); - } else if (!handleThenable(promise, value)) { - fulfill(promise, value); - } - } - - function fulfill(promise, value) { - if (promise._state !== PENDING) { return; } - promise._state = SEALED; - promise._detail = value; - - config.async(publishFulfillment, promise); - } - - function reject(promise, reason) { - if (promise._state !== PENDING) { return; } - promise._state = SEALED; - promise._detail = reason; - - config.async(publishRejection, promise); - } - - function publishFulfillment(promise) { - publish(promise, promise._state = FULFILLED); - } - - function publishRejection(promise) { - publish(promise, promise._state = REJECTED); - } - - __exports__.Promise = Promise; - }); -define("promise/race", - ["./utils","exports"], - function(__dependency1__, __exports__) { - "use strict"; - /* global toString */ - var isArray = __dependency1__.isArray; - - /** - `RSVP.race` allows you to watch a series of promises and act as soon as the - first promise given to the `promises` argument fulfills or rejects. - - Example: - - ```javascript - var promise1 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve("promise 1"); - }, 200); - }); - - var promise2 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve("promise 2"); - }, 100); - }); - - RSVP.race([promise1, promise2]).then(function(result){ - // result === "promise 2" because it was resolved before promise1 - // was resolved. - }); - ``` - - `RSVP.race` is deterministic in that only the state of the first completed - promise matters. For example, even if other promises given to the `promises` - array argument are resolved, but the first completed promise has become - rejected before the other promises became fulfilled, the returned promise - will become rejected: - - ```javascript - var promise1 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve("promise 1"); - }, 200); - }); - - var promise2 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error("promise 2")); - }, 100); - }); - - RSVP.race([promise1, promise2]).then(function(result){ - // Code here never runs because there are rejected promises! - }, function(reason){ - // reason.message === "promise2" because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - @method race - @for RSVP - @param {Array} promises array of promises to observe - @param {String} label optional string for describing the promise returned. - Useful for tooling. - @return {Promise} a promise that becomes fulfilled with the value the first - completed promises is resolved with if the first completed promise was - fulfilled, or rejected with the reason that the first completed promise - was rejected with. - */ - function race(promises) { - /*jshint validthis:true */ - var Promise = this; - - if (!isArray(promises)) { - throw new TypeError('You must pass an array to race.'); - } - return new Promise(function(resolve, reject) { - var results = [], promise; - - for (var i = 0; i < promises.length; i++) { - promise = promises[i]; - - if (promise && typeof promise.then === 'function') { - promise.then(resolve, reject); - } else { - resolve(promise); - } - } - }); - } - - __exports__.race = race; - }); -define("promise/reject", - ["exports"], - function(__exports__) { - "use strict"; - /** - `RSVP.reject` returns a promise that will become rejected with the passed - `reason`. `RSVP.reject` is essentially shorthand for the following: - - ```javascript - var promise = new RSVP.Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = RSVP.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @for RSVP - @param {Any} reason value that the returned promise will be rejected with. - @param {String} label optional string for identifying the returned promise. - Useful for tooling. - @return {Promise} a promise that will become rejected with the given - `reason`. - */ - function reject(reason) { - /*jshint validthis:true */ - var Promise = this; - - return new Promise(function (resolve, reject) { - reject(reason); - }); - } - - __exports__.reject = reject; - }); -define("promise/resolve", - ["exports"], - function(__exports__) { - "use strict"; - function resolve(value) { - /*jshint validthis:true */ - if (value && typeof value === 'object' && value.constructor === this) { - return value; - } - - var Promise = this; - - return new Promise(function(resolve) { - resolve(value); - }); - } - - __exports__.resolve = resolve; - }); -define("promise/utils", - ["exports"], - function(__exports__) { - "use strict"; - function objectOrFunction(x) { - return isFunction(x) || (typeof x === "object" && x !== null); - } - - function isFunction(x) { - return typeof x === "function"; - } - - function isArray(x) { - return Object.prototype.toString.call(x) === "[object Array]"; - } - - // Date.now is not available in browsers < IE9 - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility - var now = Date.now || function() { return new Date().getTime(); }; - - - __exports__.objectOrFunction = objectOrFunction; - __exports__.isFunction = isFunction; - __exports__.isArray = isArray; - __exports__.now = now; - }); -requireModule('promise/polyfill').polyfill(); -}()); \ No newline at end of file diff --git a/public/webshims/shims/sizzle.js b/public/webshims/shims/sizzle.js index 839b647cd03e5bf32b6dddfd7bc998b4c11e732b..0f13152ffdde6f8a893bcd812adecbb740031363 100644 --- a/public/webshims/shims/sizzle.js +++ b/public/webshims/shims/sizzle.js @@ -1,12 +1,12 @@ /*! - * Sizzle CSS Selector Engine v1.10.18 + * Sizzle CSS Selector Engine v1.10.19 * http://sizzlejs.com/ * * Copyright 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2014-02-05 + * Date: 2014-04-18 */ (function( window ) { @@ -15,6 +15,7 @@ Expr, getText, isXML, + tokenize, compile, select, outermostContext, @@ -83,17 +84,23 @@ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + characterEncoding + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), @@ -534,7 +541,7 @@ var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; + return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { @@ -614,11 +621,13 @@ // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select t=''><option selected=''></option></select>"; + div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; - // Support: IE8, Opera 10-12 + // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= - if ( div.querySelectorAll("[t^='']").length ) { + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowclip^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } @@ -661,7 +670,8 @@ }); } - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { @@ -842,7 +852,7 @@ } catch(e) {} } - return Sizzle( expr, document, null, [elem] ).length > 0; + return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { @@ -971,7 +981,7 @@ match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; @@ -1014,15 +1024,15 @@ "PSEUDO": function( match ) { var excess, - unquoted = !match[5] && match[2]; + unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && @@ -1427,7 +1437,7 @@ setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); - function tokenize( selector, parseOnly ) { + tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; @@ -1492,7 +1502,7 @@ Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); - } + }; function toSelector( tokens ) { var i = 0, @@ -2032,7 +2042,6 @@ // EXPOSE - (function(jQuery){ jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; @@ -2044,4 +2053,3 @@ webshims.isReady('sizzle', true); })(window.webshims && window.webshims.$ || window.jQuery, window.Sizzle); })( window ); - diff --git a/public/webshims/shims/styles/forms-ext.css b/public/webshims/shims/styles/forms-ext.css index f0d5b8ec68399398172e76e6fcbc9c97f12de1e1..5860885c4f9c4de240d0a83b004a43a7a7474e4d 100644 --- a/public/webshims/shims/styles/forms-ext.css +++ b/public/webshims/shims/styles/forms-ext.css @@ -22,6 +22,9 @@ SASS: .hide-spinbtns .input-buttons > .step-controls { display: none; } +.hide-spinbtns input[type="number"], [type="number"].hide-spinbtns { + -moz-appearance: textfield; +} .hide-spinbtns::-webkit-inner-spin-button, .hide-spinbtns ::-webkit-inner-spin-button { display: none; @@ -36,6 +39,9 @@ SASS: .hide-inputbtns .input-buttons { display: none; } +.hide-inputbtns input[type="number"], [type="number"].hide-inputbtns { + -moz-appearance: textfield; +} .hide-inputbtns::-webkit-inner-spin-button, .hide-inputbtns ::-webkit-inner-spin-button { display: none; @@ -190,6 +196,10 @@ span.has-input-buttons { cursor: not-allowed; } +.ws-number[readonly][aria-readonly="false"] { + cursor: default; +} + .input-buttons, .step-controls, .ws-popover-opener { @@ -297,12 +307,10 @@ input[type="color"] { margin-right: -39px; } .input-button-size-2 .step-controls { - visibility: hidden; opacity: 0; } :focus + .input-button-size-2 .step-controls, :hover + .input-button-size-2 .step-controls, :active + .input-button-size-2 .step-controls, .input-button-size-2:hover .step-controls { opacity: 1; - visibility: visible; } .step-controls { diff --git a/public/webshims/shims/styles/forms-picker.css b/public/webshims/shims/styles/forms-picker.css index 1c35d8508988db389316c2175a598a23f76a209b..8783940d9c6b2c7bccb6e7a5fc5f6273e964c88d 100644 --- a/public/webshims/shims/styles/forms-picker.css +++ b/public/webshims/shims/styles/forms-picker.css @@ -78,7 +78,7 @@ SASS: outline: none; text-align: center; font-family: sans-serif; - width: 27.69231em; + width: 29.23077em; min-width: 20.76923em; max-width: 98vw; /* Selector API: */ diff --git a/public/webshims/shims/styles/scss/_api-forms-ext.scss b/public/webshims/shims/styles/scss/_api-forms-ext.scss index 8abf9c28298b926c79f9efda579f82997c64ecac..a44d7f2ac50695fca961658d3aa002a7e8073e07 100644 --- a/public/webshims/shims/styles/scss/_api-forms-ext.scss +++ b/public/webshims/shims/styles/scss/_api-forms-ext.scss @@ -82,6 +82,11 @@ $btnapis: hide-spinbtns hide-dropdownbtn hide-inputbtns inputbtns-outside a11yhi display: none; } + input[type="number"], + &[type="number"], { + -moz-appearance: textfield; + } + &::-webkit-inner-spin-button, ::-webkit-inner-spin-button { display: none; @@ -101,6 +106,11 @@ $btnapis: hide-spinbtns hide-dropdownbtn hide-inputbtns inputbtns-outside a11yhi display: none; } + input[type="number"], + &[type="number"], { + -moz-appearance: textfield; + } + &::-webkit-inner-spin-button, ::-webkit-inner-spin-button { display: none; diff --git a/public/webshims/shims/styles/scss/forms-ext.scss b/public/webshims/shims/styles/scss/forms-ext.scss index 08b81dc8e2ce4f9e1a7b9650fa7888c810680ee6..1bcd6a58c6cba3bc5a0612c8e708017837acb8d5 100644 --- a/public/webshims/shims/styles/scss/forms-ext.scss +++ b/public/webshims/shims/styles/scss/forms-ext.scss @@ -73,6 +73,10 @@ span.has-input-buttons { } } +.ws-number[readonly][aria-readonly="false"] { + cursor: default; +} + .input-buttons, .step-controls, .ws-popover-opener { @@ -209,7 +213,6 @@ input[type="color"] { } .step-controls { - visibility: hidden; opacity: 0; } @@ -219,7 +222,6 @@ input[type="color"] { &:hover { .step-controls { opacity: 1; - visibility: visible; } } diff --git a/public/webshims/shims/styles/scss/forms-picker.scss b/public/webshims/shims/styles/scss/forms-picker.scss index a28d011f8d484859629a826d0abf74e8e3bb6f4d..7ff1d465d6ca0fae11c96989a4f048b59f6a13b2 100644 --- a/public/webshims/shims/styles/scss/forms-picker.scss +++ b/public/webshims/shims/styles/scss/forms-picker.scss @@ -17,7 +17,7 @@ $button-bgcolor: #f5f5f5; outline: none; text-align: center; font-family: sans-serif; - width: em(360); + width: em(380); min-width: em(270); max-width: 98vw; diff --git a/public/webshims/shims/styles/scss/shim.scss b/public/webshims/shims/styles/scss/shim.scss index b2db9aaf907a56c8f0d806ba455c634cc3d80086..60879d6931a5ba44be180671a2bc7abc6640cdd2 100644 --- a/public/webshims/shims/styles/scss/shim.scss +++ b/public/webshims/shims/styles/scss/shim.scss @@ -408,6 +408,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator { .datalist-polyfill { position: absolute; + text-align: left; .ws-po-box { padding: em(5) 0; @@ -437,7 +438,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator { li { margin: em(1) 0; - padding: em(2) em(10); + padding: em(4) em(10); overflow: hidden; white-space: nowrap; cursor: default; @@ -455,31 +456,26 @@ input[data-wslist]::-webkit-calendar-picker-indicator { } .option-value { - display: inline-block; + display: block; text-overflow: ellipsis; max-width: 100%; color: #000; - float: left; transition: color 400ms; } .option-label { display: none; - max-width: 100%; - float: right; + font-size: 90%; color: #666; text-overflow: ellipsis; - vertical-align: bottom; - margin-top: 0.15em; - margin-left: em(10); - text-align: right; + margin-top: 0.1em; transition: color 400ms; } .has-option-label { .option-label { - display: inline-block; + display: block; } } @@ -499,20 +495,6 @@ input[data-wslist]::-webkit-calendar-picker-indicator { } } } - - &.ws-is-rtl { - - .option-value { - float: right; - } - - .option-label { - float: left; - margin-right: em(10); - margin-left: 0; - text-align: left; - } - } } diff --git a/public/webshims/shims/styles/shim-ext.css b/public/webshims/shims/styles/shim-ext.css index a17adc0798db762e4ccb8090fe2938f567e46ed4..72ee4f5ab49051c95b89073918add96f8f4300ca 100644 --- a/public/webshims/shims/styles/shim-ext.css +++ b/public/webshims/shims/styles/shim-ext.css @@ -366,6 +366,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator { .datalist-polyfill { position: absolute; + text-align: left; } .datalist-polyfill .ws-po-box { padding: 0.38462em 0; @@ -392,7 +393,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator { } .datalist-polyfill .datalist-box li { margin: 0.07692em 0; - padding: 0.15385em 0.76923em; + padding: 0.30769em 0.76923em; overflow: hidden; white-space: nowrap; cursor: default; @@ -408,28 +409,22 @@ input[data-wslist]::-webkit-calendar-picker-indicator { font-style: normal; } .datalist-polyfill .datalist-box .option-value { - display: inline-block; + display: block; text-overflow: ellipsis; max-width: 100%; color: #000; - float: left; transition: color 400ms; } .datalist-polyfill .datalist-box .option-label { display: none; - max-width: 100%; - float: right; font-size: 90%; color: #666; text-overflow: ellipsis; - vertical-align: bottom; - margin-top: 0.15em; - margin-left: 0.76923em; - text-align: right; + margin-top: 0.1em; transition: color 400ms; } .datalist-polyfill .datalist-box .has-option-label .option-label { - display: inline-block; + display: block; } .datalist-polyfill .datalist-box .hidden-item { display: none !important; @@ -444,15 +439,6 @@ input[data-wslist]::-webkit-calendar-picker-indicator { .datalist-polyfill .datalist-box .active-item .option-label { color: #eee; } -.datalist-polyfill.ws-is-rtl .option-value { - float: right; -} -.datalist-polyfill.ws-is-rtl .option-label { - float: left; - margin-right: 0.76923em; - margin-left: 0; - text-align: left; -} .validity-alert { display: inline-block; @@ -719,6 +705,9 @@ SASS: .hide-spinbtns .input-buttons > .step-controls { display: none; } +.hide-spinbtns input[type="number"], [type="number"].hide-spinbtns { + -moz-appearance: textfield; +} .hide-spinbtns::-webkit-inner-spin-button, .hide-spinbtns ::-webkit-inner-spin-button { display: none; @@ -733,6 +722,9 @@ SASS: .hide-inputbtns .input-buttons { display: none; } +.hide-inputbtns input[type="number"], [type="number"].hide-inputbtns { + -moz-appearance: textfield; +} .hide-inputbtns::-webkit-inner-spin-button, .hide-inputbtns ::-webkit-inner-spin-button { display: none; @@ -887,6 +879,10 @@ span.has-input-buttons { cursor: not-allowed; } +.ws-number[readonly][aria-readonly="false"] { + cursor: default; +} + .input-buttons, .step-controls, .ws-popover-opener { @@ -994,12 +990,10 @@ input[type="color"] { margin-right: -39px; } .input-button-size-2 .step-controls { - visibility: hidden; opacity: 0; } :focus + .input-button-size-2 .step-controls, :hover + .input-button-size-2 .step-controls, :active + .input-button-size-2 .step-controls, .input-button-size-2:hover .step-controls { opacity: 1; - visibility: visible; } .step-controls { diff --git a/public/webshims/shims/styles/shim.css b/public/webshims/shims/styles/shim.css index 89b162ea95ecad90cd34eae2582cd7ace0c7efec..ae1a9b094204986ccae0d962dcb24e6aa0727c50 100644 --- a/public/webshims/shims/styles/shim.css +++ b/public/webshims/shims/styles/shim.css @@ -366,6 +366,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator { .datalist-polyfill { position: absolute; + text-align: left; } .datalist-polyfill .ws-po-box { padding: 0.38462em 0; @@ -392,7 +393,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator { } .datalist-polyfill .datalist-box li { margin: 0.07692em 0; - padding: 0.15385em 0.76923em; + padding: 0.30769em 0.76923em; overflow: hidden; white-space: nowrap; cursor: default; @@ -408,28 +409,22 @@ input[data-wslist]::-webkit-calendar-picker-indicator { font-style: normal; } .datalist-polyfill .datalist-box .option-value { - display: inline-block; + display: block; text-overflow: ellipsis; max-width: 100%; color: #000; - float: left; transition: color 400ms; } .datalist-polyfill .datalist-box .option-label { display: none; - max-width: 100%; - float: right; font-size: 90%; color: #666; text-overflow: ellipsis; - vertical-align: bottom; - margin-top: 0.15em; - margin-left: 0.76923em; - text-align: right; + margin-top: 0.1em; transition: color 400ms; } .datalist-polyfill .datalist-box .has-option-label .option-label { - display: inline-block; + display: block; } .datalist-polyfill .datalist-box .hidden-item { display: none !important; @@ -444,15 +439,6 @@ input[data-wslist]::-webkit-calendar-picker-indicator { .datalist-polyfill .datalist-box .active-item .option-label { color: #eee; } -.datalist-polyfill.ws-is-rtl .option-value { - float: right; -} -.datalist-polyfill.ws-is-rtl .option-label { - float: left; - margin-right: 0.76923em; - margin-left: 0; - text-align: left; -} .validity-alert { display: inline-block; diff --git a/public/webshims/shims/track-ui.js b/public/webshims/shims/track-ui.js index 2fa36ddad833d30170c1dfda868b95f6634ae33e..e18dcb6bda7fa7746e213cee5c94b8707b2becb1 100644 --- a/public/webshims/shims/track-ui.js +++ b/public/webshims/shims/track-ui.js @@ -334,13 +334,13 @@ webshims.register('track-ui', function($, webshims, window, document, undefined) addTrackView(); } else { - if(elem.is('.nonnative-api-active')){ + if(elem.hasClass('nonnative-api-active')){ addTrackView(); } elem .on('mediaelementapichange trackapichange', function(){ - if(!usesNativeTrack() || elem.is('.nonnative-api-active')){ + if(!usesNativeTrack() || elem.hasClass('nonnative-api-active')){ addTrackView(); } else { clearTimeout(updateTimer); diff --git a/test/mailers/previews/moderation_mailer_preview.rb b/test/mailers/previews/moderation_mailer_preview.rb index b22e5bc384375d3c3b9bf025bd7a9efe31ce048b..494279efc8ad45014af0ef8fa5d4f3f298136552 100644 --- a/test/mailers/previews/moderation_mailer_preview.rb +++ b/test/mailers/previews/moderation_mailer_preview.rb @@ -12,6 +12,8 @@ class ModerationMailerPreview < ActionMailer::Preview def update ActionMailer::Base.default_url_options[:host] = 'localhost:3000' event = Event.last + event.tags += ', ho' + event.start_time += 1.day event.description = event.description + ' hello world' ModerationMailer.update event, nil