Mise à jour de webshims

This commit is contained in:
echarp 2014-07-20 02:43:13 +02:00
parent a1e70d9a29
commit c1148aefeb
66 changed files with 1474 additions and 1867 deletions

View File

@ -290,7 +290,7 @@ GEM
warden (1.2.3) warden (1.2.3)
rack (>= 1.0) rack (>= 1.0)
webrick (1.3.1) webrick (1.3.1)
webshims-rails (1.14.4) webshims-rails (1.14.5)
rails (> 3.1.0) rails (> 3.1.0)
PLATFORMS PLATFORMS

View File

@ -104,6 +104,11 @@
var getAutoEnhance = function(prop){ var getAutoEnhance = function(prop){
return !webCFG.enhanceAuto && prop == 'auto' ? false : prop; return !webCFG.enhanceAuto && prop == 'auto' ? false : prop;
}; };
var featureAlias = {
matchmedia: 'matchMedia',
xhr2: 'filereader',
promise: 'es6'
};
clearInterval(webshims.timer); clearInterval(webshims.timer);
support.advancedObjectProperties = support.objectAccessor = support.ES5 = !!('create' in Object && 'seal' in Object); support.advancedObjectProperties = support.objectAccessor = support.ES5 = !!('create' in Object && 'seal' in Object);
@ -121,7 +126,7 @@
} }
$.extend(webshims, { $.extend(webshims, {
version: '1.14.4', version: '1.14.5',
cfg: { cfg: {
enhanceAuto: window.Audio && (!window.matchMedia || matchMedia('(min-device-width: 721px)').matches), enhanceAuto: window.Audio && (!window.matchMedia || matchMedia('(min-device-width: 721px)').matches),
@ -244,12 +249,9 @@
} }
$.each(features, function(i, feature){ $.each(features, function(i, feature){
if(feature == 'xhr2'){
feature = 'filereader'; feature = featureAlias[feature] || feature;
}
if(feature == 'promise'){
feature = 'es6';
}
if(!webshimsFeatures[feature]){ if(!webshimsFeatures[feature]){
WSDEBUG && webshims.error("could not find webshims-feature (aborted): "+ feature); WSDEBUG && webshims.error("could not find webshims-feature (aborted): "+ feature);
isReady(feature, true); isReady(feature, true);
@ -1010,7 +1012,7 @@
support.inputtypes = inputtypes; 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); input.setAttribute('type', type);
inputtypes[type] = (input.type == type && (input.value = '(') && input.value != '('); inputtypes[type] = (input.type == type && (input.value = '(') && input.value != '(');
}); });
@ -1026,7 +1028,7 @@
try { try {
if(fieldset.querySelector(':invalid')){ if(fieldset.querySelector(':invalid')){
fieldset.disabled = true; fieldset.disabled = true;
tmp = !fieldset.querySelector(':invalid'); tmp = !fieldset.querySelector(':invalid') && fieldset.querySelector(':disabled');
} }
} catch(er){} } catch(er){}
support.fieldsetdisabled = !!tmp; support.fieldsetdisabled = !!tmp;
@ -1035,15 +1037,39 @@
if(support[formvalidation]){ if(support[formvalidation]){
bustedWidgetUi = !support.fieldsetdisabled || !support.fieldsetelements || !('value' in progress) || !('value' in output); bustedWidgetUi = !support.fieldsetdisabled || !support.fieldsetelements || !('value' in progress) || !('value' in output);
replaceBustedUI = bustedWidgetUi && (/Android/i).test(navigator.userAgent); replaceBustedUI = bustedWidgetUi && (/Android/i).test(navigator.userAgent);
bugs.bustedValidity = bustedValidity = window.opera || bugs.bustedValidity || bustedWidgetUi || !support.datalist; bustedValidity = window.opera || bugs.bustedValidity || bustedWidgetUi || !support.datalist;
} else {
bugs.bustedValidity = false; 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; formExtend = support[formvalidation] && !bustedValidity ? 'form-native-extend' : fShim;
initialFormTest = $.noop; initialFormTest = $.noop;
return false; 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 = { webshims.validationMessages = webshims.validityMessages = {
@ -1129,18 +1155,12 @@
types: 'date time range number' types: 'date time range number'
}, },
test: function(){ test: function(){
var ret = true;
var o = this.options;
if(!o._types){
o._types = o.types.split(' ');
}
initialFormTest(); initialFormTest();
$.each(o._types, function(i, name){ var ret = !bustedValidity;
if((name in inputtypes) && !inputtypes[name]){
ret = false; if(ret){
return false; ret = typeTest(this.options);
} }
});
return ret; return ret;
}, },
@ -1169,7 +1189,7 @@
if(!o.replaceUI && replaceBustedUI){ if(!o.replaceUI && replaceBustedUI){
o.replaceUI = true; o.replaceUI = true;
} }
return !o.replaceUI && modules[fNuAPI].test(); return !o.replaceUI && typeTest(o);
}, },
d: ['forms', DOMSUPPORT, fNuAPI, 'range-ui'], d: ['forms', DOMSUPPORT, fNuAPI, 'range-ui'],
options: { options: {
@ -1177,7 +1197,6 @@
calculateWidth: true, calculateWidth: true,
animate: true animate: true
} }
// ,replaceUI: false
}, },
c: [6, 5, 9, 10, 17, 11] c: [6, 5, 9, 10, 17, 11]
}); });

View File

@ -250,6 +250,9 @@ webshims.isReady('swfmini', true);
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -264,7 +267,6 @@ webshims.isReady('swfmini', true);
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -321,11 +323,11 @@ webshims.isReady('swfmini', true);
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;(function(webshims){
"use strict"; "use strict";
@ -1070,6 +1079,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.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(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -3706,12 +3709,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -3719,14 +3718,18 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3737,12 +3740,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -803,9 +803,11 @@
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -2494,12 +2496,8 @@
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -2507,14 +2505,18 @@
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -2525,12 +2527,13 @@
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -754,6 +754,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -531,6 +531,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -553,7 +553,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); return (typeof string == 'number' || (string && string == string * 1));

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-shim-extend', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";
@ -1920,7 +1930,7 @@ var rsubmittable = /^(?:select|textarea|input)/i;
; ;
return function(){ return function(){
var elem = $(this).getNativeElement()[0]; var elem = $(this).getNativeElement()[0];
return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') ); return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') );
}; };
})() })()
}, },

View File

