vendor/assets/javascripts/webshims/shims/combos/23.js in webshims-rails-0.4.6 vs vendor/assets/javascripts/webshims/shims/combos/23.js in webshims-rails-0.4.7

- old
+ new

@@ -349,11 +349,11 @@ webshims.defineNodeNamesBooleanProperty(['input', 'textarea', 'select'], 'required', { set: function(value){ $(this).getShadowFocusElement().attr('aria-required', !!(value)+''); }, - initAttr: (!$.browser.msie || webshims.browserVersion > 7)//only if we have aria-support + initAttr: (Modernizr.localstorage)//only if we have aria-support }); webshims.reflectProperties(['input'], ['pattern']); @@ -664,18 +664,17 @@ return $.attr(this, 'novalidate') != null; } } }); -if($.browser.webkit && Modernizr.inputtypes.date){ +if(Modernizr.inputtypes.date && /webkit/i.test(navigator.userAgent)){ (function(){ var noInputTriggerEvts = {updateInput: 1, input: 1}, fixInputTypes = { date: 1, - time: 1, - "datetime-local": 1 + time: 1 }, noFocusEvents = { focusout: 1, blur: 1 }, @@ -1095,12 +1094,11 @@ })(); } (function(){ Modernizr.textareaPlaceholder = !!('placeholder' in $('<textarea />')[0]); - var bustedTextarea = $.browser.webkit && Modernizr.textareaPlaceholder && webshims.browserVersion < 535; - if(Modernizr.input.placeholder && Modernizr.textareaPlaceholder && !bustedTextarea){return;} + if(Modernizr.input.placeholder && Modernizr.textareaPlaceholder){return;} var isOver = (webshims.cfg.forms.placeholderType == 'over'); var isResponsive = (webshims.cfg.forms.responsivePlaceholder); var polyfillElements = ['textarea']; if(!Modernizr.input.placeholder){ @@ -1298,12 +1296,12 @@ $.each(['Left', 'Top'], function(i, side){ var size = (parseInt($.css(elem, 'padding'+ side), 10) || 0) + Math.max((parseInt($.css(elem, 'margin'+ side), 10) || 0), 0) + (parseInt($.css(elem, 'border'+ side +'Width'), 10) || 0); data.text.css('padding'+ side, size); }); - $(elem) - .on('updateshadowdom', function(){ + $(document) + .onTrigger('updateshadowdom', function(){ var height, width; if((width = elem.offsetWidth) || (height = elem.offsetHeight)){ data.text .css({ width: width, @@ -1311,11 +1309,10 @@ }) .css($(elem).position()) ; } }) - .triggerHandler('updateshadowdom') ; } else { var reset = function(e){ if($(elem).hasClass('placeholder-visible')){ @@ -1367,21 +1364,15 @@ polyfillElements.forEach(function(nodeName){ var desc = webshims.defineNodeNameProperty(nodeName, 'placeholder', { attr: { set: function(val){ var elem = this; - if(bustedTextarea){ - webshims.data(elem, 'textareaPlaceholder', val); - elem.placeholder = ''; - } else { - webshims.contentAttr(elem, 'placeholder', val); - } + webshims.contentAttr(elem, 'placeholder', val); pHolder.update(elem, val); }, get: function(){ - var ret = (bustedTextarea) ? webshims.data(this, 'textareaPlaceholder') : ''; - return ret || webshims.contentAttr(this, 'placeholder'); + return webshims.contentAttr(this, 'placeholder'); } }, reflect: true, initAttr: true }); @@ -1393,17 +1384,13 @@ var desc; ['attr', 'prop'].forEach(function(propType){ placeholderValueDesc[propType] = { set: function(val){ var elem = this; - var placeholder; - if(bustedTextarea){ - placeholder = webshims.data(elem, 'textareaPlaceholder'); - } - if(!placeholder){ - placeholder = webshims.contentAttr(elem, 'placeholder'); - } + var placeholder = webshims.contentAttr(elem, 'placeholder'); + + $.removeData(elem, 'cachedValidity'); var ret = desc[propType]._supset.call(elem, val); if(placeholder && 'value' in elem){ changePlaceholderVisibility(elem, val, placeholder); } @@ -1794,11 +1781,13 @@ webshims.ready('WINDOWLOAD '+swfType, function(){ setTimeout(function(){ if(hasSwf && !options.preferFlash && webshims.mediaelement.createSWF && !$(e.target).closest('audio, video').is('.nonnative-api-active')){ options.preferFlash = true; document.removeEventListener('error', switchOptions, true); - $('audio, video').mediaLoad(); + $('audio, video').each(function(){ + webshims.mediaelement.selectSource(this); + }); webshims.info("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src); } else if(!hasSwf){ document.removeEventListener('error', switchOptions, true); } }, 20); @@ -2198,12 +2187,12 @@ if(!_srces.length || !parent || parent.nodeType != 1 || stopParent.test(parent.nodeName || '')){return;} data = data || webshims.data(elem, 'mediaelement'); stepSources(elem, data, options.preferFlash || undefined, _srces); }; + mediaelement.selectSource = selectSource; - $(document).on('ended', function(e){ var data = webshims.data(e.target, 'mediaelement'); if( supportsLoop && (!data || data.isActive == 'html5') && !$.prop(e.target, 'loop')){return;} setTimeout(function(){ if( $.prop(e.target, 'paused') || !$.prop(e.target, 'loop') ){return;} @@ -2264,55 +2253,60 @@ webshims.addReady(function(context, insertedElement){ var media = $('video, audio', context) .add(insertedElement.filter('video, audio')) .each(function(){ - if($.browser.msie && webshims.browserVersion > 8 && $.prop(this, 'paused') && !$.prop(this, 'readyState') && $(this).is('audio[preload="none"][controls]:not([autoplay])')){ + var data = webshims.data(this, 'mediaelement'); + + if(hasNative && $.prop(this, 'paused') && !$.prop(this, 'readyState') && $(this).is('audio[preload="none"][controls]:not([autoplay])') && (!data || data.isActive == 'html5')){ + //IE controls not visible bug $(this).prop('preload', 'metadata').mediaLoad(); } else { - selectSource(this); + selectSource(this, data); } - - if(hasNative){ - var bufferTimer; - var lastBuffered; - var elem = this; - var getBufferedString = function(){ - var buffered = $.prop(elem, 'buffered'); - if(!buffered){return;} - var bufferString = ""; - for(var i = 0, len = buffered.length; i < len;i++){ - bufferString += buffered.end(i); - } - return bufferString; - }; - var testBuffer = function(){ - var buffered = getBufferedString(); - if(buffered != lastBuffered){ - lastBuffered = buffered; - $(elem).triggerHandler('progress'); - } - }; - $(this) - .on({ - 'play loadstart progress': function(e){ - if(e.type == 'progress'){ - lastBuffered = getBufferedString(); - } - clearTimeout(bufferTimer); - bufferTimer = setTimeout(testBuffer, 999); - }, - 'emptied stalled mediaerror abort suspend': function(e){ - if(e.type == 'emptied'){ - lastBuffered = false; - } - clearTimeout(bufferTimer); + //FF progress bug + (function(){ + var bufferTimer; + var lastBuffered; + var elem = this; + var getBufferedString = function(){ + var buffered = $.prop(elem, 'buffered'); + if(!buffered){return;} + var bufferString = ""; + for(var i = 0, len = buffered.length; i < len;i++){ + bufferString += buffered.end(i); } - }) - ; + return bufferString; + }; + var testBuffer = function(){ + var buffered = getBufferedString(); + if(buffered != lastBuffered){ + lastBuffered = buffered; + $(elem).triggerHandler('progress'); + } + }; + + $(this) + .on({ + 'play loadstart progress': function(e){ + if(e.type == 'progress'){ + lastBuffered = getBufferedString(); + } + clearTimeout(bufferTimer); + bufferTimer = setTimeout(testBuffer, 999); + }, + 'emptied stalled mediaerror abort suspend': function(e){ + if(e.type == 'emptied'){ + lastBuffered = false; + } + clearTimeout(bufferTimer); + } + }) + ; + })(); } }) ; if(!loadTrackUi.loaded && $('track', media).length){ \ No newline at end of file