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)
rack (>= 1.0)
webrick (1.3.1)
webshims-rails (1.14.4)
webshims-rails (1.14.5)
rails (> 3.1.0)
PLATFORMS

View File

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

View File

@ -250,6 +250,9 @@ webshims.isReady('swfmini', true);
};
var lazyLoad = function(){
var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){
options.customMessages = true;
toLoad.push('form-message');
@ -264,7 +267,6 @@ webshims.isReady('swfmini', true);
toLoad.push('form-validators');
}
webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
};
/*
* Selectors for all browsers
@ -321,11 +323,11 @@ webshims.isReady('swfmini', true);
};
$.extend(exp, {
"enabled": function( elem ) {
return elem.disabled === false && !$(elem).is('fieldset[disabled] *');
return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *');
},
"disabled": function( elem ) {
return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *'));
return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *'));
}
});
}
@ -504,8 +506,7 @@ webshims.isReady('swfmini', true);
};
$(document).on('focusin.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
if('form' in e.target){
lazyLoad();
}
@ -536,6 +537,14 @@ webshims.isReady('swfmini', true);
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
});
;(function(webshims){
"use strict";
@ -1070,6 +1079,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
webshims.ready(swfType, initMediaElements);
}
webshims.ready('track', loadTrackUi);
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
});
})(webshims);

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id);
return false;
}
data[type] = true;
return true;
return !$(elem).hasClass('ws-nopolyfill');
},
extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){
@ -2015,9 +2016,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -3675,7 +3678,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -3705,28 +3708,28 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3737,12 +3740,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

@ -803,9 +803,11 @@
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -2463,7 +2465,7 @@
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -2493,28 +2495,28 @@
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -2525,12 +2527,13 @@
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,6 @@ webshims.register('form-number-date-api', function($, webshims, window, document
}
var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes,
isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1));
@ -1420,9 +1419,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -3080,7 +3081,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -3110,28 +3111,28 @@ webshims.register('form-number-date-api', function($, webshims, window, document
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3142,12 +3143,13 @@ webshims.register('form-number-date-api', function($, webshims, window, document
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -392,7 +392,7 @@ var rsubmittable = /^(?:select|textarea|input)/i;
;
return function(){
var elem = $(this).getNativeElement()[0];
return !!(!elem.readOnly && !types[elem.type] && !$(elem).is(':disabled') );
return !!(!elem.readOnly && !types[elem.type] && !$.find.matchesSelector(elem, ':disabled') );
};
})()
},
@ -1149,7 +1149,6 @@ webshims.defineNodeNamesProperties(['input', 'button'], formSubmitterDescriptors
}
var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes,
isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
}
var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes,
isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1));
@ -1631,9 +1630,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -3291,7 +3292,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -3321,28 +3322,28 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3353,12 +3354,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

@ -241,7 +241,6 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
}
var nan = parseInt('NaN', 10),
doc = document,
typeModels = webshims.inputTypes,
isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1));
@ -1631,9 +1630,11 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -3291,7 +3292,7 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -3321,28 +3322,28 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3353,12 +3354,13 @@ webshims.register('form-native-extend', function($, webshims, window, doc, undef
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

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

View File

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

View File

@ -549,8 +549,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
webshims.warn(type +' already implemented for element #'+elem.id);
return false;
}
data[type] = true;
return true;
return !$(elem).hasClass('ws-nopolyfill');
},
extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){
@ -2015,9 +2016,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
$(element).attr({'aria-labelledby': labels.map(getId).get().join(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -3675,7 +3678,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -3705,28 +3708,28 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -3737,12 +3740,13 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media;
jmeData.player = base;
media
.on('ended emptied play', (function(){
var timer;
var releaseEmptied = function(){
stopEmptiedEvent = false;
};
var ended = function(){
removeCanPlay();
media.jmeFn('pause');
if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
stopEmptiedEvent = true;
media.jmeFn('load');
base.attr('data-state', 'ended');
setTimeout(releaseEmptied);
}
};
return function(e){
clearTimeout(timer);
if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
timer = setTimeout(ended);
}
};
})())
.on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume');

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media;
jmeData.player = base;
media
.on('ended emptied play', (function(){
var timer;
var releaseEmptied = function(){
stopEmptiedEvent = false;
};
var ended = function(){
removeCanPlay();
media.jmeFn('pause');
if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
stopEmptiedEvent = true;
media.jmeFn('load');
base.attr('data-state', 'ended');
setTimeout(releaseEmptied);
}
};
return function(e){
clearTimeout(timer);
if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
timer = setTimeout(ended);
}
};
})())
.on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume');
@ -598,17 +574,33 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
var regYt = /youtube\.com\/[watch\?|v\/]+/i;
var isInitial = data.media.prop('paused');
var isEnded = data.media.prop('ended');
if(isInitial){
data.player.addClass('initial-state');
}
if(isEnded){
data.player.addClass('ended-state');
}
if(!('backgroundSize' in $poster[0].style)){
data.player.addClass('no-backgroundsize');
}
data.media.on('playing waiting seeked seeking', function(){
data.media.on('play playing waiting seeked seeking', function(e){
if(isInitial){
isInitial = false;
data.player.removeClass('initial-state');
}
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
});
data.media.on('ended', function(){
if(!isEnded && !data.media.prop('loop') && data.media.prop('ended')){
isEnded = true;
data.player.addClass('ended-state');
}
});
return function(){
var poster = data.media.attr('poster');
@ -640,6 +632,11 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
isInitial = true;
}
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
if(lastYoutubeState !== hasYt){
lastYoutubeState = hasYt;
data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter');

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media;
jmeData.player = base;
media
.on('ended emptied play', (function(){
var timer;
var releaseEmptied = function(){
stopEmptiedEvent = false;
};
var ended = function(){
removeCanPlay();
media.jmeFn('pause');
if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
stopEmptiedEvent = true;
media.jmeFn('load');
base.attr('data-state', 'ended');
setTimeout(releaseEmptied);
}
};
return function(e){
clearTimeout(timer);
if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
timer = setTimeout(ended);
}
};
})())
.on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume');
@ -598,17 +574,33 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
var regYt = /youtube\.com\/[watch\?|v\/]+/i;
var isInitial = data.media.prop('paused');
var isEnded = data.media.prop('ended');
if(isInitial){
data.player.addClass('initial-state');
}
if(isEnded){
data.player.addClass('ended-state');
}
if(!('backgroundSize' in $poster[0].style)){
data.player.addClass('no-backgroundsize');
}
data.media.on('playing waiting seeked seeking', function(){
data.media.on('play playing waiting seeked seeking', function(e){
if(isInitial){
isInitial = false;
data.player.removeClass('initial-state');
}
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
});
data.media.on('ended', function(){
if(!isEnded && !data.media.prop('loop') && data.media.prop('ended')){
isEnded = true;
data.player.addClass('ended-state');
}
});
return function(){
var poster = data.media.attr('poster');
@ -640,6 +632,11 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
isInitial = true;
}
if(isEnded){
isEnded = false;
data.player.removeClass('ended-state');
}
if(lastYoutubeState !== hasYt){
lastYoutubeState = hasYt;
data.player[hasYt ? 'addClass' : 'removeClass']('has-ytposter');

View File

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

View File

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

View File

@ -27,6 +27,9 @@ webshims.register('form-core', function($, webshims, window, document, undefined
};
var lazyLoad = function(){
var toLoad = ['form-validation'];
$(document).off('.lazyloadvalidation');
if(options.lazyCustomMessages){
options.customMessages = true;
toLoad.push('form-message');
@ -41,7 +44,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
toLoad.push('form-validators');
}
webshims.reTest(toLoad);
$(document).off('.lazyloadvalidation');
};
/*
* Selectors for all browsers
@ -98,11 +100,11 @@ webshims.register('form-core', function($, webshims, window, document, undefined
};
$.extend(exp, {
"enabled": function( elem ) {
return elem.disabled === false && !$(elem).is('fieldset[disabled] *');
return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *');
},
"disabled": function( elem ) {
return elem.disabled === true || ('disabled' in elem && $(elem).is('fieldset[disabled] *'));
return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *'));
}
});
}
@ -281,8 +283,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
};
$(document).on('focusin.lazyloadvalidation', function(e){
$(document).on('focusin.lazyloadvalidation mousedown.lazyloadvalidation touchstart.lazyloadvalidation', function(e){
if('form' in e.target){
lazyLoad();
}
@ -313,4 +314,12 @@ webshims.register('form-core', function($, webshims, window, document, undefined
});
}
});
if(options.addValidators && options.fastValidators){
webshims.reTest(['form-validators', 'form-validation']);
}
if(document.readyState == 'complete'){
webshims.isReady('WINDOWLOAD', true);
}
});

View File

@ -268,13 +268,17 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
this.popover.contentElement.html('<div class="datalist-box"><ul role="listbox">'+ list.join("\n") +'</ul></div>');
$(this.input).removeAttr('aria-activedescendant').triggerHandler('datalistcreated', [{instance: this}]);
if(_forceShow || this.popover.isVisible){
if(this.options.valueCompletion && this.lastCompletedValue && !$.prop(this.input, 'value').indexOf(this.lastCompletedValue)){
if(this.options.valueCompletion && this.lastCompletedValue && (value = $.prop(this.input, 'value')) && !value.indexOf(this.lastCompletedValue)){
$.prop(this.input, 'value', this.lastCompletedValue);
$(this.input).triggerHandler('updateInput');
}
this.lastCompletedValue = "";
if(value != this.lastCompletedValue){
this.lastCompletedValue = "";
}
this.showHideOptions();
} else {
this.lastCompletedValue = "";
@ -545,7 +549,7 @@ webshims.register('form-datalist-lazy', function($, webshims, window, document,
}
items.removeClass('active-item');
this.shadowList.addClass('list-item-active');
activeItem = items.filter(':eq('+ index +')').addClass('active-item');
activeItem = items.eq(index).addClass('active-item');
if(doValue){
if(doValue != 'onlyScroll'){

View File

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

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(' ')});
if(!noFocus){
labels.on('click', function(e){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
if(!e.isDefaultPrevented()){
element.getShadowFocusElement().focus();
e.preventDefault();
return false;
}
});
}
};
@ -1843,7 +1845,7 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
});
});
}
if(opts.calculateWidth){
sizeInput(data.shim);
} else {
@ -1873,28 +1875,28 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
}
var replace = {};
if(options.replaceUI){
if( $.isPlainObject(options.replaceUI) ){
$.extend(replace, options.replaceUI);
} else {
$.extend(replace, {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
});
}
$.each($.extend(replace, $.isPlainObject(options.replaceUI) ? options.replaceUI : {
'range': 1,
'number': 1,
'time': 1,
'month': 1,
'date': 1,
'color': 1,
'datetime-local': 1
}), function(name, val){
if(supportInputTypes[name] && val == 'auto'){
replace[name] = webshims._getAutoEnhance(val);
}
});
}
if(supportInputTypes.number && navigator.userAgent.indexOf('Touch') == -1 && ((/MSIE 1[0|1]\.\d/.test(navigator.userAgent)) || (/Trident\/7\.0/.test(navigator.userAgent)))){
replace.number = 1;
}
if(!supportInputTypes.range || replace.range){
if(replace.range !== false && (!supportInputTypes.range || replace.range)){
extendType('range', {
_create: function(opts, set){
var data = $('<span />').insertAfter(opts.orig).rangeUI(opts).data('rangeUi');
@ -1905,12 +1907,13 @@ webshims.register('form-number-date-ui', function($, webshims, window, document,
['number', 'time', 'month', 'date', 'color', 'datetime-local'].forEach(function(name){
if(!supportInputTypes[name] || replace[name]){
if(replace[name] !== false && (!supportInputTypes[name] || replace[name])){
extendType(name, {
_create: function(opts, set){
if(opts.monthSelect || opts.daySelect || opts.yearSelect){
opts.splitInput = true;
}
if(opts.splitInput && !splitInputs[name]){
webshims.warn('splitInput not supported for '+ name);
opts.splitInput = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -276,30 +276,6 @@ webshims.register('jmebase', function($, webshims, window, doc, undefined){
jmeData.media = media;
jmeData.player = base;
media
.on('ended emptied play', (function(){
var timer;
var releaseEmptied = function(){
stopEmptiedEvent = false;
};
var ended = function(){
removeCanPlay();
media.jmeFn('pause');
if(!options.noReload && media.prop('ended') && media.prop('paused') && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
stopEmptiedEvent = true;
media.jmeFn('load');
base.attr('data-state', 'ended');
setTimeout(releaseEmptied);
}
};
return function(e){
clearTimeout(timer);
if(e.type == 'ended' && !options.noReload && !media.prop('autoplay') && !media.prop('loop') && !media.hasClass('no-reload')){
timer = setTimeout(ended);
}
};
})())
.on('emptied waiting canplay canplaythrough playing ended pause mediaerror', mediaUpdateFn)
.on('volumechange updateJMEState', function(){
var volume = $.prop(this, 'volume');

View File

@ -1,5 +1,5 @@
/* thx to http://icomoon.io */
.mediaplayer[data-state="waiting"] > .jme-media-overlay, .mediaplayer .fullscreen, .mediaplayer .fullscreen.state-exitfullscreen, .mediaplayer .mediaconfigmenu, .mediaplayer[data-state="idle"] > .jme-media-overlay, .mediaplayer button.play-pause, .mediaplayer button.play-pause.state-playing, .mediaplayer .mute-unmute, .mediaplayer[data-volume="medium"] .mute-unmute, .mediaplayer[data-volume="low"] .mute-unmute, .mediaplayer[data-volume="no"] .mute-unmute, .mediaplayer .state-unmute.mute-unmute, .mediaplayer .captions, .mediaplayer .subtitle-menu button[aria-checked="true"], .mediaplayer .subtitle-menu button, .mediaplayer .playlist-next, .mediaplayer .playlist-prev, .mediaplayer .chapters, .mediaplayer[data-state="ended"] > .jme-media-overlay {
.mediaplayer[data-state="waiting"] > .jme-media-overlay, .mediaplayer .fullscreen, .mediaplayer .fullscreen.state-exitfullscreen, .mediaplayer .mediaconfigmenu, .mediaplayer.initial-state > .jme-media-overlay, .mediaplayer button.play-pause, .mediaplayer button.play-pause.state-playing, .mediaplayer .mute-unmute, .mediaplayer[data-volume="medium"] .mute-unmute, .mediaplayer[data-volume="low"] .mute-unmute, .mediaplayer[data-volume="no"] .mute-unmute, .mediaplayer .state-unmute.mute-unmute, .mediaplayer .captions, .mediaplayer .subtitle-menu button[aria-checked="true"], .mediaplayer .subtitle-menu button, .mediaplayer .playlist-next, .mediaplayer .playlist-prev, .mediaplayer .chapters, .mediaplayer.ended-state > .jme-media-overlay {
font-family: 'jme';
speak: none;
font-style: normal;
@ -29,7 +29,7 @@
content: "\e606";
}
.mediaplayer[data-state="idle"] > .jme-media-overlay:before {
.mediaplayer.initial-state > .jme-media-overlay:before {
content: "\e608";
}
@ -85,7 +85,7 @@
content: "\e615";
}
.mediaplayer[data-state="ended"] > .jme-media-overlay:before {
.mediaplayer.ended-state > .jme-media-overlay:before {
content: "\e601";
}
@ -99,6 +99,15 @@
font-weight: normal;
font-style: normal;
}
@-webkit-keyframes jmespin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes jmespin {
0% {
-webkit-transform: rotate(0deg);
@ -264,17 +273,17 @@
.mediaplayer[data-state="idle"] {
cursor: pointer;
}
.mediaplayer[data-state="idle"] > .jme-media-overlay {
.mediaplayer.initial-state > .jme-media-overlay {
background-position: 1px 1px;
}
.mediaplayer[data-state="idle"].has-ytposter.no-backgroundsize > .jme-media-overlay:before {
.mediaplayer.initial-state.has-ytposter.no-backgroundsize > .jme-media-overlay:before {
content: "";
background-position: 2px 2px;
}
.mediaplayer[data-state="ended"] {
.mediaplayer.ended-state {
cursor: pointer;
}
.mediaplayer[data-state="ended"] > .jme-media-overlay {
.mediaplayer.ended-state > .jme-media-overlay {
background-position: 3px 3px;
}
.mediaplayer[data-state="waiting"] {
@ -284,6 +293,10 @@
background-position: 4px 4px;
}
.mediaplayer[data-state="waiting"] > .jme-media-overlay:before {
-webkit-animation-name: jmespin;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 1100ms;
-webkit-animation-timing-function: linear;
animation-name: jmespin;
animation-iteration-count: infinite;
animation-duration: 1100ms;
@ -308,9 +321,10 @@
left: 0;
right: 0;
bottom: 0;
background: #000 no-repeat center / contain;
background: #000 no-repeat center;
background-size: contain;
}
.mediaplayer.initial-state .ws-poster {
.mediaplayer.initial-state .ws-poster, .mediaplayer.ended-state .ws-poster {
display: block;
}
.mediaplayer.no-poster .ws-poster, .mediaplayer.no-backgroundsize div.ws-poster {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,497 +1,515 @@
/*!
* jQuery UI Position 1.10.3
* jQuery UI Position 1.11.0
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/position/
*/
(function( $, undefined ) {
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
$.ui = $.ui || {};
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else {
var cachedScrollbarWidth,
max = Math.max,
abs = Math.abs,
round = Math.round,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
rposition = /^\w+/,
rpercent = /%$/,
_position = $.fn.position;
function getOffsets( offsets, width, height ) {
return [
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
];
}
function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
function getDimensions( elem ) {
var raw = elem[0];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: 0, left: 0 }
};
// Browser globals
factory( window.webshims && window.webshims.$ || jQuery );
}
if ( $.isWindow( raw ) ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
};
}
if ( raw.preventDefault ) {
return {
width: 0,
height: 0,
offset: { top: raw.pageY, left: raw.pageX }
};
}
return {
width: elem.outerWidth(),
height: elem.outerHeight(),
offset: elem.offset()
};
}
}(function( $ ) {
(function() {
$.position = {
scrollbarWidth: function() {
if ( cachedScrollbarWidth !== undefined ) {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
innerDiv = div.children()[0];
$.ui = $.ui || {};
$( "body" ).append( div );
w1 = innerDiv.offsetWidth;
div.css( "overflow", "scroll" );
var cachedScrollbarWidth, supportsOffsetFractions,
max = Math.max,
abs = Math.abs,
round = Math.round,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
rposition = /^\w+/,
rpercent = /%$/,
_position = $.fn.position;
w2 = innerDiv.offsetWidth;
if ( w1 === w2 ) {
w2 = div[0].clientWidth;
function getOffsets( offsets, width, height ) {
return [
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
];
}
div.remove();
return (cachedScrollbarWidth = w1 - w2);
},
getScrollInfo: function( within ) {
var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" ||
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
hasOverflowY = overflowY === "scroll" ||
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
return {
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
height: hasOverflowX ? $.position.scrollbarWidth() : 0
};
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
isWindow = $.isWindow( withinElement[0] );
return {
element: withinElement,
isWindow: isWindow,
offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: isWindow ? withinElement.width() : withinElement.outerWidth(),
height: isWindow ? withinElement.height() : withinElement.outerHeight()
};
}
};
$.fn.position = function( options ) {
if ( !options || !options.of ) {
return _position.apply( this, arguments );
}
// make a copy, we don't want to modify arguments
options = $.extend( {}, options );
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
target = $( options.of ),
within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
collision = ( options.collision || "flip" ).split( " " ),
offsets = {};
dimensions = getDimensions( target );
if ( target[0].preventDefault ) {
// force left top to allow flipping
options.at = "left top";
}
targetWidth = dimensions.width;
targetHeight = dimensions.height;
targetOffset = dimensions.offset;
// clone to reuse original targetOffset later
basePosition = $.extend( {}, targetOffset );
// force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each( [ "my", "at" ], function() {
var pos = ( options[ this ] || "" ).split( " " ),
horizontalOffset,
verticalOffset;
if ( pos.length === 1) {
pos = rhorizontal.test( pos[ 0 ] ) ?
pos.concat( [ "center" ] ) :
rvertical.test( pos[ 0 ] ) ?
[ "center" ].concat( pos ) :
[ "center", "center" ];
}
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
// calculate offsets
horizontalOffset = roffset.exec( pos[ 0 ] );
verticalOffset = roffset.exec( pos[ 1 ] );
offsets[ this ] = [
horizontalOffset ? horizontalOffset[ 0 ] : 0,
verticalOffset ? verticalOffset[ 0 ] : 0
];
// reduce to just the positions without the offsets
options[ this ] = [
rposition.exec( pos[ 0 ] )[ 0 ],
rposition.exec( pos[ 1 ] )[ 0 ]
];
});
// normalize collision option
if ( collision.length === 1 ) {
collision[ 1 ] = collision[ 0 ];
}
if ( options.at[ 0 ] === "right" ) {
basePosition.left += targetWidth;
} else if ( options.at[ 0 ] === "center" ) {
basePosition.left += targetWidth / 2;
}
if ( options.at[ 1 ] === "bottom" ) {
basePosition.top += targetHeight;
} else if ( options.at[ 1 ] === "center" ) {
basePosition.top += targetHeight / 2;
}
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
basePosition.left += atOffset[ 0 ];
basePosition.top += atOffset[ 1 ];
return this.each(function() {
var collisionPosition, using,
elem = $( this ),
elemWidth = elem.outerWidth(),
elemHeight = elem.outerHeight(),
marginLeft = parseCss( this, "marginLeft" ),
marginTop = parseCss( this, "marginTop" ),
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
position = $.extend( {}, basePosition ),
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
if ( options.my[ 0 ] === "right" ) {
position.left -= elemWidth;
} else if ( options.my[ 0 ] === "center" ) {
position.left -= elemWidth / 2;
function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
if ( options.my[ 1 ] === "bottom" ) {
position.top -= elemHeight;
} else if ( options.my[ 1 ] === "center" ) {
position.top -= elemHeight / 2;
}
position.left += myOffset[ 0 ];
position.top += myOffset[ 1 ];
// if the browser doesn't support fractions, then round for consistent results
if ( !$.support.offsetFractions ) {
position.left = round( position.left );
position.top = round( position.top );
}
collisionPosition = {
marginLeft: marginLeft,
marginTop: marginTop
};
$.each( [ "left", "top" ], function( i, dir ) {
if ( $.ui.position[ collision[ i ] ] ) {
$.ui.position[ collision[ i ] ][ dir ]( position, {
targetWidth: targetWidth,
targetHeight: targetHeight,
elemWidth: elemWidth,
elemHeight: elemHeight,
collisionPosition: collisionPosition,
collisionWidth: collisionWidth,
collisionHeight: collisionHeight,
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
my: options.my,
at: options.at,
within: within,
elem : elem
});
function getDimensions( elem ) {
var raw = elem[0];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: 0, left: 0 }
};
}
});
if ( options.using ) {
// adds feedback as second argument to using callback, if present
using = function( props ) {
var left = targetOffset.left - position.left,
right = left + targetWidth - elemWidth,
top = targetOffset.top - position.top,
bottom = top + targetHeight - elemHeight,
feedback = {
target: {
element: target,
left: targetOffset.left,
top: targetOffset.top,
width: targetWidth,
height: targetHeight
},
element: {
element: elem,
left: position.left,
top: position.top,
width: elemWidth,
height: elemHeight
},
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
};
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
feedback.horizontal = "center";
}
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
feedback.vertical = "middle";
}
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
feedback.important = "horizontal";
} else {
feedback.important = "vertical";
}
options.using.call( this, props, feedback );
if ( $.isWindow( raw ) ) {
return {
width: elem.width(),
height: elem.height(),
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
};
}
if ( raw.preventDefault ) {
return {
width: 0,
height: 0,
offset: { top: raw.pageY, left: raw.pageX }
};
}
return {
width: elem.outerWidth(),
height: elem.outerHeight(),
offset: elem.offset()
};
}
elem.offset( $.extend( position, { using: using } ) );
});
};
$.position = {
scrollbarWidth: function() {
if ( cachedScrollbarWidth !== undefined ) {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
innerDiv = div.children()[0];
$.ui.position = {
fit: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
outerWidth = within.width,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = withinOffset - collisionPosLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
newOverRight;
$( "body" ).append( div );
w1 = innerDiv.offsetWidth;
div.css( "overflow", "scroll" );
// element is wider than within
if ( data.collisionWidth > outerWidth ) {
// element is initially over the left side of within
if ( overLeft > 0 && overRight <= 0 ) {
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
position.left += overLeft - newOverRight;
// element is initially over right side of within
} else if ( overRight > 0 && overLeft <= 0 ) {
position.left = withinOffset;
// element is initially over both left and right sides of within
} else {
if ( overLeft > overRight ) {
position.left = withinOffset + outerWidth - data.collisionWidth;
w2 = innerDiv.offsetWidth;
if ( w1 === w2 ) {
w2 = div[0].clientWidth;
}
div.remove();
return (cachedScrollbarWidth = w1 - w2);
},
getScrollInfo: function( within ) {
var overflowX = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-x" ),
overflowY = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" ||
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
hasOverflowY = overflowY === "scroll" ||
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
return {
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
height: hasOverflowX ? $.position.scrollbarWidth() : 0
};
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
isWindow = $.isWindow( withinElement[0] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
return {
element: withinElement,
isWindow: isWindow,
isDocument: isDocument,
offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: isWindow ? withinElement.width() : withinElement.outerWidth(),
height: isWindow ? withinElement.height() : withinElement.outerHeight()
};
}
};
$.fn.position = function( options ) {
if ( !options || !options.of ) {
return _position.apply( this, arguments );
}
// make a copy, we don't want to modify arguments
options = $.extend( {}, options );
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
target = $( options.of ),
within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
collision = ( options.collision || "flip" ).split( " " ),
offsets = {};
dimensions = getDimensions( target );
if ( target[0].preventDefault ) {
// force left top to allow flipping
options.at = "left top";
}
targetWidth = dimensions.width;
targetHeight = dimensions.height;
targetOffset = dimensions.offset;
// clone to reuse original targetOffset later
basePosition = $.extend( {}, targetOffset );
// force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each( [ "my", "at" ], function() {
var pos = ( options[ this ] || "" ).split( " " ),
horizontalOffset,
verticalOffset;
if ( pos.length === 1) {
pos = rhorizontal.test( pos[ 0 ] ) ?
pos.concat( [ "center" ] ) :
rvertical.test( pos[ 0 ] ) ?
[ "center" ].concat( pos ) :
[ "center", "center" ];
}
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
// calculate offsets
horizontalOffset = roffset.exec( pos[ 0 ] );
verticalOffset = roffset.exec( pos[ 1 ] );
offsets[ this ] = [
horizontalOffset ? horizontalOffset[ 0 ] : 0,
verticalOffset ? verticalOffset[ 0 ] : 0
];
// reduce to just the positions without the offsets
options[ this ] = [
rposition.exec( pos[ 0 ] )[ 0 ],
rposition.exec( pos[ 1 ] )[ 0 ]
];
});
// normalize collision option
if ( collision.length === 1 ) {
collision[ 1 ] = collision[ 0 ];
}
if ( options.at[ 0 ] === "right" ) {
basePosition.left += targetWidth;
} else if ( options.at[ 0 ] === "center" ) {
basePosition.left += targetWidth / 2;
}
if ( options.at[ 1 ] === "bottom" ) {
basePosition.top += targetHeight;
} else if ( options.at[ 1 ] === "center" ) {
basePosition.top += targetHeight / 2;
}
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
basePosition.left += atOffset[ 0 ];
basePosition.top += atOffset[ 1 ];
return this.each(function() {
var collisionPosition, using,
elem = $( this ),
elemWidth = elem.outerWidth(),
elemHeight = elem.outerHeight(),
marginLeft = parseCss( this, "marginLeft" ),
marginTop = parseCss( this, "marginTop" ),
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
position = $.extend( {}, basePosition ),
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
if ( options.my[ 0 ] === "right" ) {
position.left -= elemWidth;
} else if ( options.my[ 0 ] === "center" ) {
position.left -= elemWidth / 2;
}
if ( options.my[ 1 ] === "bottom" ) {
position.top -= elemHeight;
} else if ( options.my[ 1 ] === "center" ) {
position.top -= elemHeight / 2;
}
position.left += myOffset[ 0 ];
position.top += myOffset[ 1 ];
// if the browser doesn't support fractions, then round for consistent results
if ( !supportsOffsetFractions ) {
position.left = round( position.left );
position.top = round( position.top );
}
collisionPosition = {
marginLeft: marginLeft,
marginTop: marginTop
};
$.each( [ "left", "top" ], function( i, dir ) {
if ( $.ui.position[ collision[ i ] ] ) {
$.ui.position[ collision[ i ] ][ dir ]( position, {
targetWidth: targetWidth,
targetHeight: targetHeight,
elemWidth: elemWidth,
elemHeight: elemHeight,
collisionPosition: collisionPosition,
collisionWidth: collisionWidth,
collisionHeight: collisionHeight,
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
my: options.my,
at: options.at,
within: within,
elem: elem
});
}
});
if ( options.using ) {
// adds feedback as second argument to using callback, if present
using = function( props ) {
var left = targetOffset.left - position.left,
right = left + targetWidth - elemWidth,
top = targetOffset.top - position.top,
bottom = top + targetHeight - elemHeight,
feedback = {
target: {
element: target,
left: targetOffset.left,
top: targetOffset.top,
width: targetWidth,
height: targetHeight
},
element: {
element: elem,
left: position.left,
top: position.top,
width: elemWidth,
height: elemHeight
},
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
};
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
feedback.horizontal = "center";
}
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
feedback.vertical = "middle";
}
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
feedback.important = "horizontal";
} else {
feedback.important = "vertical";
}
options.using.call( this, props, feedback );
};
}
elem.offset( $.extend( position, { using: using } ) );
});
};
$.ui.position = {
fit: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
outerWidth = within.width,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = withinOffset - collisionPosLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
newOverRight;
// element is wider than within
if ( data.collisionWidth > outerWidth ) {
// element is initially over the left side of within
if ( overLeft > 0 && overRight <= 0 ) {
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
position.left += overLeft - newOverRight;
// element is initially over right side of within
} else if ( overRight > 0 && overLeft <= 0 ) {
position.left = withinOffset;
// element is initially over both left and right sides of within
} else {
if ( overLeft > overRight ) {
position.left = withinOffset + outerWidth - data.collisionWidth;
} else {
position.left = withinOffset;
}
}
// too far left -> align with left edge
} else if ( overLeft > 0 ) {
position.left += overLeft;
// too far right -> align with right edge
} else if ( overRight > 0 ) {
position.left -= overRight;
// adjust based on position and margin
} else {
position.left = withinOffset;
position.left = max( position.left - collisionPosLeft, position.left );
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
outerHeight = data.within.height,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = withinOffset - collisionPosTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
newOverBottom;
// element is taller than within
if ( data.collisionHeight > outerHeight ) {
// element is initially over the top of within
if ( overTop > 0 && overBottom <= 0 ) {
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
position.top += overTop - newOverBottom;
// element is initially over bottom of within
} else if ( overBottom > 0 && overTop <= 0 ) {
position.top = withinOffset;
// element is initially over both top and bottom of within
} else {
if ( overTop > overBottom ) {
position.top = withinOffset + outerHeight - data.collisionHeight;
} else {
position.top = withinOffset;
}
}
// too far up -> align with top
} else if ( overTop > 0 ) {
position.top += overTop;
// too far down -> align with bottom edge
} else if ( overBottom > 0 ) {
position.top -= overBottom;
// adjust based on position and margin
} else {
position.top = max( position.top - collisionPosTop, position.top );
}
}
// too far left -> align with left edge
} else if ( overLeft > 0 ) {
position.left += overLeft;
// too far right -> align with right edge
} else if ( overRight > 0 ) {
position.left -= overRight;
// adjust based on position and margin
} else {
position.left = max( position.left - collisionPosLeft, position.left );
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
outerHeight = data.within.height,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = withinOffset - collisionPosTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
newOverBottom;
},
flip: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = collisionPosLeft - offsetLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
myOffset = data.my[ 0 ] === "left" ?
-data.elemWidth :
data.my[ 0 ] === "right" ?
data.elemWidth :
0,
atOffset = data.at[ 0 ] === "left" ?
data.targetWidth :
data.at[ 0 ] === "right" ?
-data.targetWidth :
0,
offset = -2 * data.offset[ 0 ],
newOverRight,
newOverLeft;
// element is taller than within
if ( data.collisionHeight > outerHeight ) {
// element is initially over the top of within
if ( overTop > 0 && overBottom <= 0 ) {
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
position.top += overTop - newOverBottom;
// element is initially over bottom of within
} else if ( overBottom > 0 && overTop <= 0 ) {
position.top = withinOffset;
// element is initially over both top and bottom of within
} else {
if ( overTop > overBottom ) {
position.top = withinOffset + outerHeight - data.collisionHeight;
} else {
position.top = withinOffset;
if ( overLeft < 0 ) {
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset;
}
} else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset;
}
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.offset.top + within.scrollTop,
outerHeight = within.height,
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = collisionPosTop - offsetTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
top = data.my[ 1 ] === "top",
myOffset = top ?
-data.elemHeight :
data.my[ 1 ] === "bottom" ?
data.elemHeight :
0,
atOffset = data.at[ 1 ] === "top" ?
data.targetHeight :
data.at[ 1 ] === "bottom" ?
-data.targetHeight :
0,
offset = -2 * data.offset[ 1 ],
newOverTop,
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
position.top += myOffset + atOffset + offset;
}
} else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
position.top += myOffset + atOffset + offset;
}
}
}
// too far up -> align with top
} else if ( overTop > 0 ) {
position.top += overTop;
// too far down -> align with bottom edge
} else if ( overBottom > 0 ) {
position.top -= overBottom;
// adjust based on position and margin
} else {
position.top = max( position.top - collisionPosTop, position.top );
}
}
},
flip: {
left: function( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
overLeft = collisionPosLeft - offsetLeft,
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
myOffset = data.my[ 0 ] === "left" ?
-data.elemWidth :
data.my[ 0 ] === "right" ?
data.elemWidth :
0,
atOffset = data.at[ 0 ] === "left" ?
data.targetWidth :
data.at[ 0 ] === "right" ?
-data.targetWidth :
0,
offset = -2 * data.offset[ 0 ],
newOverRight,
newOverLeft;
if ( overLeft < 0 ) {
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset;
},
flipfit: {
left: function() {
$.ui.position.flip.left.apply( this, arguments );
$.ui.position.fit.left.apply( this, arguments );
},
top: function() {
$.ui.position.flip.top.apply( this, arguments );
$.ui.position.fit.top.apply( this, arguments );
}
}
else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset;
}
}
},
top: function( position, data ) {
var within = data.within,
withinOffset = within.offset.top + within.scrollTop,
outerHeight = within.height,
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
collisionPosTop = position.top - data.collisionPosition.marginTop,
overTop = collisionPosTop - offsetTop,
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
top = data.my[ 1 ] === "top",
myOffset = top ?
-data.elemHeight :
data.my[ 1 ] === "bottom" ?
data.elemHeight :
0,
atOffset = data.at[ 1 ] === "top" ?
data.targetHeight :
data.at[ 1 ] === "bottom" ?
-data.targetHeight :
0,
offset = -2 * data.offset[ 1 ],
newOverTop,
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
position.top += myOffset + atOffset + offset;
}
}
else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
position.top += myOffset + atOffset + offset;
}
}
}
},
flipfit: {
left: function() {
$.ui.position.flip.left.apply( this, arguments );
$.ui.position.fit.left.apply( this, arguments );
},
top: function() {
$.ui.position.flip.top.apply( this, arguments );
$.ui.position.fit.top.apply( this, arguments );
}
}
};
};
// fraction support test
(function () {
var testElement, testElementParent, testElementStyle, offsetLeft, i,
body = document.getElementsByTagName( "body" )[ 0 ],
div = document.createElement( "div" );
(function() {
var testElement, testElementParent, testElementStyle, offsetLeft, i,
body = document.getElementsByTagName( "body" )[ 0 ],
div = document.createElement( "div" );
//Create a "fake body" for testing based on method used in jQuery.support
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
$.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || document.documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
//Create a "fake body" for testing based on method used in jQuery.support
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
$.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || document.documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
div.style.cssText = "position: absolute; left: 10.7432222px;";
div.style.cssText = "position: absolute; left: 10.7432222px;";
offsetLeft = $( div ).offset().left;
$.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
offsetLeft = $( div ).offset().left;
supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
})();
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
})();
})();
return $.ui.position;
}));
}( window.webshims && window.webshims.$ || jQuery ) );

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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