vendor/assets/javascripts/webshims/shims/combos/34.js in webshims-rails-1.15.3 vs vendor/assets/javascripts/webshims/shims/combos/34.js in webshims-rails-1.15.4

- old
+ new

@@ -100,24 +100,29 @@ var singleVal = function(elem, name, val, pass, _argless){ return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val); }; //jquery mobile and jquery ui - if(!$.widget){ + if(!$.widget && (!$.pluginFactory || !$.pluginFactory.mixin)){ (function(){ var _cleanData = $.cleanData; - $.cleanData = function( elems ) { - if(!$.widget){ - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + $.cleanData = (function( orig ) { + return function( elems ) { + var events, elem, i; + for ( i = 0; (elem = elems[i]) != null; i++ ) { try { - $( elem ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } + // http://bugs.jquery.com/ticket/8235 + } catch ( e ) {} } - } - _cleanData( elems ); - }; + orig( elems ); + }; + })( $.cleanData ); })(); } $.fn.val = function(val){ @@ -534,11 +539,11 @@ elem.eq(0).prop('id', id); } return id; }; })(), - domPrefixes: ["ws", "webkit", "moz", "ms", "o"], + domPrefixes: ["webkit", "moz", "ms", "o", "ws"], prefixed: function (prop, obj){ var i, testProp; var ret = false; if(obj[prop]){ @@ -1341,14 +1346,15 @@ }; var copyProps = ['kind', 'label', 'srclang']; var copyName = {srclang: 'language'}; var updateMediaTrackList = function(baseData, trackList){ + var i, len; + var callChange = false; var removed = []; var added = []; var newTracks = []; - var i, len; if(!baseData){ baseData = webshims.data(this, 'mediaelementBase') || webshims.data(this, 'mediaelementBase', {}); } if(!trackList){ @@ -1379,16 +1385,17 @@ for(i = 0, len = trackList.length; i < len; i++){ if(newTracks.indexOf(trackList[i]) == -1){ removed.push(trackList[i]); } } - + if(removed.length || added.length){ trackList.splice(0); for(i = 0, len = newTracks.length; i < len; i++){ trackList.push(newTracks[i]); + } for(i = 0, len = removed.length; i < len; i++){ $([trackList]).triggerHandler($.Event({type: 'removetrack', track: removed[i]})); } for(i = 0, len = added.length; i < len; i++){ @@ -1396,9 +1403,19 @@ } //todo: remove if(baseData.scriptedTextTracks || removed.length){ $(this).triggerHandler('updatetrackdisplay'); } + } + + for(i = 0, len = trackList.length; i < len; i++){ + if(trackList[i].__wsmode != trackList[i].mode){ + trackList[i].__wsmode = trackList[i].mode; + callChange = true; + } + } + if(callChange){ + $([trackList]).triggerHandler('change'); } }; var refreshTrack = function(track, trackData){ if(!trackData){