@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-shim-extend', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";
@ -2143,7 +2153,7 @@ var rsubmittable = /^(?:select|textarea|input)/i;
; ;
return function(){ return function(){
var elem = $(this).getNativeElement()[0]; 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(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); 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(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -3111,12 +3112,8 @@ webshims.register('form-number-date-api', function($, webshims, window, document
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -3124,14 +3121,18 @@ webshims.register('form-number-date-api', function($, webshims, window, document
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3142,12 +3143,13 @@ webshims.register('form-number-date-api', function($, webshims, window, document
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -10,7 +10,6 @@
webshim.isReady('picture', true); webshim.isReady('picture', true);
setTimeout(function(){ setTimeout(function(){
webshim.ready('matchMedia', function(){
if(window.picturefill){ if(window.picturefill){
var sel = 'picture, img[srcset]'; var sel = 'picture, img[srcset]';
webshim.addReady(function(context){ webshim.addReady(function(context){
@ -20,13 +19,56 @@
}); });
} }
}); });
});
})(); })();
/*! Picturefill - v2.1.0-beta - 2014-07-15
/*! Picturefill - v2.1.0-beta - 2014-06-03
* http://scottjehl.github.io/picturefill * http://scottjehl.github.io/picturefill
* Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ * 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. /*! Picturefill - Responsive Images that work today.
* Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar ) * Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
* License: MIT/GPLv2 * License: MIT/GPLv2
@ -38,6 +80,7 @@
// If picture is supported, well, that's awesome. Let's get outta here... // If picture is supported, well, that's awesome. Let's get outta here...
if ( w.HTMLPictureElement ) { if ( w.HTMLPictureElement ) {
w.picturefill = function() { };
return; return;
} }
@ -51,7 +94,8 @@
pf.ns = "picturefill"; pf.ns = "picturefill";
// srcset support test // 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 // just a string trim workaround
pf.trim = function( str ) { pf.trim = function( str ) {
@ -82,8 +126,8 @@
* http://dev.w3.org/csswg/css-values-3/#length-value * http://dev.w3.org/csswg/css-values-3/#length-value
*/ */
pf.getWidthFromLength = function( length ) { pf.getWidthFromLength = function( length ) {
// If no length was specified, or it is 0, default to `100vw` (per the spec). // If no length was specified, or it is 0 or negative, default to `100vw` (per the spec).
length = length && parseFloat( length ) > 0 ? length : "100vw"; length = length && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 ) ? length : "100vw";
/** /**
* If length is specified in `vw` units, use `%` instead since the div were measuring * If length is specified in `vw` units, use `%` instead since the div were measuring
@ -101,7 +145,12 @@
// Positioning styles help prevent padding/margin/width on `html` from throwing calculations off. // Positioning styles help prevent padding/margin/width on `html` from throwing calculations off.
pf.lengthEl.style.cssText = "position: absolute; left: 0; width: " + length + ";"; 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; return pf.lengthEl.offsetWidth;
}; };
@ -263,38 +312,32 @@
return candidates; 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 // 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. // is the order in which entries are added to the list.
var sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""), var sizes = sizesattr || "100vw",
widthInCssPixels = sizes ? pf.findWidthFromSourceSize( sizes ) : "100%", sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""),
widthInCssPixels = pf.findWidthFromSourceSize( sizes ),
resCandidate; resCandidate;
if ( sizeDescriptor ) { if ( sizeDescriptor ) {
var splitDescriptor = sizeDescriptor.split(" "); var splitDescriptor = sizeDescriptor.split(" ");
for (var i = splitDescriptor.length + 1; i >= 0; i--) { for (var i = splitDescriptor.length + 1; i >= 0; i--) {
if ( splitDescriptor[ i ] !== undefined ) {
var curr = splitDescriptor[ i ], var curr = splitDescriptor[ i ],
lastchar = curr && curr.slice( curr.length - 1 ); lastchar = curr && curr.slice( curr.length - 1 );
if ( lastchar === "w" || lastchar === "x" ) { if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) {
resCandidate = curr;
}
if ( sizes && resCandidate ) {
// get the dpr by taking the length / width in css pixels
resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) ); resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) );
} else { } else if ( lastchar === "x" ) {
// get the dpr by grabbing the value of Nx
var res = curr && parseFloat( curr, 10 ); var res = curr && parseFloat( curr, 10 );
resCandidate = res && !isNaN( res ) ? res : 1;
resCandidate = res && !isNaN( res ) && lastchar === "x" || lastchar === "w" ? 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; picImg.src = bestCandidate.url;
// currentSrc attribute and property to match // currentSrc attribute and property to match
// http://picture.responsiveimages.org/#the-img-element // http://picture.responsiveimages.org/#the-img-element
@ -405,32 +448,26 @@
}; };
/* /*
* Find all picture elements and, * Find all `img` elements, and add them to the candidate list if they have
* in browsers that don't natively support srcset, find all img elements * a `picture` parent, a `sizes` attribute in basic `srcset` supporting browsers,
* with srcset attrs that don't have picture parents * a `srcset` attribute at all, and they havent been evaluated already.
*/ */
pf.getAllElements = function() { pf.getAllElements = function() {
var pictures = doc.getElementsByTagName( "picture" ), var elems = [],
elems = [],
imgs = doc.getElementsByTagName( "img" ); imgs = doc.getElementsByTagName( "img" );
for ( var h = 0, len = pictures.length + imgs.length; h < len; h++ ) { for ( var h = 0, len = imgs.length; h < len; h++ ) {
if ( h < pictures.length ) { var currImg = imgs[ h ];
elems[ h ] = pictures[ h ];
} else {
var currImg = imgs[ h - pictures.length ];
if ( currImg.parentNode.nodeName.toUpperCase() !== "PICTURE" && if ( currImg.parentNode.nodeName.toUpperCase() === "PICTURE" ||
( ( pf.srcsetSupported && currImg.getAttribute( "sizes" ) ) || ( currImg.getAttribute( "srcset" ) !== null ) || currImg[ pf.ns ] && currImg[ pf.ns ].srcset !== null ) {
currImg.getAttribute( "srcset" ) !== null ) ) {
elems.push( currImg ); elems.push( currImg );
} }
} }
}
return elems; return elems;
}; };
pf.getMatch = function( picture ) { pf.getMatch = function( img, picture ) {
var sources = picture.childNodes, var sources = picture.childNodes,
match; match;
@ -443,9 +480,9 @@
continue; 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 no previous `source` matches, the `img` itself is evaluated later.
if ( source.nodeName.toUpperCase() === "IMG" ) { if ( source === img ) {
return match; return match;
} }
@ -477,24 +514,22 @@
return match; return match;
}; };
function picturefill( options ) { function picturefill( opt ) {
var elements, var elements,
element, element,
elemType, parent,
firstMatch, firstMatch,
candidates, candidates,
picImg;
options = options || {}; options = opt || {};
elements = options.elements || pf.getAllElements(); elements = options.elements || pf.getAllElements();
// Loop through all elements // Loop through all elements
for ( var i = 0, plen = elements.length; i < plen; i++ ) { for ( var i = 0, plen = elements.length; i < plen; i++ ) {
element = elements[ i ]; element = elements[ i ];
elemType = element.nodeName.toUpperCase(); parent = element.parentNode;
firstMatch = undefined; firstMatch = undefined;
candidates = undefined; candidates = undefined;
picImg = undefined;
// expando for caching data on the img // expando for caching data on the img
if ( !element[ pf.ns ] ) { if ( !element[ pf.ns ] ) {
@ -508,16 +543,16 @@
continue; continue;
} }
// if element is a picture element // if `img` is in a `picture` element
if ( elemType === "PICTURE" ) { if ( parent.nodeName.toUpperCase() === "PICTURE" ) {
// IE9 video workaround // IE9 video workaround
pf.removeVideoShim( element ); pf.removeVideoShim( parent );
// return the first match which might undefined // return the first match which might undefined
// returns false if there is a pending source // returns false if there is a pending source
// TODO the return type here is brutal, cleanup // 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) // 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 // remove the evaluated attr and skip for now ( the pending test will
@ -525,37 +560,27 @@
if ( firstMatch === false ) { if ( firstMatch === false ) {
continue; continue;
} }
// Find any existing img element in the picture element
picImg = element.getElementsByTagName( "img" )[ 0 ];
} else { } else {
// if it's an img element
firstMatch = undefined; firstMatch = undefined;
picImg = element;
} }
if ( picImg ) { // Cache and remove `srcset` if present and were going to be doing `picture`/`srcset`/`sizes` polyfilling to it.
if ( parent.nodeName.toUpperCase() === "PICTURE" ||
// expando for caching data on the img ( element.srcset && !pf.srcsetSupported ) ||
if ( !picImg[ pf.ns ] ) { ( !pf.sizesSupported && ( element.srcset && element.srcset.indexOf("w") > -1 ) ) ) {
picImg[ pf.ns ] = {}; pf.dodgeSrcset( element );
}
// Cache and remove `srcset` if present and were going to be doing `sizes`/`picture` polyfilling to it.
if ( picImg.srcset && ( elemType === "PICTURE" || picImg.getAttribute( "sizes" ) ) ) {
pf.dodgeSrcset( picImg );
} }
if ( firstMatch ) { if ( firstMatch ) {
candidates = pf.processSourceSet( firstMatch ); candidates = pf.processSourceSet( firstMatch );
pf.applyBestCandidate( candidates, picImg ); pf.applyBestCandidate( candidates, element );
} else { } else {
// No sources matched, so were down to processing the inner `img` as a source. // No sources matched, so were down to processing the inner `img` as a source.
candidates = pf.processSourceSet( picImg ); candidates = pf.processSourceSet( element );
if ( picImg.srcset === undefined || picImg[ pf.ns ].srcset ) { if ( element.srcset === undefined || element[ pf.ns ].srcset ) {
// Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality. // Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality.
pf.applyBestCandidate( candidates, picImg ); pf.applyBestCandidate( candidates, element );
} // Else, resolution-only `srcset` is supported natively. } // Else, resolution-only `srcset` is supported natively.
} }
@ -563,7 +588,6 @@
element[ pf.ns ].evaluated = true; element[ pf.ns ].evaluated = true;
} }
} }
}
/** /**
* Sets up picture polyfill by polling the document and running * Sets up picture polyfill by polling the document and running
@ -596,7 +620,7 @@
} }
} }
webshim.ready('matchMedia', runPicturefill); runPicturefill();
/* expose methods for testing */ /* expose methods for testing */
picturefill._ = pf; picturefill._ = pf;
@ -615,6 +639,7 @@
} )( this, this.document ); } )( 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 */ ;/*! 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() { window.matchMedia || (window.matchMedia = function() {

View File

@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";
@ -2579,6 +2589,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -462,6 +462,7 @@
var onEvent = { var onEvent = {
onPlayPause: function(jaris, data, override){ onPlayPause: function(jaris, data, override){
var playing, type; var playing, type;
var idled = data.paused || data.ended;
if(override == null){ if(override == null){
try { try {
playing = data.api.api_get("isPlaying"); playing = data.api.api_get("isPlaying");
@ -469,7 +470,7 @@
} else { } else {
playing = override; playing = override;
} }
if(playing == data.paused){ if(playing == idled || playing == null){
data.paused = !playing; data.paused = !playing;
type = data.paused ? 'pause' : 'play'; type = data.paused ? 'pause' : 'play';
@ -1546,11 +1547,11 @@
var media, error, parent; var media, error, parent;
if( if(
($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) && ($(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'); error = media.prop('error');
setTimeout(function(){ setTimeout(function(){
if(!media.is('.nonnative-api-active')){ if(!media.hasClass('nonnative-api-active')){
if(error && switchErrors[error.code]){ if(error && switchErrors[error.code]){
options.preferFlash = true; options.preferFlash = true;
document.removeEventListener('error', switchOptions, true); document.removeEventListener('error', switchOptions, true);

View File

@ -754,6 +754,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1549,7 +1550,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
writeable: false, writeable: false,
get: function(){ get: function(){
if(this.type != 'file'){return null;} 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"); webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
} }
return webshim.data(this, 'fileList') || []; return webshim.data(this, 'fileList') || [];
@ -1808,6 +1809,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
var onEvent = { var onEvent = {
onPlayPause: function(jaris, data, override){ onPlayPause: function(jaris, data, override){
var playing, type; var playing, type;
var idled = data.paused || data.ended;
if(override == null){ if(override == null){
try { try {
playing = data.api.api_get("isPlaying"); playing = data.api.api_get("isPlaying");
@ -1815,7 +1817,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
} else { } else {
playing = override; playing = override;
} }
if(playing == data.paused){ if(playing == idled || playing == null){
data.paused = !playing; data.paused = !playing;
type = data.paused ? 'pause' : 'play'; type = data.paused ? 'pause' : 'play';
@ -2892,11 +2894,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
var media, error, parent; var media, error, parent;
if( if(
($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) && ($(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'); error = media.prop('error');
setTimeout(function(){ setTimeout(function(){
if(!media.is('.nonnative-api-active')){ if(!media.hasClass('nonnative-api-active')){
if(error && switchErrors[error.code]){ if(error && switchErrors[error.code]){
options.preferFlash = true; options.preferFlash = true;
document.removeEventListener('error', switchOptions, true); document.removeEventListener('error', switchOptions, true);

View File

@ -7570,7 +7570,7 @@ Globally exposed namespace with the most frequently used public classes and hand
writeable: false, writeable: false,
get: function(){ get: function(){
if(this.type != 'file'){return null;} 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"); webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
} }
return webshim.data(this, 'fileList') || []; return webshim.data(this, 'fileList') || [];

View File

@ -156,18 +156,37 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(!support.fieldsetdisabled || !support.fieldsetelements){ if(!support.fieldsetdisabled || !support.fieldsetelements){
(function(){ (function(){
if(!support.fieldsetdisabled){ if(!support.fieldsetdisabled){
var hasIsDisabled = 'isDisabled' in document.createElement('div');
var isFieldsetGroup = { var isFieldsetGroup = {
fieldset: 1, fieldset: 1,
FIELDSET: 1 FIELDSET: 1
}; };
var disableElementsSel = 'input, textarea, select, button'; 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[":"], { $.extend($.expr[":"], {
"enabled": function( elem ) { "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 ) { "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){ if(value){
$(this.querySelectorAll(disableElementsSel)).each(groupControl.disable); $(this.querySelectorAll(disableElementsSel)).each(groupControl.disable);
} else if(!$(this).is('fieldset[disabled] *')){
} else if(!isDisabledChild(this)){
var elements = $(this.querySelectorAll(disableElementsSel)); var elements = $(this.querySelectorAll(disableElementsSel));
if( this.querySelector('fieldset[disabled]') ){ if( this.querySelector('fieldset[disabled]') ){
elements = elements.not('fieldset[disabled] *'); elements = elements.filter(isEnableChildFilter);
} }
elements.each(groupControl.enable); elements.each(groupControl.enable);
@ -218,7 +238,8 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(value){ if(value){
webshims.data(this, 'groupedisabled', false); webshims.data(this, 'groupedisabled', false);
desc.prop._supset.call(this, value); desc.prop._supset.call(this, value);
} else if($(this).is('fieldset[disabled] *')){
} else if(isDisabledChild(this)){
webshims.data(this, 'groupedisabled', true); webshims.data(this, 'groupedisabled', true);
desc.prop._supset.call(this, true); desc.prop._supset.call(this, true);
} else { } else {
@ -242,7 +263,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
webshims.addReady(function(context){ webshims.addReady(function(context){
$(context) $(context)
.filter('fieldset[disabled], fieldset[disabled] *') .filter(isDisabledChildFilter)
.find(disableElementsSel) .find(disableElementsSel)
.each(groupControl.disable) .each(groupControl.disable)
; ;
@ -254,7 +275,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
var isForm = {form: 1, FORM: 1}; var isForm = {form: 1, FORM: 1};
$.prop = function(elem, name, value){ $.prop = function(elem, name, value){
var ret; var ret;
//TODO: cache + perftest
if(elem && elem.nodeType == 1 && value === undefined && isForm[elem.nodeName] && elem.id){ if(elem && elem.nodeType == 1 && value === undefined && isForm[elem.nodeName] && elem.id){
ret = document.getElementsByName(name); ret = document.getElementsByName(name);
if(!ret || !ret.length){ if(!ret || !ret.length){
@ -896,7 +916,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(elem.type == 'password' || isOver){ if(elem.type == 'password' || isOver){
data.text = createPlaceholder(elem); 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; data.box = data.text;
} else { } else {
data.box = $('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />') data.box = $('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />')
@ -1569,7 +1589,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
writeable: false, writeable: false,
get: function(){ get: function(){
if(this.type != 'file'){return null;} 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"); webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
} }
return webshim.data(this, 'fileList') || []; return webshim.data(this, 'fileList') || [];

View File

@ -392,7 +392,7 @@ var rsubmittable = /^(?:select|textarea|input)/i;
; ;
return function(){ return function(){
var elem = $(this).getNativeElement()[0]; 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), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); return (typeof string == 'number' || (string && string == string * 1));

View File

@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); return (typeof string == 'number' || (string && string == string * 1));

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-message', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-message', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1239,6 +1240,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1253,7 +1257,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1310,11 +1313,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-datalist', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";

View File

@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); return (typeof string == 'number' || (string && string == string * 1));

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){

View File

@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); 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(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -3322,12 +3323,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -3335,14 +3332,18 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3353,12 +3354,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); 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(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -3322,12 +3323,8 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -3335,14 +3332,18 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3353,12 +3354,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-message', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";
@ -2891,6 +2901,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -772,8 +772,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){
@ -1462,6 +1463,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -1476,7 +1480,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -1533,11 +1536,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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){ ;webshims.register('form-message', function($, webshims, window, document, undefined, options){
"use strict"; "use strict";
@ -2594,6 +2604,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.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(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -3706,12 +3709,8 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -3719,14 +3718,18 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3737,12 +3740,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media; jmeData.media = media;
jmeData.player = base; jmeData.player = base;
media 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('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){ .on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume'); var volume = $.prop(this, 'volume');

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media; jmeData.media = media;
jmeData.player = base; jmeData.player = base;
media 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('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){ .on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume'); 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 regYt = /youtube\.com\/[watch\?|v\/]+/i;
var isInitial = data.media.prop('paused'); var isInitial = data.media.prop('paused');
var isEnded = data.media.prop('ended');
if(isInitial){ if(isInitial){
data.player.addClass('initial-state'); data.player.addClass('initial-state');
} }
if(isEnded){
data.player.addClass('ended-state');
}
if(!('backgroundSize' in $poster[0].style)){ if(!('backgroundSize' in $poster[0].style)){
data.player.addClass('no-backgroundsize'); 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){ if(isInitial){
isInitial = false; isInitial = false;
data.player.removeClass('initial-state'); 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(){ return function(){
var poster = data.media.attr('poster'); var poster = data.media.attr('poster');
@ -640,6 +632,11 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
isInitial = true; isInitial = true;
} }
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
if(lastYoutubeState !== hasYt){ if(lastYoutubeState !== hasYt){
lastYoutubeState = hasYt; lastYoutubeState = hasYt;
data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter');

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media; jmeData.media = media;
jmeData.player = base; jmeData.player = base;
media 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('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){ .on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume'); 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 regYt = /youtube\.com\/[watch\?|v\/]+/i;
var isInitial = data.media.prop('paused'); var isInitial = data.media.prop('paused');
var isEnded = data.media.prop('ended');
if(isInitial){ if(isInitial){
data.player.addClass('initial-state'); data.player.addClass('initial-state');
} }
if(isEnded){
data.player.addClass('ended-state');
}
if(!('backgroundSize' in $poster[0].style)){ if(!('backgroundSize' in $poster[0].style)){
data.player.addClass('no-backgroundsize'); 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){ if(isInitial){
isInitial = false; isInitial = false;
data.player.removeClass('initial-state'); 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(){ return function(){
var poster = data.media.attr('poster'); var poster = data.media.attr('poster');
@ -640,6 +632,11 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
isInitial = true; isInitial = true;
} }
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
if(lastYoutubeState !== hasYt){ if(lastYoutubeState !== hasYt){
lastYoutubeState = hasYt; lastYoutubeState = hasYt;
data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter');

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id); webshims.warn(type +' already implemented for element #'+elem.id);
return false; return false;
} }
data[type] = true; data[type] = true;
return true; return !$(elem).hasClass('ws-nopolyfill');
}, },
extendUNDEFProp: function(obj, props){ extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){ $.each(props, function(name, prop){

View File

@ -337,7 +337,7 @@ webshim.register('filereader', function($, webshim, window, document, undefined,
writeable: false, writeable: false,
get: function(){ get: function(){
if(this.type != 'file'){return null;} 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"); webshim.info("please add the 'ws-filereader' class to your input[type='file'] to implement files-property");
} }
return webshim.data(this, 'fileList') || []; return webshim.data(this, 'fileList') || [];

View File

@ -27,6 +27,9 @@ webshims.register('form-core', function($, webshims, window, document, undefined
}; };
var lazyLoad = function(){ var lazyLoad = function(){
var toLoad = ['form-validation']; var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){ if(options.lazyCustomMessages){
options.customMessages = true; options.customMessages = true;
toLoad.push('form-message'); toLoad.push('form-message');
@ -41,7 +44,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
toLoad.push('form-validators'); toLoad.push('form-validators');
} }
webshims.reTest(toLoad); webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
}; };
/* /*
* Selectors for all browsers * Selectors for all browsers
@ -98,11 +100,11 @@ webshims.register('form-core', function($, webshims, window, document, undefined
}; };
$.extend(exp, { $.extend(exp, {
"enabled": function( elem ) { "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 ) { "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 mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation', function(e){
if('form' in e.target){ if('form' in e.target){
lazyLoad(); 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);
}
}); });

View File

@ -270,11 +270,15 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
$(this.input).removeAttr('aria-activedescendant').triggerHandler('datalistcreated', [{instance: this}]); $(this.input).removeAttr('aria-activedescendant').triggerHandler('datalistcreated', [{instance: this}]);
if(_forceShow || this.popover.isVisible){ 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); $.prop(this.input, 'value', this.lastCompletedValue);
$(this.input).triggerHandler('updateInput'); $(this.input).triggerHandler('updateInput');
} }
if(value != this.lastCompletedValue){
this.lastCompletedValue = ""; this.lastCompletedValue = "";
}
this.showHideOptions(); this.showHideOptions();
} else { } else {
this.lastCompletedValue = ""; this.lastCompletedValue = "";
@ -545,7 +549,7 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
} }
items.removeClass('active-item'); items.removeClass('active-item');
this.shadowList.addClass('list-item-active'); 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){
if(doValue != 'onlyScroll'){ if(doValue != 'onlyScroll'){

View File

@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document
} }
var nan = parseInt('NaN', 10), var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes, typeModels = webshims.inputTypes,
isNumber = function(string){ isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1)); return (typeof string == 'number' || (string && string == string * 1));

View File

@ -183,9 +183,11 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')}); $(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){ if(!noFocus){
labels.on('click', function(e){ labels.on('click', function(e){
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus(); element.getShadowFocusElement().focus();
e.preventDefault(); e.preventDefault();
return false; return false;
}
}); });
} }
}; };
@ -1874,12 +1876,8 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
var replace = {}; var replace = {};
if(options.replaceUI){ if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){ $.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1, 'range': 1,
'number': 1, 'number': 1,
'time': 1, 'time': 1,
@ -1887,14 +1885,18 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
'date': 1, 'date': 1,
'color': 1, 'color': 1,
'datetime-local': 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)))){ 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; replace.number = 1;
} }
if(!supportInputTypes.range || replace.range){ if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', { extendType('range', {
_create: function(opts, set){ _create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi'); var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -1905,12 +1907,13 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){ ['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, { extendType(name, {
_create: function(opts, set){ _create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){ if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true; opts.splitInput = true;
} }
if(opts.splitInput && !splitInputs[name]){ if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name); webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false; opts.splitInput = false;

View File

@ -392,7 +392,7 @@ var rsubmittable = /^(?:select|textarea|input)/i;
; ;
return function(){ return function(){
var elem = $(this).getNativeElement()[0]; var elem = $(this).getNativeElement()[0];
return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') ); return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') );
}; };
})() })()
}, },

View File

@ -156,18 +156,37 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(!support.fieldsetdisabled || !support.fieldsetelements){ if(!support.fieldsetdisabled || !support.fieldsetelements){
(function(){ (function(){
if(!support.fieldsetdisabled){ if(!support.fieldsetdisabled){
var hasIsDisabled = 'isDisabled' in document.createElement('div');
var isFieldsetGroup = { var isFieldsetGroup = {
fieldset: 1, fieldset: 1,
FIELDSET: 1 FIELDSET: 1
}; };
var disableElementsSel = 'input, textarea, select, button'; 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[":"], { $.extend($.expr[":"], {
"enabled": function( elem ) { "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 ) { "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){ if(value){
$(this.querySelectorAll(disableElementsSel)).each(groupControl.disable); $(this.querySelectorAll(disableElementsSel)).each(groupControl.disable);
} else if(!$(this).is('fieldset[disabled] *')){
} else if(!isDisabledChild(this)){
var elements = $(this.querySelectorAll(disableElementsSel)); var elements = $(this.querySelectorAll(disableElementsSel));
if( this.querySelector('fieldset[disabled]') ){ if( this.querySelector('fieldset[disabled]') ){
elements = elements.not('fieldset[disabled] *'); elements = elements.filter(isEnableChildFilter);
} }
elements.each(groupControl.enable); elements.each(groupControl.enable);
@ -218,7 +238,8 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(value){ if(value){
webshims.data(this, 'groupedisabled', false); webshims.data(this, 'groupedisabled', false);
desc.prop._supset.call(this, value); desc.prop._supset.call(this, value);
} else if($(this).is('fieldset[disabled] *')){
} else if(isDisabledChild(this)){
webshims.data(this, 'groupedisabled', true); webshims.data(this, 'groupedisabled', true);
desc.prop._supset.call(this, true); desc.prop._supset.call(this, true);
} else { } else {
@ -242,7 +263,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
webshims.addReady(function(context){ webshims.addReady(function(context){
$(context) $(context)
.filter('fieldset[disabled], fieldset[disabled] *') .filter(isDisabledChildFilter)
.find(disableElementsSel) .find(disableElementsSel)
.each(groupControl.disable) .each(groupControl.disable)
; ;
@ -254,7 +275,6 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
var isForm = {form: 1, FORM: 1}; var isForm = {form: 1, FORM: 1};
$.prop = function(elem, name, value){ $.prop = function(elem, name, value){
var ret; var ret;
//TODO: cache + perftest
if(elem && elem.nodeType == 1 && value === undefined && isForm[elem.nodeName] && elem.id){ if(elem && elem.nodeType == 1 && value === undefined && isForm[elem.nodeName] && elem.id){
ret = document.getElementsByName(name); ret = document.getElementsByName(name);
if(!ret || !ret.length){ if(!ret || !ret.length){
@ -896,7 +916,7 @@ webshims.register('form-shim-extend2', function($, webshims, window, document, u
if(elem.type == 'password' || isOver){ if(elem.type == 'password' || isOver){
data.text = createPlaceholder(elem); 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; data.box = data.text;
} else { } else {
data.box = $('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />') data.box = $('<span class="placeholder-box placeholder-box-'+ (elem.nodeName || '').toLowerCase() +' placeholder-box-'+$.css(elem, 'float')+'" />')

View File

@ -111,7 +111,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
shadowType = shadowElem.prop('type'); shadowType = shadowElem.prop('type');
} }
if( 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)) (e.type == 'focusout' && elem.type == 'radio' && isInGroup(elem.name))
){ ){
return; return;
@ -438,9 +438,9 @@ webshims.register('form-validation', function($, webshims, window, document, und
this.lastElement = $(element).getShadowFocusElement(); this.lastElement = $(element).getShadowFocusElement();
if(!this.prepared || !this.options.prepareFor){ if(!this.prepared || !this.options.prepareFor){
if(opts.appendTo == 'element' || (opts.inline && opts.appendTo == 'auto')){ if(opts.appendTo == 'element' || (opts.inline && opts.appendTo == 'auto')){
parentElem = element.parent(); parentElem = visual.parent();
} else if(opts.appendTo == 'auto'){ } else if(opts.appendTo == 'auto'){
parentElem = this._getAutoAppendElement(element); parentElem = this._getAutoAppendElement(visual);
} else { } else {
parentElem = $(opts.appendTo); parentElem = $(opts.appendTo);
} }
@ -679,7 +679,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
var ret = $(elem).data('errortype'); var ret = $(elem).data('errortype');
if(!ret){ if(!ret){
$.each(fields, function(errorName, cNames){ $.each(fields, function(errorName, cNames){
if($(elem).is(cNames)){ if($.find.matchesSelector(elem, cNames)){
ret = errorName; ret = errorName;
return false; return false;
} }
@ -724,7 +724,8 @@ webshims.register('form-validation', function($, webshims, window, document, und
}; };
})(), })(),
initIvalContentMessage: function(elem){ 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); this.get(elem);
} }
}, },
@ -794,7 +795,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
switchValidityClass({type: 'input', target: input}); switchValidityClass({type: 'input', target: input});
}; };
$(input) $(input)
.filter('input:not([type="checkbox"]):not([type="radio"])') .filter('input:not([type="checkbox"]):not([type="radio"]), textarea')
.off('.recheckinvalid') .off('.recheckinvalid')
.on('input.recheckinvalid', function(){ .on('input.recheckinvalid', function(){
clearTimeout(timer); clearTimeout(timer);
@ -840,7 +841,7 @@ webshims.register('form-validation', function($, webshims, window, document, und
this.hideError(elem, true).removeClass(successWrapperClass); this.hideError(elem, true).removeClass(successWrapperClass);
}, },
toggle: function(elem){ toggle: function(elem){
if($(elem).is(':invalid')){ if($.find.matchesSelector(elem, ':invalid')){
this.showError(elem); this.showError(elem);
} else { } else {
this.hideError(elem); this.hideError(elem);
@ -851,25 +852,21 @@ webshims.register('form-validation', function($, webshims, window, document, und
$(document.body) $(document.body)
.on({ .on({
'changedvaliditystate': function(e){ 'changedvaliditystate': function(e){
if(iVal.sel){ var form;
var form = $(e.target).jProp('form'); if(iVal.sel && (form = $.prop(e.target, 'form')) && $.find.matchesSelector(form, iVal.sel)){
if(form.is(iVal.sel)){
webshims.errorbox.toggle(e.target); webshims.errorbox.toggle(e.target);
} }
}
}, },
'resetvalidityui.webshims': function(e){ 'resetvalidityui.webshims': function(e){
if (iVal.sel) { var form;
var form = $(e.target).jProp('form'); if(iVal.sel && (form = $.prop(e.target, 'form')) && $.find.matchesSelector(form, iVal.sel)){
if (form.is(iVal.sel)) {
webshims.errorbox.reset(e.target); webshims.errorbox.reset(e.target);
} }
}
}, },
firstinvalid: function(e){ firstinvalid: function(e){
var form;
if(iVal.sel && iVal.handleBubble){ if(iVal.sel && iVal.handleBubble){
var form = $(e.target).jProp('form'); if(iVal.sel && (form = $.prop(e.target, 'form')) && $.find.matchesSelector(form, iVal.sel)){
if(form.is(iVal.sel)){
e.preventDefault(); e.preventDefault();
if(iVal.handleBubble != 'none'){ if(iVal.handleBubble != 'none'){
webshims.validityAlert.showFor( e.target, false, false, iVal.handleBubble == 'hide' ); 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){ 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(); e.stopImmediatePropagation();
return false; return false;
} }

View File

@ -1,6 +1,11 @@
webshims.register('form-validators', function($, webshims, window, document, undefined, options){ webshims.register('form-validators', function($, webshims, window, document, undefined, options){
"use strict"; "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(){ (function(){
if(webshims.refreshCustomValidityRules){ if(webshims.refreshCustomValidityRules){
webshims.error("form-validators already included. please remove custom-validity.js"); 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; elem = elements[id].elem;
if(elem != noTest && elements[id].val != (val = elem.value)){ if(elem != noTest && elements[id].val != (val = elem.value)){
elements[id].val = val; elements[id].val = val;
if($(elem).hasClass(iValClasses)){ if(iValClasses && $.find.matchesSelector(elem, iValClasses)){
$(elem).trigger('updatevalidation.webshims'); $(elem).trigger('updatevalidation.webshims');
} else { } else {
testValidityRules(elem); testValidityRules(elem);
@ -337,7 +342,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass;
val = !val; val = !val;
} }
$.prop( elem, data.prop, val); $.prop( elem, data.prop, val);
if(e){ if(iValClasses && e){
$(elem).getShadowElement().filter(iValClasses).trigger('updatevalidation.webshims'); $(elem).getShadowElement().filter(iValClasses).trigger('updatevalidation.webshims');
} }
}; };
@ -377,11 +382,13 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass;
} else { } else {
$(data.masterElement).on('change', function(){ $(data.masterElement).on('change', function(){
webshims.refreshCustomValidityRules(elem); webshims.refreshCustomValidityRules(elem);
if(iValClasses){
$(elem) $(elem)
.getShadowElement() .getShadowElement()
.filter(iValClasses) .filter(iValClasses)
.trigger('updatevalidation.webshims') .trigger('updatevalidation.webshims')
; ;
}
}); });
} }
} }
@ -416,7 +423,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass;
} }
data.ajaxvalidate.depends.on('change', function(){ data.ajaxvalidate.depends.on('change', function(){
if($(this).is(':valid')){ if($.find.matchesSelector(this, ':valid')){
webshims.refreshCustomValidityRules(elem); webshims.refreshCustomValidityRules(elem);
} }
}); });
@ -479,7 +486,7 @@ var iValClasses = '.'+ options.iVal.errorClass +', .'+options.iVal.successClass;
data = {}; data = {};
data[$.prop(elem, 'name') || $.prop(elem, 'id')] = $(elem).val(); data[$.prop(elem, 'name') || $.prop(elem, 'id')] = $(elem).val();
opts.depends.each(function(){ opts.depends.each(function(){
if($(this).is(':invalid')){ if($.find.matchesSelector(this, ':invalid')){
data = false; data = false;
return false; return false;
} }

View File

@ -1495,7 +1495,7 @@ webshims.register('forms-picker', function($, webshims, window, document, undefi
data._commonDateInit = true; data._commonDateInit = true;
var o = data.options; var o = data.options;
var actionfn = function(e){ var actionfn = function(e){
if(!$(this).is('.othermonth') || $(this).css('cursor') == 'pointer'){ if(!$(this).hasClass('othermonth') || $(this).css('cursor') == 'pointer'){
popover.actionFn({ popover.actionFn({
'data-action': $.attr(this, 'data-action'), 'data-action': $.attr(this, 'data-action'),
value: $(this).val() || $.attr(this, 'value') value: $(this).val() || $.attr(this, 'value')
@ -1550,13 +1550,13 @@ webshims.register('forms-picker', function($, webshims, window, document, undefi
$('button', popover.buttonRow).each(function(){ $('button', popover.buttonRow).each(function(){
var text; var text;
if($(this).is('.ws-empty')){ if($(this).hasClass('ws-empty')){
text = curCfg.date.clear; text = curCfg.date.clear;
if(!text){ if(!text){
text = formcfg[''].date.clear || 'clear'; text = formcfg[''].date.clear || 'clear';
webshims.warn("could not get clear text from form cfg"); 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; text = (curCfg[data.type] || {}).currentText;
if(!text){ if(!text){
text = (formcfg[''][[data.type]] || {}).currentText || (curCfg.date || {}).currentText || 'current'; text = (formcfg[''][[data.type]] || {}).currentText || (curCfg.date || {}).currentText || 'current';

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media; jmeData.media = media;
jmeData.player = base; jmeData.player = base;
media 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('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){ .on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume'); var volume = $.prop(this, 'volume');

View File

@ -1,5 +1,5 @@
/* thx to http://icomoon.io */ /* 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'; font-family: 'jme';
speak: none; speak: none;
font-style: normal; font-style: normal;
@ -29,7 +29,7 @@
content: "\e606"; content: "\e606";
} }
.mediaplayer[data-state="idle"] > .jme-media-overlay:before { .mediaplayer.initial-state > .jme-media-overlay:before {
content: "\e608"; content: "\e608";
} }
@ -85,7 +85,7 @@
content: "\e615"; content: "\e615";
} }
.mediaplayer[data-state="ended"] > .jme-media-overlay:before { .mediaplayer.ended-state > .jme-media-overlay:before {
content: "\e601"; content: "\e601";
} }
@ -99,6 +99,15 @@
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@-webkit-keyframes jmespin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes jmespin { @keyframes jmespin {
0% { 0% {
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);
@ -264,17 +273,17 @@
.mediaplayer[data-state="idle"] { .mediaplayer[data-state="idle"] {
cursor: pointer; cursor: pointer;
} }
.mediaplayer[data-state="idle"] > .jme-media-overlay { .mediaplayer.initial-state > .jme-media-overlay {
background-position: 1px 1px; 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: ""; content: "";
background-position: 2px 2px; background-position: 2px 2px;
} }
.mediaplayer[data-state="ended"] { .mediaplayer.ended-state {
cursor: pointer; cursor: pointer;
} }
.mediaplayer[data-state="ended"] > .jme-media-overlay { .mediaplayer.ended-state > .jme-media-overlay {
background-position: 3px 3px; background-position: 3px 3px;
} }
.mediaplayer[data-state="waiting"] { .mediaplayer[data-state="waiting"] {
@ -284,6 +293,10 @@
background-position: 4px 4px; background-position: 4px 4px;
} }
.mediaplayer[data-state="waiting"] > .jme-media-overlay:before { .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-name: jmespin;
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-duration: 1100ms; animation-duration: 1100ms;
@ -308,9 +321,10 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 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; display: block;
} }
.mediaplayer.no-poster .ws-poster, .mediaplayer.no-backgroundsize div.ws-poster { .mediaplayer.no-poster .ws-poster, .mediaplayer.no-backgroundsize div.ws-poster {

View File

@ -30,6 +30,15 @@ $browser-context: 16; // Default
@return #{$pixels/$context}em @return #{$pixels/$context}em
} }
@-webkit-keyframes jmespin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes jmespin { @keyframes jmespin {
0% { 0% {
@ -186,7 +195,9 @@ $browser-context: 16; // Default
&[data-state="idle"] { &[data-state="idle"] {
cursor: pointer; cursor: pointer;
}
&.initial-state {
> .jme-media-overlay { > .jme-media-overlay {
@extend %icon-play-circle; @extend %icon-play-circle;
background-position: 1px 1px; background-position: 1px 1px;
@ -198,7 +209,7 @@ $browser-context: 16; // Default
} }
} }
&[data-state="ended"] { &.ended-state {
cursor: pointer; cursor: pointer;
> .jme-media-overlay { > .jme-media-overlay {
@extend %icon-loop; @extend %icon-loop;
@ -213,6 +224,11 @@ $browser-context: 16; // Default
background-position: 4px 4px; background-position: 4px 4px;
&:before { &:before {
-webkit-animation-name: jmespin;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 1100ms;
-webkit-animation-timing-function: linear;
animation-name: jmespin; animation-name: jmespin;
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-duration: 1100ms; animation-duration: 1100ms;
@ -243,10 +259,12 @@ $browser-context: 16; // Default
left: 0; left: 0;
right: 0; right: 0;
bottom: 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; display: block;
} }

View File

@ -353,6 +353,7 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef
delete base._seekpause; delete base._seekpause;
} }
wasPaused = null; wasPaused = null;
media.triggerHandler('updateprogress');
} }
}); });
@ -1316,10 +1317,11 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef
$.jme.registerPlugin('buffer-progress', { $.jme.registerPlugin('buffer-progress', {
_create: function(control, media, base, options){ _create: function(control, media, base, options){
var progressTimer;
var indicator = $('<div class="buffer-progress-indicator" />').appendTo(control); var indicator = $('<div class="buffer-progress-indicator" />').appendTo(control);
var drawBufferProgress = function(){ var drawBufferProgress = function(){
var progress = media.jmeProp('progress'); var progress = media.jmeProp('progress');
clearTimeout(progressTimer);
if(options.progress !== progress){ if(options.progress !== progress){
options.progress = progress; options.progress = progress;
@ -1332,7 +1334,14 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef
indicator.css('width', 0); indicator.css('width', 0);
options.progress = 0; options.progress = 0;
}, },
playing: drawBufferProgress playing: drawBufferProgress,
'seeked seeking updateprogress': function(e){
clearTimeout(progressTimer);
if(e.type != 'seeking'){
progressTimer = setTimeout(drawBufferProgress, 100);
}
}
}); });
drawBufferProgress(); drawBufferProgress();
} }
@ -1418,8 +1427,8 @@ webshims.register('mediacontrols-lazy', function($, webshims, window, doc, undef
var buttons = this.buttons.not(':disabled'); var buttons = this.buttons.not(':disabled');
var activeButton = buttons.filter(':focus'); var activeButton = buttons.filter(':focus');
activeButton = buttons[buttons.index(activeButton) + dir] || buttons.filter(dir > 0 ? ':first' : ':last'); activeButton = (activeButton[0] && buttons[buttons.index(activeButton) + dir]) || buttons[dir > 0 ? 'first' : 'last']();
activeButton.trigger('focus'); $(activeButton).trigger('focus');
e.preventDefault(); e.preventDefault();
} }
}, },

View File

@ -151,17 +151,33 @@ webshims.register('mediacontrols', function($, webshims, window){
var regYt = /youtube\.com\/[watch\?|v\/]+/i; var regYt = /youtube\.com\/[watch\?|v\/]+/i;
var isInitial = data.media.prop('paused'); var isInitial = data.media.prop('paused');
var isEnded = data.media.prop('ended');
if(isInitial){ if(isInitial){
data.player.addClass('initial-state'); data.player.addClass('initial-state');
} }
if(isEnded){
data.player.addClass('ended-state');
}
if(!('backgroundSize' in $poster[0].style)){ if(!('backgroundSize' in $poster[0].style)){
data.player.addClass('no-backgroundsize'); 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){ if(isInitial){
isInitial = false; isInitial = false;
data.player.removeClass('initial-state'); 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(){ return function(){
var poster = data.media.attr('poster'); var poster = data.media.attr('poster');
@ -193,6 +209,11 @@ webshims.register('mediacontrols', function($, webshims, window){
isInitial = true; isInitial = true;
} }
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
if(lastYoutubeState !== hasYt){ if(lastYoutubeState !== hasYt){
lastYoutubeState = hasYt; lastYoutubeState = hasYt;
data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter'); data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter');

View File

@ -531,6 +531,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements); webshims.ready(swfType, initMediaElements);
} }
webshims.ready('track', loadTrackUi); webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
}); });
})(webshims); })(webshims);

View File

@ -127,6 +127,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
var onEvent = { var onEvent = {
onPlayPause: function(jaris, data, override){ onPlayPause: function(jaris, data, override){
var playing, type; var playing, type;
var idled = data.paused || data.ended;
if(override == null){ if(override == null){
try { try {
playing = data.api.api_get("isPlaying"); playing = data.api.api_get("isPlaying");
@ -134,7 +135,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
} else { } else {
playing = override; playing = override;
} }
if(playing == data.paused){ if(playing == idled || playing == null){
data.paused = !playing; data.paused = !playing;
type = data.paused ? 'pause' : 'play'; type = data.paused ? 'pause' : 'play';
@ -1211,11 +1212,11 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
var media, error, parent; var media, error, parent;
if( if(
($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) && ($(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'); error = media.prop('error');
setTimeout(function(){ setTimeout(function(){
if(!media.is('.nonnative-api-active')){ if(!media.hasClass('nonnative-api-active')){
if(error && switchErrors[error.code]){ if(error && switchErrors[error.code]){
options.preferFlash = true; options.preferFlash = true;
document.removeEventListener('error', switchOptions, true); document.removeEventListener('error', switchOptions, true);

View File

@ -10,7 +10,6 @@
webshim.isReady('picture', true); webshim.isReady('picture', true);
setTimeout(function(){ setTimeout(function(){
webshim.ready('matchMedia', function(){
if(window.picturefill){ if(window.picturefill){
var sel = 'picture, img[srcset]'; var sel = 'picture, img[srcset]';
webshim.addReady(function(context){ webshim.addReady(function(context){
@ -20,13 +19,56 @@
}); });
} }
}); });
});
})(); })();
/*! Picturefill - v2.1.0-beta - 2014-07-15
/*! Picturefill - v2.1.0-beta - 2014-06-03
* http://scottjehl.github.io/picturefill * http://scottjehl.github.io/picturefill
* Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ * 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. /*! Picturefill - Responsive Images that work today.
* Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar ) * Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
* License: MIT/GPLv2 * License: MIT/GPLv2
@ -38,6 +80,7 @@
// If picture is supported, well, that's awesome. Let's get outta here... // If picture is supported, well, that's awesome. Let's get outta here...
if ( w.HTMLPictureElement ) { if ( w.HTMLPictureElement ) {
w.picturefill = function() { };
return; return;
} }
@ -51,7 +94,8 @@
pf.ns = "picturefill"; pf.ns = "picturefill";
// srcset support test // 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 // just a string trim workaround
pf.trim = function( str ) { pf.trim = function( str ) {
@ -82,8 +126,8 @@
* http://dev.w3.org/csswg/css-values-3/#length-value * http://dev.w3.org/csswg/css-values-3/#length-value
*/ */
pf.getWidthFromLength = function( length ) { pf.getWidthFromLength = function( length ) {
// If no length was specified, or it is 0, default to `100vw` (per the spec). // If no length was specified, or it is 0 or negative, default to `100vw` (per the spec).
length = length && parseFloat( length ) > 0 ? length : "100vw"; length = length && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 ) ? length : "100vw";
/** /**
* If length is specified in `vw` units, use `%` instead since the div were measuring * If length is specified in `vw` units, use `%` instead since the div were measuring
@ -101,7 +145,12 @@
// Positioning styles help prevent padding/margin/width on `html` from throwing calculations off. // Positioning styles help prevent padding/margin/width on `html` from throwing calculations off.
pf.lengthEl.style.cssText = "position: absolute; left: 0; width: " + length + ";"; 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; return pf.lengthEl.offsetWidth;
}; };
@ -263,38 +312,32 @@
return candidates; 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 // 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. // is the order in which entries are added to the list.
var sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""), var sizes = sizesattr || "100vw",
widthInCssPixels = sizes ? pf.findWidthFromSourceSize( sizes ) : "100%", sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""),
widthInCssPixels = pf.findWidthFromSourceSize( sizes ),
resCandidate; resCandidate;
if ( sizeDescriptor ) { if ( sizeDescriptor ) {
var splitDescriptor = sizeDescriptor.split(" "); var splitDescriptor = sizeDescriptor.split(" ");
for (var i = splitDescriptor.length + 1; i >= 0; i--) { for (var i = splitDescriptor.length + 1; i >= 0; i--) {
if ( splitDescriptor[ i ] !== undefined ) {
var curr = splitDescriptor[ i ], var curr = splitDescriptor[ i ],
lastchar = curr && curr.slice( curr.length - 1 ); lastchar = curr && curr.slice( curr.length - 1 );
if ( lastchar === "w" || lastchar === "x" ) { if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) {
resCandidate = curr;
}
if ( sizes && resCandidate ) {
// get the dpr by taking the length / width in css pixels
resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) ); resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) );
} else { } else if ( lastchar === "x" ) {
// get the dpr by grabbing the value of Nx
var res = curr && parseFloat( curr, 10 ); var res = curr && parseFloat( curr, 10 );
resCandidate = res && !isNaN( res ) ? res : 1;
resCandidate = res && !isNaN( res ) && lastchar === "x" || lastchar === "w" ? 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; picImg.src = bestCandidate.url;
// currentSrc attribute and property to match // currentSrc attribute and property to match
// http://picture.responsiveimages.org/#the-img-element // http://picture.responsiveimages.org/#the-img-element
@ -405,32 +448,26 @@
}; };
/* /*
* Find all picture elements and, * Find all `img` elements, and add them to the candidate list if they have
* in browsers that don't natively support srcset, find all img elements * a `picture` parent, a `sizes` attribute in basic `srcset` supporting browsers,
* with srcset attrs that don't have picture parents * a `srcset` attribute at all, and they havent been evaluated already.
*/ */
pf.getAllElements = function() { pf.getAllElements = function() {
var pictures = doc.getElementsByTagName( "picture" ), var elems = [],
elems = [],
imgs = doc.getElementsByTagName( "img" ); imgs = doc.getElementsByTagName( "img" );
for ( var h = 0, len = pictures.length + imgs.length; h < len; h++ ) { for ( var h = 0, len = imgs.length; h < len; h++ ) {
if ( h < pictures.length ) { var currImg = imgs[ h ];
elems[ h ] = pictures[ h ];
} else {
var currImg = imgs[ h - pictures.length ];
if ( currImg.parentNode.nodeName.toUpperCase() !== "PICTURE" && if ( currImg.parentNode.nodeName.toUpperCase() === "PICTURE" ||
( ( pf.srcsetSupported && currImg.getAttribute( "sizes" ) ) || ( currImg.getAttribute( "srcset" ) !== null ) || currImg[ pf.ns ] && currImg[ pf.ns ].srcset !== null ) {
currImg.getAttribute( "srcset" ) !== null ) ) {
elems.push( currImg ); elems.push( currImg );
} }
} }
}
return elems; return elems;
}; };
pf.getMatch = function( picture ) { pf.getMatch = function( img, picture ) {
var sources = picture.childNodes, var sources = picture.childNodes,
match; match;
@ -443,9 +480,9 @@
continue; 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 no previous `source` matches, the `img` itself is evaluated later.
if ( source.nodeName.toUpperCase() === "IMG" ) { if ( source === img ) {
return match; return match;
} }
@ -477,24 +514,22 @@
return match; return match;
}; };
function picturefill( options ) { function picturefill( opt ) {
var elements, var elements,
element, element,
elemType, parent,
firstMatch, firstMatch,
candidates, candidates,
picImg;
options = options || {}; options = opt || {};
elements = options.elements || pf.getAllElements(); elements = options.elements || pf.getAllElements();
// Loop through all elements // Loop through all elements
for ( var i = 0, plen = elements.length; i < plen; i++ ) { for ( var i = 0, plen = elements.length; i < plen; i++ ) {
element = elements[ i ]; element = elements[ i ];
elemType = element.nodeName.toUpperCase(); parent = element.parentNode;
firstMatch = undefined; firstMatch = undefined;
candidates = undefined; candidates = undefined;
picImg = undefined;
// expando for caching data on the img // expando for caching data on the img
if ( !element[ pf.ns ] ) { if ( !element[ pf.ns ] ) {
@ -508,16 +543,16 @@
continue; continue;
} }
// if element is a picture element // if `img` is in a `picture` element
if ( elemType === "PICTURE" ) { if ( parent.nodeName.toUpperCase() === "PICTURE" ) {
// IE9 video workaround // IE9 video workaround
pf.removeVideoShim( element ); pf.removeVideoShim( parent );
// return the first match which might undefined // return the first match which might undefined
// returns false if there is a pending source // returns false if there is a pending source
// TODO the return type here is brutal, cleanup // 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) // 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 // remove the evaluated attr and skip for now ( the pending test will
@ -525,37 +560,27 @@
if ( firstMatch === false ) { if ( firstMatch === false ) {
continue; continue;
} }
// Find any existing img element in the picture element
picImg = element.getElementsByTagName( "img" )[ 0 ];
} else { } else {
// if it's an img element
firstMatch = undefined; firstMatch = undefined;
picImg = element;
} }
if ( picImg ) { // Cache and remove `srcset` if present and were going to be doing `picture`/`srcset`/`sizes` polyfilling to it.
if ( parent.nodeName.toUpperCase() === "PICTURE" ||
// expando for caching data on the img ( element.srcset && !pf.srcsetSupported ) ||
if ( !picImg[ pf.ns ] ) { ( !pf.sizesSupported && ( element.srcset && element.srcset.indexOf("w") > -1 ) ) ) {
picImg[ pf.ns ] = {}; pf.dodgeSrcset( element );
}
// Cache and remove `srcset` if present and were going to be doing `sizes`/`picture` polyfilling to it.
if ( picImg.srcset && ( elemType === "PICTURE" || picImg.getAttribute( "sizes" ) ) ) {
pf.dodgeSrcset( picImg );
} }
if ( firstMatch ) { if ( firstMatch ) {
candidates = pf.processSourceSet( firstMatch ); candidates = pf.processSourceSet( firstMatch );
pf.applyBestCandidate( candidates, picImg ); pf.applyBestCandidate( candidates, element );
} else { } else {
// No sources matched, so were down to processing the inner `img` as a source. // No sources matched, so were down to processing the inner `img` as a source.
candidates = pf.processSourceSet( picImg ); candidates = pf.processSourceSet( element );
if ( picImg.srcset === undefined || picImg[ pf.ns ].srcset ) { if ( element.srcset === undefined || element[ pf.ns ].srcset ) {
// Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality. // Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality.
pf.applyBestCandidate( candidates, picImg ); pf.applyBestCandidate( candidates, element );
} // Else, resolution-only `srcset` is supported natively. } // Else, resolution-only `srcset` is supported natively.
} }
@ -563,7 +588,6 @@
element[ pf.ns ].evaluated = true; element[ pf.ns ].evaluated = true;
} }
} }
}
/** /**
* Sets up picture polyfill by polling the document and running * Sets up picture polyfill by polling the document and running
@ -596,7 +620,7 @@
} }
} }
webshim.ready('matchMedia', runPicturefill); runPicturefill();
/* expose methods for testing */ /* expose methods for testing */
picturefill._ = pf; picturefill._ = pf;
@ -615,3 +639,4 @@
} )( this, this.document ); } )( this, this.document );

View File

@ -1,18 +1,29 @@
/*! /*!
* jQuery UI Position 1.10.3 * jQuery UI Position 1.11.0
* http://jqueryui.com * http://jqueryui.com
* *
* Copyright 2013 jQuery Foundation and other contributors * Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license. * Released under the MIT license.
* http://jquery.org/license * http://jquery.org/license
* *
* http://api.jqueryui.com/position/ * http://api.jqueryui.com/position/
*/ */
(function( $, undefined ) { (function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else {
// Browser globals
factory( window.webshims && window.webshims.$ || jQuery );
}
}(function( $ ) {
(function() {
$.ui = $.ui || {}; $.ui = $.ui || {};
var cachedScrollbarWidth, var cachedScrollbarWidth, supportsOffsetFractions,
max = Math.max, max = Math.max,
abs = Math.abs, abs = Math.abs,
round = Math.round, round = Math.round,
@ -70,7 +81,7 @@ $.position = {
return cachedScrollbarWidth; return cachedScrollbarWidth;
} }
var w1, w2, var w1, w2,
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
innerDiv = div.children()[0]; innerDiv = div.children()[0];
$( "body" ).append( div ); $( "body" ).append( div );
@ -88,8 +99,10 @@ $.position = {
return (cachedScrollbarWidth = w1 - w2); return (cachedScrollbarWidth = w1 - w2);
}, },
getScrollInfo: function( within ) { getScrollInfo: function( within ) {
var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), var overflowX = within.isWindow || within.isDocument ? "" :
overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), within.element.css( "overflow-x" ),
overflowY = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" || hasOverflowX = overflowX === "scroll" ||
( overflowX === "auto" && within.width < within.element[0].scrollWidth ), ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
hasOverflowY = overflowY === "scroll" || hasOverflowY = overflowY === "scroll" ||
@ -101,10 +114,12 @@ $.position = {
}, },
getWithinInfo: function( element ) { getWithinInfo: function( element ) {
var withinElement = $( element || window ), var withinElement = $( element || window ),
isWindow = $.isWindow( withinElement[0] ); isWindow = $.isWindow( withinElement[0] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
return { return {
element: withinElement, element: withinElement,
isWindow: isWindow, isWindow: isWindow,
isDocument: isDocument,
offset: withinElement.offset() || { left: 0, top: 0 }, offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(), scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(), scrollTop: withinElement.scrollTop(),
@ -221,7 +236,7 @@ $.fn.position = function( options ) {
position.top += myOffset[ 1 ]; position.top += myOffset[ 1 ];
// if the browser doesn't support fractions, then round for consistent results // if the browser doesn't support fractions, then round for consistent results
if ( !$.support.offsetFractions ) { if ( !supportsOffsetFractions ) {
position.left = round( position.left ); position.left = round( position.left );
position.top = round( position.top ); position.top = round( position.top );
} }
@ -399,8 +414,7 @@ $.ui.position = {
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset; position.left += myOffset + atOffset + offset;
} }
} } else if ( overRight > 0 ) {
else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset; position.left += myOffset + atOffset + offset;
@ -434,8 +448,7 @@ $.ui.position = {
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
position.top += myOffset + atOffset + offset; position.top += myOffset + atOffset + offset;
} }
} } else if ( overBottom > 0 ) {
else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
position.top += myOffset + atOffset + offset; position.top += myOffset + atOffset + offset;
@ -488,10 +501,15 @@ $.ui.position = {
div.style.cssText = "position: absolute; left: 10.7432222px;"; div.style.cssText = "position: absolute; left: 10.7432222px;";
offsetLeft = $( div ).offset().left; offsetLeft = $( div ).offset().left;
$.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
testElement.innerHTML = ""; testElement.innerHTML = "";
testElementParent.removeChild( testElement ); testElementParent.removeChild( testElement );
})(); })();
}( window.webshims && window.webshims.$ || jQuery ) ); })();
return $.ui.position;
}));

