Media: Fix MEJS error when removing a media player.

This fixes a bug introduced by the upgrade to MediaElement.js, where code 
calling `wp.media.mixin.removePlayer()` would result in a JS error.

Props rafa8626, afercia.
Fixes #41787.

Built from https://develop.svn.wordpress.org/trunk@41781


git-svn-id: http://core.svn.wordpress.org/trunk@41615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2017-10-06 16:31:54 +00:00
parent 0b39f4c99d
commit 53a58e35b7
3 changed files with 9 additions and 7 deletions

View File

@ -129,18 +129,20 @@ wp.media.mixin = {
} }
if ( ! t.isDynamic ) { if ( ! t.isDynamic ) {
t.$node.remove(); t.node.remove();
} }
if ( 'native' !== t.media.pluginType ) { if ( 'html5' !== t.media.rendererName ) {
t.$media.remove(); t.media.remove();
} }
delete window.mejs.players[t.id]; delete window.mejs.players[t.id];
t.container.remove(); t.container.remove();
t.globalUnbind(); t.globalUnbind('resize', t.globalResizeCallback);
delete t.node.player; t.globalUnbind('keydown', t.globalKeydownCallback);
t.globalUnbind('click', t.globalClickCallback);
delete t.media.player;
}, },
/** /**

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta1-41780'; $wp_version = '4.9-beta1-41781';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.