From c1148aefeb54c3a675c3733ff5ccee6c8d50dea5 Mon Sep 17 00:00:00 2001 From: echarp Date: Sun, 20 Jul 2014 02:43:13 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20webshims?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 2 +- public/webshims/polyfiller.js | 71 +- public/webshims/shims/combos/1.js | 23 +- public/webshims/shims/combos/10.js | 48 +- public/webshims/shims/combos/11.js | 45 +- public/webshims/shims/combos/12.js | 4 + public/webshims/shims/combos/13.js | 4 + public/webshims/shims/combos/14.js | 1 - public/webshims/shims/combos/15.js | 24 +- public/webshims/shims/combos/16.js | 28 +- public/webshims/shims/combos/17.js | 46 +- public/webshims/shims/combos/18.js | 221 +++-- public/webshims/shims/combos/2.js | 26 +- public/webshims/shims/combos/21.js | 7 +- public/webshims/shims/combos/23.js | 4 + public/webshims/shims/combos/25.js | 12 +- public/webshims/shims/combos/26.js | 2 +- public/webshims/shims/combos/27.js | 38 +- public/webshims/shims/combos/28.js | 3 +- public/webshims/shims/combos/29.js | 1 - public/webshims/shims/combos/3.js | 22 +- public/webshims/shims/combos/30.js | 22 +- public/webshims/shims/combos/31.js | 22 +- public/webshims/shims/combos/33.js | 1 - public/webshims/shims/combos/34.js | 3 +- public/webshims/shims/combos/4.js | 3 +- public/webshims/shims/combos/5.js | 46 +- public/webshims/shims/combos/6.js | 46 +- public/webshims/shims/combos/7.js | 26 +- public/webshims/shims/combos/8.js | 26 +- public/webshims/shims/combos/9.js | 48 +- public/webshims/shims/combos/97.js | 24 - public/webshims/shims/combos/98.js | 47 +- public/webshims/shims/combos/99.js | 47 +- public/webshims/shims/dom-extend.js | 3 +- public/webshims/shims/filereader.js | 2 +- public/webshims/shims/form-core.js | 19 +- public/webshims/shims/form-datalist-lazy.js | 12 +- public/webshims/shims/form-number-date-api.js | 1 - public/webshims/shims/form-number-date-ui.js | 45 +- public/webshims/shims/form-shim-extend.js | 2 +- public/webshims/shims/form-shim-extend2.js | 36 +- public/webshims/shims/form-validation.js | 37 +- public/webshims/shims/form-validators.js | 27 +- public/webshims/shims/forms-picker.js | 6 +- public/webshims/shims/jme/base.js | 24 - public/webshims/shims/jme/controls.css | 32 +- public/webshims/shims/jme/controls.scss | 24 +- .../webshims/shims/jme/mediacontrols-lazy.js | 17 +- public/webshims/shims/jme/mediacontrols.js | 23 +- public/webshims/shims/mediaelement-core.js | 4 + public/webshims/shims/mediaelement-jaris.js | 7 +- public/webshims/shims/picture.js | 221 +++-- .../shims/plugins/jquery.ui.position.js | 934 +++++++++--------- public/webshims/shims/promise.js | 684 ------------- public/webshims/shims/sizzle.js | 60 +- public/webshims/shims/styles/forms-ext.css | 12 +- public/webshims/shims/styles/forms-picker.css | 2 +- .../shims/styles/scss/_api-forms-ext.scss | 10 + .../webshims/shims/styles/scss/forms-ext.scss | 6 +- .../shims/styles/scss/forms-picker.scss | 2 +- public/webshims/shims/styles/scss/shim.scss | 30 +- public/webshims/shims/styles/shim-ext.css | 36 +- public/webshims/shims/styles/shim.css | 24 +- public/webshims/shims/track-ui.js | 4 +- .../previews/moderation_mailer_preview.rb | 2 + 66 files changed, 1474 insertions(+), 1867 deletions(-) delete mode 100644 public/webshims/shims/promise.js diff --git a/Gemfile.lock b/Gemfile.lock index e07c1d58..9c56b5d7 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 ff5a555b..19526837 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 fe985ac2..c9d3cb75 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 53bcdc83..c75e0de9 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 = $('').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 5cf4e07b..8cce4d98 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 = $('').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 df50d5e5..a07ba6b8 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 d086575f..d255d0ae 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 b19bf9e0..f9ad00e8 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 9c061c3f..b6532e84 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 51b3f036..5d2dc1f6 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 c16af12f..4693fb62 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 = $('').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 c17ec71a..d7e6900e 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--) { + if ( splitDescriptor[ i ] !== undefined ) { + var curr = splitDescriptor[ i ], + lastchar = curr && curr.slice( curr.length - 1 ); - 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 ( ( 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 ); - - 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. - } - - // set evaluated to true to avoid unnecessary reparsing - element[ pf.ns ].evaluated = true; + // 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 ( 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 ); + + 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 d90e9e8b..c3b8873f 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 1751efb6..84afc847 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 3992851a..52b1a592 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 1ea35b04..d365f0f6 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 c96f1be9..39131ada 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 1d6a5d8a..64a45b36 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 = $('') @@ -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 bf386879..de2b950b 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 1d78f5c7..89b5f4bc 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 863d0ed6..0f9493cc 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 b911fbd1..e727d2d4 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 6e0cbbd3..c9a8430b 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 dae36d02..bcf85519 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 66b477f7..e1d716e9 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 2814e04a..55c0fc60 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 560759d8..d0e17a45 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 = $('').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 b56cf277..221b886a 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 = $('').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 f89597d8..2fbf0b80 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 62df89e3..9d792249 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 2099a7b3..7cce200f 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 = $('').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 41dc387c..b604593a 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 2936fa89..d5c33ef5 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 560becfa..cb811d85 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 bad678ea..ac2ba763 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 5d78544f..f8da375d 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 6ee29874..5e5d824b 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 c979dd12..715fe7d8 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('
    '+ list.join("\n") +'
'); $(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 479be7a0..47edd48e 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 320d0177..c720d5f1 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 = $('').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 3e59059d..c2e72c07 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 42f9c6d6..a121da01 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 = $('') diff --git a/public/webshims/shims/form-validation.js b/public/webshims/shims/form-validation.js index 9ea67ac6..279601eb 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 f5716f1a..54d5dc66 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 1b5156f5..a8647858 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 b3dbf046..6c254a28 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 b130c158..6ee5c50e 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 ced58aae..38efd889 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 5665164c..fbcacafd 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 = $('
').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 1cda94fa..7859f705 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 f1f2aaa4..a5ded212 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 a12b6cbe..f2e58cce 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 458c4e2c..0be63903 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--) { + if ( splitDescriptor[ i ] !== undefined ) { + var curr = splitDescriptor[ i ], + lastchar = curr && curr.slice( curr.length - 1 ); - 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 ( ( 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 ); - - 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. - } - - // set evaluated to true to avoid unnecessary reparsing - element[ pf.ns ].evaluated = true; + // 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 ( 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 ); + + 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 b5a4e84c..12c4e7df 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 ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.ui = $.ui || {}; + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { -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 } - }; + // Browser globals + factory( window.webshims && window.webshims.$ || jQuery ); } - 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() - }; -} +}(function( $ ) { + (function() { -$.position = { - scrollbarWidth: function() { - if ( cachedScrollbarWidth !== undefined ) { - return cachedScrollbarWidth; - } - var w1, w2, - div = $( "
" ), - innerDiv = div.children()[0]; + $.ui = $.ui || {}; - $( "body" ).append( div ); - w1 = innerDiv.offsetWidth; - div.css( "overflow", "scroll" ); + 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; - w2 = innerDiv.offsetWidth; - - if ( w1 === w2 ) { - w2 = div[0].clientWidth; + 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 ) + ]; } - 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() - }; - } -}; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - 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 = {}; - - 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 ]; - } - - if ( options.at[ 0 ] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[ 0 ] === "center" ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[ 1 ] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[ 1 ] === "center" ) { - basePosition.top += targetHeight / 2; - } - - 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; + function parseCss( element, property ) { + return parseInt( $.css( element, property ), 10 ) || 0; } - if ( options.my[ 1 ] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[ 1 ] === "center" ) { - position.top -= elemHeight / 2; - } - - position.left += myOffset[ 0 ]; - position.top += myOffset[ 1 ]; - - // 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 ); - } - - 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 - }); + function getDimensions( elem ) { + var raw = elem[0]; + if ( raw.nodeType === 9 ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: 0, left: 0 } + }; } - }); - - 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 ); + 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() }; } - elem.offset( $.extend( position, { using: using } ) ); - }); -}; + $.position = { + scrollbarWidth: function() { + if ( cachedScrollbarWidth !== undefined ) { + return cachedScrollbarWidth; + } + var w1, w2, + div = $( "
" ), + innerDiv = div.children()[0]; -$.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; + $( "body" ).append( div ); + w1 = innerDiv.offsetWidth; + div.css( "overflow", "scroll" ); - // 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; + w2 = innerDiv.offsetWidth; + + if ( w1 === w2 ) { + w2 = div[0].clientWidth; + } + + 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() + }; + } + }; + + $.fn.position = function( options ) { + if ( !options || !options.of ) { + return _position.apply( this, arguments ); + } + + // make a copy, we don't want to modify arguments + options = $.extend( {}, options ); + + 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 = {}; + + 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 ]; + } + + if ( options.at[ 0 ] === "right" ) { + basePosition.left += targetWidth; + } else if ( options.at[ 0 ] === "center" ) { + basePosition.left += targetWidth / 2; + } + + if ( options.at[ 1 ] === "bottom" ) { + basePosition.top += targetHeight; + } else if ( options.at[ 1 ] === "center" ) { + basePosition.top += targetHeight / 2; + } + + 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; + } + + if ( options.my[ 1 ] === "bottom" ) { + position.top -= elemHeight; + } else if ( options.my[ 1 ] === "center" ) { + position.top -= elemHeight / 2; + } + + 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 ); + } + + 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 ); + }; + } + + 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 ); + } + }, + 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 = max( position.top - collisionPosTop, position.top ); } } - // 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; + }, + 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; - // 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; + 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; + } } } - // 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; + }, + 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 ); } } - 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; - } - } - } - }, - 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 ); - } - } -}; + }; // fraction support test -(function () { - var testElement, testElementParent, testElementStyle, offsetLeft, i, - body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ); + (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 ); + //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;"; + div.style.cssText = "position: absolute; left: 10.7432222px;"; - offsetLeft = $( div ).offset().left; - $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; + offsetLeft = $( div ).offset().left; + supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); -})(); + testElement.innerHTML = ""; + testElementParent.removeChild( testElement ); + })(); + + })(); + + return $.ui.position; + +})); -}( window.webshims && window.webshims.$ || jQuery ) ); diff --git a/public/webshims/shims/promise.js b/public/webshims/shims/promise.js deleted file mode 100644 index 5619cfa5..00000000 --- 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 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 f0d5b8ec..5860885c 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 1c35d850..8783940d 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 8abf9c28..a44d7f2a 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 08b81dc8..1bcd6a58 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 a28d011f..7ff1d465 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 b2db9aaf..60879d69 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 a17adc07..72ee4f5a 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 89b162ea..ae1a9b09 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 2fa36dda..e18dcb6b 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 b22e5bc3..494279ef 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