View File

@ -1,684 +0,0 @@
(function() {
var define, requireModule, require, requirejs;
(function() {
var registry = {}, seen = {};
define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requirejs = require = requireModule = function(name) {
requirejs._eak_seen = registry;
if (seen[name]) { return seen[name]; }
seen[name] = {};
if (!registry[name]) {
throw new Error("Could not find module " + name);
}
var mod = registry[name],
deps = mod.deps,
callback = mod.callback,
reified = [],
exports;
for (var i=0, l=deps.length; i<l; i++) {
if (deps[i] === 'exports') {
reified.push(exports = {});
} else {
reified.push(requireModule(resolve(deps[i])));
}
}
var value = callback.apply(this, reified);
return seen[name] = exports || value;
function resolve(child) {
if (child.charAt(0) !== '.') { return child; }
var parts = child.split("/");
var parentBase = name.split("/").slice(0, -1);
for (var i=0, l=parts.length; i<l; i++) {
var part = parts[i];
if (part === '..') { parentBase.pop(); }
else if (part === '.') { continue; }
else { parentBase.push(part); }
}
return parentBase.join("/");
}
};
})();
define("promise/all",
["./utils","exports"],
function(__dependency1__, __exports__) {
"use strict";
/* global toString */
var isArray = __dependency1__.isArray;
var isFunction = __dependency1__.isFunction;
/**
Returns a promise that is fulfilled when all the given promises have been
fulfilled, or rejected if any of them become rejected. The return promise
is fulfilled with an array that gives all the values in the order they were
passed in the `promises` array argument.
Example:
```javascript
var promise1 = RSVP.resolve(1);
var promise2 = RSVP.resolve(2);
var promise3 = RSVP.resolve(3);
var promises = [ promise1, promise2, promise3 ];
RSVP.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
If any of the `promises` given to `RSVP.all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
Example:
```javascript
var promise1 = RSVP.resolve(1);
var promise2 = RSVP.reject(new Error("2"));
var promise3 = RSVP.reject(new Error("3"));
var promises = [ promise1, promise2, promise3 ];
RSVP.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
@method all
@for RSVP
@param {Array} promises
@param {String} label
@return {Promise} promise that is fulfilled when all `promises` have been
fulfilled, or rejected if any of them become rejected.
*/
function all(promises) {
/*jshint validthis:true */
var Promise = this;
if (!isArray(promises)) {
throw new TypeError('You must pass an array to all.');
}
return new Promise(function(resolve, reject) {
var results = [], remaining = promises.length,
promise;
if (remaining === 0) {
resolve([]);
}
function resolver(index) {
return function(value) {
resolveAll(index, value);
};
}
function resolveAll(index, value) {
results[index] = value;
if (--remaining === 0) {
resolve(results);
}
}
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && isFunction(promise.then)) {
promise.then(resolver(i), reject);
} else {
resolveAll(i, promise);
}
}
});
}
__exports__.all = all;
});
define("promise/asap",
["exports"],
function(__exports__) {
"use strict";
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this);
// node
function useNextTick() {
return function() {
process.nextTick(flush);
};
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
function useSetTimeout() {
return function() {
local.setTimeout(flush, 1);
};
}
var queue = [];
function flush() {
for (var i = 0; i < queue.length; i++) {
var tuple = queue[i];
var callback = tuple[0], arg = tuple[1];
callback(arg);
}
queue = [];
}
var scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else {
scheduleFlush = useSetTimeout();
}
function asap(callback, arg) {
var length = queue.push([callback, arg]);
if (length === 1) {
// If length is 1, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
scheduleFlush();
}
}
__exports__.asap = asap;
});
define("promise/config",
["exports"],
function(__exports__) {
"use strict";
var config = {
instrument: false
};
function configure(name, value) {
if (arguments.length === 2) {
config[name] = value;
} else {
return config[name];
}
}
__exports__.config = config;
__exports__.configure = configure;
});
define("promise/polyfill",
["./promise","./utils","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
/*global self*/
var RSVPPromise = __dependency1__.Promise;
var isFunction = __dependency2__.isFunction;
function polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof window !== 'undefined' && window.document) {
local = window;
} else {
local = self;
}
var es6PromiseSupport =
"Promise" in local &&
// Some of these methods are missing from
// Firefox/Chrome experimental implementations
"resolve" in local.Promise &&
"reject" in local.Promise &&
"all" in local.Promise &&
"race" in local.Promise &&
// Older version of the spec had a resolver object
// as the arg rather than a function
(function() {
var resolve;
new local.Promise(function(r) { resolve = r; });
return isFunction(resolve);
}());
if (!es6PromiseSupport) {
local.Promise = RSVPPromise;
}
}
__exports__.polyfill = polyfill;
});
define("promise/promise",
["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __exports__) {
"use strict";
var config = __dependency1__.config;
var configure = __dependency1__.configure;
var objectOrFunction = __dependency2__.objectOrFunction;
var isFunction = __dependency2__.isFunction;
var now = __dependency2__.now;
var all = __dependency3__.all;
var race = __dependency4__.race;
var staticResolve = __dependency5__.resolve;
var staticReject = __dependency6__.reject;
var asap = __dependency7__.asap;
var counter = 0;
config.async = asap; // default async is asap;
function Promise(resolver) {
if (!isFunction(resolver)) {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
if (!(this instanceof Promise)) {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
this._subscribers = [];
invokeResolver(resolver, this);
}
function invokeResolver(resolver, promise) {
function resolvePromise(value) {
resolve(promise, value);
}
function rejectPromise(reason) {
reject(promise, reason);
}
try {
resolver(resolvePromise, rejectPromise);
} catch(e) {
rejectPromise(e);
}
}
function invokeCallback(settled, promise, callback, detail) {
var hasCallback = isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
try {
value = callback(detail);
succeeded = true;
} catch(e) {
failed = true;
error = e;
}
} else {
value = detail;
succeeded = true;
}
if (handleThenable(promise, value)) {
return;
} else if (hasCallback && succeeded) {
resolve(promise, value);
} else if (failed) {
reject(promise, error);
} else if (settled === FULFILLED) {
resolve(promise, value);
} else if (settled === REJECTED) {
reject(promise, value);
}
}
var PENDING = void 0;
var SEALED = 0;
var FULFILLED = 1;
var REJECTED = 2;
function subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
subscribers[length] = child;
subscribers[length + FULFILLED] = onFulfillment;
subscribers[length + REJECTED] = onRejection;
}
function publish(promise, settled) {
var child, callback, subscribers = promise._subscribers, detail = promise._detail;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
invokeCallback(settled, child, callback, detail);
}
promise._subscribers = null;
}
Promise.prototype = {
constructor: Promise,
_state: undefined,
_detail: undefined,
_subscribers: undefined,
then: function(onFulfillment, onRejection) {
var promise = this;
var thenPromise = new this.constructor(function() {});
if (this._state) {
var callbacks = arguments;
config.async(function invokePromiseCallback() {
invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);
});
} else {
subscribe(this, thenPromise, onFulfillment, onRejection);
}
return thenPromise;
},
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
Promise.all = all;
Promise.race = race;
Promise.resolve = staticResolve;
Promise.reject = staticReject;
function handleThenable(promise, value) {
var then = null,
resolved;
try {
if (promise === value) {
throw new TypeError("A promises callback cannot return that same promise.");
}
if (objectOrFunction(value)) {
then = value.then;
if (isFunction(then)) {
then.call(value, function(val) {
if (resolved) { return true; }
resolved = true;
if (value !== val) {
resolve(promise, val);
} else {
fulfill(promise, val);
}
}, function(val) {
if (resolved) { return true; }
resolved = true;
reject(promise, val);
});
return true;
}
}
} catch (error) {
if (resolved) { return true; }
reject(promise, error);
return true;
}
return false;
}
function resolve(promise, value) {
if (promise === value) {
fulfill(promise, value);
} else if (!handleThenable(promise, value)) {
fulfill(promise, value);
}
}
function fulfill(promise, value) {
if (promise._state !== PENDING) { return; }
promise._state = SEALED;
promise._detail = value;
config.async(publishFulfillment, promise);
}
function reject(promise, reason) {
if (promise._state !== PENDING) { return; }
promise._state = SEALED;
promise._detail = reason;
config.async(publishRejection, promise);
}
function publishFulfillment(promise) {
publish(promise, promise._state = FULFILLED);
}
function publishRejection(promise) {
publish(promise, promise._state = REJECTED);
}
__exports__.Promise = Promise;
});
define("promise/race",
["./utils","exports"],
function(__dependency1__, __exports__) {
"use strict";
/* global toString */
var isArray = __dependency1__.isArray;
/**
`RSVP.race` allows you to watch a series of promises and act as soon as the
first promise given to the `promises` argument fulfills or rejects.
Example:
```javascript
var promise1 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 1");
}, 200);
});
var promise2 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 2");
}, 100);
});
RSVP.race([promise1, promise2]).then(function(result){
// result === "promise 2" because it was resolved before promise1
// was resolved.
});
```
`RSVP.race` is deterministic in that only the state of the first completed
promise matters. For example, even if other promises given to the `promises`
array argument are resolved, but the first completed promise has become
rejected before the other promises became fulfilled, the returned promise
will become rejected:
```javascript
var promise1 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 1");
}, 200);
});
var promise2 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error("promise 2"));
}, 100);
});
RSVP.race([promise1, promise2]).then(function(result){
// Code here never runs because there are rejected promises!
}, function(reason){
// reason.message === "promise2" because promise 2 became rejected before
// promise 1 became fulfilled
});
```
@method race
@for RSVP
@param {Array} promises array of promises to observe
@param {String} label optional string for describing the promise returned.
Useful for tooling.
@return {Promise} a promise that becomes fulfilled with the value the first
completed promises is resolved with if the first completed promise was
fulfilled, or rejected with the reason that the first completed promise
was rejected with.
*/
function race(promises) {
/*jshint validthis:true */
var Promise = this;
if (!isArray(promises)) {
throw new TypeError('You must pass an array to race.');
}
return new Promise(function(resolve, reject) {
var results = [], promise;
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && typeof promise.then === 'function') {
promise.then(resolve, reject);
} else {
resolve(promise);
}
}
});
}
__exports__.race = race;
});
define("promise/reject",
["exports"],
function(__exports__) {
"use strict";
/**
`RSVP.reject` returns a promise that will become rejected with the passed
`reason`. `RSVP.reject` is essentially shorthand for the following:
```javascript
var promise = new RSVP.Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
var promise = RSVP.reject(new Error('WHOOPS'));
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
@method reject
@for RSVP
@param {Any} reason value that the returned promise will be rejected with.
@param {String} label optional string for identifying the returned promise.
Useful for tooling.
@return {Promise} a promise that will become rejected with the given
`reason`.
*/
function reject(reason) {
/*jshint validthis:true */
var Promise = this;
return new Promise(function (resolve, reject) {
reject(reason);
});
}
__exports__.reject = reject;
});
define("promise/resolve",
["exports"],
function(__exports__) {
"use strict";
function resolve(value) {
/*jshint validthis:true */
if (value && typeof value === 'object' && value.constructor === this) {
return value;
}
var Promise = this;
return new Promise(function(resolve) {
resolve(value);
});
}
__exports__.resolve = resolve;
});
define("promise/utils",
["exports"],
function(__exports__) {
"use strict";
function objectOrFunction(x) {
return isFunction(x) || (typeof x === "object" && x !== null);
}
function isFunction(x) {
return typeof x === "function";
}
function isArray(x) {
return Object.prototype.toString.call(x) === "[object Array]";
}
// Date.now is not available in browsers < IE9
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
var now = Date.now || function() { return new Date().getTime(); };
__exports__.objectOrFunction = objectOrFunction;
__exports__.isFunction = isFunction;
__exports__.isArray = isArray;
__exports__.now = now;
});
requireModule('promise/polyfill').polyfill();
}());

