From dc73f008ce14ac263f15c0a0bf12fe2815586609 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 13 Mar 2014 03:54:38 +0000 Subject: [PATCH] Add a class property to `wp.media.view.MediaDetails` called `instances` that is incremented every time the class is invoked. This mimics what happens in the shortcodes: the sources receive an incremented cache-buster so that the browser won't ignore the file when `preload="metadata"` is set. See #26779. git-svn-id: https://develop.svn.wordpress.org/trunk@27520 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-views.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 0d396cf14a..36a47727dc 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -6549,12 +6549,13 @@ * @returns {HTMLElement} */ prepareSrc : function (media) { - var t = (new Date()).getTime(); + var i = wp.media.view.MediaDetails.instances++; _.each( $(media).find('source'), function (source) { source.src = [ source.src, source.src.indexOf('?') > -1 ? '&' : '?', - t + '_=', + i ].join(''); }); @@ -6673,6 +6674,8 @@ resetFocus: function() { this.$( '.embed-media-settings' ).scrollTop( 0 ); } + }, { + instances : 0 }); /**