diff --git a/src/wp-includes/js/media-audiovideo.js b/src/wp-includes/js/media-audiovideo.js index cb2abd57ae..e939d49454 100644 --- a/src/wp-includes/js/media-audiovideo.js +++ b/src/wp-includes/js/media-audiovideo.js @@ -129,18 +129,20 @@ wp.media.mixin = { } if ( ! t.isDynamic ) { - t.$node.remove(); + t.node.remove(); } - if ( 'native' !== t.media.pluginType ) { - t.$media.remove(); + if ( 'html5' !== t.media.rendererName ) { + t.media.remove(); } delete window.mejs.players[t.id]; t.container.remove(); - t.globalUnbind(); - delete t.node.player; + t.globalUnbind('resize', t.globalResizeCallback); + t.globalUnbind('keydown', t.globalKeydownCallback); + t.globalUnbind('click', t.globalClickCallback); + delete t.media.player; }, /** diff --git a/src/wp-includes/js/media/audiovideo.manifest.js b/src/wp-includes/js/media/audiovideo.manifest.js index 1b4bef7831..7981aa75ac 100644 --- a/src/wp-includes/js/media/audiovideo.manifest.js +++ b/src/wp-includes/js/media/audiovideo.manifest.js @@ -60,18 +60,20 @@ wp.media.mixin = { } if ( ! t.isDynamic ) { - t.$node.remove(); + t.node.remove(); } - if ( 'native' !== t.media.pluginType ) { - t.$media.remove(); + if ( 'html5' !== t.media.rendererName ) { + t.media.remove(); } delete window.mejs.players[t.id]; t.container.remove(); - t.globalUnbind(); - delete t.node.player; + t.globalUnbind('resize', t.globalResizeCallback); + t.globalUnbind('keydown', t.globalKeydownCallback); + t.globalUnbind('click', t.globalClickCallback); + delete t.media.player; }, /**