View File

@ -1,12 +1,12 @@
/*! /*!
* Sizzle CSS Selector Engine v1.10.18 * Sizzle CSS Selector Engine v1.10.19
* http://sizzlejs.com/ * http://sizzlejs.com/
* *
* Copyright 2013 jQuery Foundation, Inc. and other contributors * Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-02-05 * Date: 2014-04-18
*/ */
(function( window ) { (function( window ) {
@ -15,6 +15,7 @@
Expr, Expr,
getText, getText,
isXML, isXML,
tokenize,
compile, compile,
select, select,
outermostContext, outermostContext,
@ -83,17 +84,23 @@
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ), identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
// Prefer arguments quoted, pseudos = ":(" + characterEncoding + ")(?:\\((" +
// then not containing pseudos/brackets, // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// then attribute selectors/non-parenthetical expressions, // 1. quoted (capture 3; capture 4 or capture 5)
// then anything else "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// These preferences are here to reduce the number of selectors // 2. simple (capture 6)
// needing tokenize in the PSEUDO preFilter "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", // 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
@ -614,11 +621,13 @@
// setting a boolean content attribute, // setting a boolean content attribute,
// since its presence should be enough // since its presence should be enough
// http://bugs.jquery.com/ticket/12359 // http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select t=''><option selected=''></option></select>"; div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
// Support: IE8, Opera 10-12 // Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^= or $= or *= // Nothing should be selected when empty strings follow ^= or $= or *=
if ( div.querySelectorAll("[t^='']").length ) { // The test attribute must be unknown in Opera but "safe" for WinRT
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if ( div.querySelectorAll("[msallowclip^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
} }
@ -661,7 +670,8 @@
}); });
} }
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector || docElem.mozMatchesSelector ||
docElem.oMatchesSelector || docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) { docElem.msMatchesSelector) )) ) {
@ -971,7 +981,7 @@
match[1] = match[1].replace( runescape, funescape ); match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted // 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] === "~=" ) { if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " "; match[3] = " " + match[3] + " ";
@ -1014,15 +1024,15 @@
"PSEUDO": function( match ) { "PSEUDO": function( match ) {
var excess, var excess,
unquoted = !match[5] && match[2]; unquoted = !match[6] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) { if ( matchExpr["CHILD"].test( match[0] ) ) {
return null; return null;
} }
// Accept quoted arguments as-is // Accept quoted arguments as-is
if ( match[3] && match[4] !== undefined ) { if ( match[3] ) {
match[2] = match[4]; match[2] = match[4] || match[5] || "";
// Strip excess characters from unquoted arguments // Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) && } else if ( unquoted && rpseudo.test( unquoted ) &&
@ -1427,7 +1437,7 @@
setFilters.prototype = Expr.filters = Expr.pseudos; setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters(); Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) { tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
var matched, match, tokens, type, var matched, match, tokens, type,
soFar, groups, preFilters, soFar, groups, preFilters,
cached = tokenCache[ selector + " " ]; cached = tokenCache[ selector + " " ];
@ -1492,7 +1502,7 @@
Sizzle.error( selector ) : Sizzle.error( selector ) :
// Cache the tokens // Cache the tokens
tokenCache( selector, groups ).slice( 0 ); tokenCache( selector, groups ).slice( 0 );
} };
function toSelector( tokens ) { function toSelector( tokens ) {
var i = 0, var i = 0,
@ -2032,7 +2042,6 @@
// EXPOSE // EXPOSE
(function(jQuery){ (function(jQuery){
jQuery.find = Sizzle; jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors; jQuery.expr = Sizzle.selectors;
@ -2044,4 +2053,3 @@
webshims.isReady('sizzle', true); webshims.isReady('sizzle', true);
})(window.webshims && window.webshims.$ || window.jQuery, window.Sizzle); })(window.webshims && window.webshims.$ || window.jQuery, window.Sizzle);
})( window ); })( window );

View File

@ -22,6 +22,9 @@ SASS:
.hide-spinbtns .input-buttons > .step-controls { .hide-spinbtns .input-buttons > .step-controls {
display: none; 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,
.hide-spinbtns ::-webkit-inner-spin-button { .hide-spinbtns ::-webkit-inner-spin-button {
display: none; display: none;
@ -36,6 +39,9 @@ SASS:
.hide-inputbtns .input-buttons { .hide-inputbtns .input-buttons {
display: none; 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,
.hide-inputbtns ::-webkit-inner-spin-button { .hide-inputbtns ::-webkit-inner-spin-button {
display: none; display: none;
@ -190,6 +196,10 @@ span.has-input-buttons {
cursor: not-allowed; cursor: not-allowed;
} }
.ws-number[readonly][aria-readonly="false"] {
cursor: default;
}
.input-buttons, .input-buttons,
.step-controls, .step-controls,
.ws-popover-opener { .ws-popover-opener {
@ -297,12 +307,10 @@ input[type="color"] {
margin-right: -39px; margin-right: -39px;
} }
.input-button-size-2 .step-controls { .input-button-size-2 .step-controls {
visibility: hidden;
opacity: 0; 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 { :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; opacity: 1;
visibility: visible;
} }
.step-controls { .step-controls {

View File

@ -78,7 +78,7 @@ SASS:
outline: none; outline: none;
text-align: center; text-align: center;
font-family: sans-serif; font-family: sans-serif;
width: 27.69231em; width: 29.23077em;
min-width: 20.76923em; min-width: 20.76923em;
max-width: 98vw; max-width: 98vw;
/* Selector API: */ /* Selector API: */

View File

@ -82,6 +82,11 @@ $btnapis: hide-spinbtns hide-dropdownbtn hide-inputbtns inputbtns-outside a11yhi
display: none; display: none;
} }
input[type="number"],
&[type="number"], {
-moz-appearance: textfield;
}
&::-webkit-inner-spin-button, &::-webkit-inner-spin-button,
::-webkit-inner-spin-button { ::-webkit-inner-spin-button {
display: none; display: none;
@ -101,6 +106,11 @@ $btnapis: hide-spinbtns hide-dropdownbtn hide-inputbtns inputbtns-outside a11yhi
display: none; display: none;
} }
input[type="number"],
&[type="number"], {
-moz-appearance: textfield;
}
&::-webkit-inner-spin-button, &::-webkit-inner-spin-button,
::-webkit-inner-spin-button { ::-webkit-inner-spin-button {
display: none; display: none;

View File

@ -73,6 +73,10 @@ span.has-input-buttons {
} }
} }
.ws-number[readonly][aria-readonly="false"] {
cursor: default;
}
.input-buttons, .input-buttons,
.step-controls, .step-controls,
.ws-popover-opener { .ws-popover-opener {
@ -209,7 +213,6 @@ input[type="color"] {
} }
.step-controls { .step-controls {
visibility: hidden;
opacity: 0; opacity: 0;
} }
@ -219,7 +222,6 @@ input[type="color"] {
&:hover { &:hover {
.step-controls { .step-controls {
opacity: 1; opacity: 1;
visibility: visible;
} }
} }

View File

@ -17,7 +17,7 @@ $button-bgcolor: #f5f5f5;
outline: none; outline: none;
text-align: center; text-align: center;
font-family: sans-serif; font-family: sans-serif;
width: em(360); width: em(380);
min-width: em(270); min-width: em(270);
max-width: 98vw; max-width: 98vw;

View File

@ -408,6 +408,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
.datalist-polyfill { .datalist-polyfill {
position: absolute; position: absolute;
text-align: left;
.ws-po-box { .ws-po-box {
padding: em(5) 0; padding: em(5) 0;
@ -437,7 +438,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
li { li {
margin: em(1) 0; margin: em(1) 0;
padding: em(2) em(10); padding: em(4) em(10);
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
cursor: default; cursor: default;
@ -455,31 +456,26 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
} }
.option-value { .option-value {
display: inline-block; display: block;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 100%; max-width: 100%;
color: #000; color: #000;
float: left;
transition: color 400ms; transition: color 400ms;
} }
.option-label { .option-label {
display: none; display: none;
max-width: 100%;
float: right;
font-size: 90%; font-size: 90%;
color: #666; color: #666;
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: bottom; margin-top: 0.1em;
margin-top: 0.15em;
margin-left: em(10);
text-align: right;
transition: color 400ms; transition: color 400ms;
} }
.has-option-label { .has-option-label {
.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;
}
}
} }

View File

@ -366,6 +366,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
.datalist-polyfill { .datalist-polyfill {
position: absolute; position: absolute;
text-align: left;
} }
.datalist-polyfill .ws-po-box { .datalist-polyfill .ws-po-box {
padding: 0.38462em 0; padding: 0.38462em 0;
@ -392,7 +393,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
} }
.datalist-polyfill .datalist-box li { .datalist-polyfill .datalist-box li {
margin: 0.07692em 0; margin: 0.07692em 0;
padding: 0.15385em 0.76923em; padding: 0.30769em 0.76923em;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
cursor: default; cursor: default;
@ -408,28 +409,22 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
font-style: normal; font-style: normal;
} }
.datalist-polyfill .datalist-box .option-value { .datalist-polyfill .datalist-box .option-value {
display: inline-block; display: block;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 100%; max-width: 100%;
color: #000; color: #000;
float: left;
transition: color 400ms; transition: color 400ms;
} }
.datalist-polyfill .datalist-box .option-label { .datalist-polyfill .datalist-box .option-label {
display: none; display: none;
max-width: 100%;
float: right;
font-size: 90%; font-size: 90%;
color: #666; color: #666;
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: bottom; margin-top: 0.1em;
margin-top: 0.15em;
margin-left: 0.76923em;
text-align: right;
transition: color 400ms; transition: color 400ms;
} }
.datalist-polyfill .datalist-box .has-option-label .option-label { .datalist-polyfill .datalist-box .has-option-label .option-label {
display: inline-block; display: block;
} }
.datalist-polyfill .datalist-box .hidden-item { .datalist-polyfill .datalist-box .hidden-item {
display: none !important; display: none !important;
@ -444,15 +439,6 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
.datalist-polyfill .datalist-box .active-item .option-label { .datalist-polyfill .datalist-box .active-item .option-label {
color: #eee; 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 { .validity-alert {
display: inline-block; display: inline-block;
@ -719,6 +705,9 @@ SASS:
.hide-spinbtns .input-buttons > .step-controls { .hide-spinbtns .input-buttons > .step-controls {
display: none; 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,
.hide-spinbtns ::-webkit-inner-spin-button { .hide-spinbtns ::-webkit-inner-spin-button {
display: none; display: none;
@ -733,6 +722,9 @@ SASS:
.hide-inputbtns .input-buttons { .hide-inputbtns .input-buttons {
display: none; 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,
.hide-inputbtns ::-webkit-inner-spin-button { .hide-inputbtns ::-webkit-inner-spin-button {
display: none; display: none;
@ -887,6 +879,10 @@ span.has-input-buttons {
cursor: not-allowed; cursor: not-allowed;
} }
.ws-number[readonly][aria-readonly="false"] {
cursor: default;
}
.input-buttons, .input-buttons,
.step-controls, .step-controls,
.ws-popover-opener { .ws-popover-opener {
@ -994,12 +990,10 @@ input[type="color"] {
margin-right: -39px; margin-right: -39px;
} }
.input-button-size-2 .step-controls { .input-button-size-2 .step-controls {
visibility: hidden;
opacity: 0; 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 { :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; opacity: 1;
visibility: visible;
} }
.step-controls { .step-controls {

View File

@ -366,6 +366,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
.datalist-polyfill { .datalist-polyfill {
position: absolute; position: absolute;
text-align: left;
} }
.datalist-polyfill .ws-po-box { .datalist-polyfill .ws-po-box {
padding: 0.38462em 0; padding: 0.38462em 0;
@ -392,7 +393,7 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
} }
.datalist-polyfill .datalist-box li { .datalist-polyfill .datalist-box li {
margin: 0.07692em 0; margin: 0.07692em 0;
padding: 0.15385em 0.76923em; padding: 0.30769em 0.76923em;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
cursor: default; cursor: default;
@ -408,28 +409,22 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
font-style: normal; font-style: normal;
} }
.datalist-polyfill .datalist-box .option-value { .datalist-polyfill .datalist-box .option-value {
display: inline-block; display: block;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 100%; max-width: 100%;
color: #000; color: #000;
float: left;
transition: color 400ms; transition: color 400ms;
} }
.datalist-polyfill .datalist-box .option-label { .datalist-polyfill .datalist-box .option-label {
display: none; display: none;
max-width: 100%;
float: right;
font-size: 90%; font-size: 90%;
color: #666; color: #666;
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: bottom; margin-top: 0.1em;
margin-top: 0.15em;
margin-left: 0.76923em;
text-align: right;
transition: color 400ms; transition: color 400ms;
} }
.datalist-polyfill .datalist-box .has-option-label .option-label { .datalist-polyfill .datalist-box .has-option-label .option-label {
display: inline-block; display: block;
} }
.datalist-polyfill .datalist-box .hidden-item { .datalist-polyfill .datalist-box .hidden-item {
display: none !important; display: none !important;
@ -444,15 +439,6 @@ input[data-wslist]::-webkit-calendar-picker-indicator {
.datalist-polyfill .datalist-box .active-item .option-label { .datalist-polyfill .datalist-box .active-item .option-label {
color: #eee; 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 { .validity-alert {
display: inline-block; display: inline-block;

View File

@ -334,13 +334,13 @@ webshims.register('track-ui', function($, webshims, window, document, undefined)
addTrackView(); addTrackView();
} else { } else {
if(elem.is('.nonnative-api-active')){ if(elem.hasClass('nonnative-api-active')){
addTrackView(); addTrackView();
} }
elem elem
.on('mediaelementapichange trackapichange', function(){ .on('mediaelementapichange trackapichange', function(){
if(!usesNativeTrack() || elem.is('.nonnative-api-active')){ if(!usesNativeTrack() || elem.hasClass('nonnative-api-active')){
addTrackView(); addTrackView();
} else { } else {
clearTimeout(updateTimer); clearTimeout(updateTimer);

View File

@ -12,6 +12,8 @@ class ModerationMailerPreview < ActionMailer::Preview
def update def update
ActionMailer::Base.default_url_options[:host] = 'localhost:3000' ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
event = Event.last event = Event.last
event.tags += ', ho'
event.start_time += 1.day
event.description = event.description + ' event.description = event.description + '
hello world' hello world'
ModerationMailer.update event, nil ModerationMailer.update event, nil