Make WordPress Core

Changeset 41781


Ignore:
Timestamp:
10/06/2017 04:31:01 PM (9 years ago)
Author:
joemcgill
Message:

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.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-audiovideo.js

    r41752 r41781  
    130130
    131131                if ( ! t.isDynamic ) {
    132                         t.$node.remove();
    133                 }
    134 
    135                 if ( 'native' !== t.media.pluginType ) {
    136                         t.$media.remove();
     132                        t.node.remove();
     133                }
     134
     135                if ( 'html5' !== t.media.rendererName ) {
     136                        t.media.remove();
    137137                }
    138138
     
    140140
    141141                t.container.remove();
    142                 t.globalUnbind();
    143                 delete t.node.player;
     142                t.globalUnbind('resize', t.globalResizeCallback);
     143                t.globalUnbind('keydown', t.globalKeydownCallback);
     144                t.globalUnbind('click', t.globalClickCallback);
     145                delete t.media.player;
    144146        },
    145147
  • trunk/src/wp-includes/js/media/audiovideo.manifest.js

    r41239 r41781  
    6161
    6262                if ( ! t.isDynamic ) {
    63                         t.$node.remove();
    64                 }
    65 
    66                 if ( 'native' !== t.media.pluginType ) {
    67                         t.$media.remove();
     63                        t.node.remove();
     64                }
     65
     66                if ( 'html5' !== t.media.rendererName ) {
     67                        t.media.remove();
    6868                }
    6969
     
    7171
    7272                t.container.remove();
    73                 t.globalUnbind();
    74                 delete t.node.player;
     73                t.globalUnbind('resize', t.globalResizeCallback);
     74                t.globalUnbind('keydown', t.globalKeydownCallback);
     75                t.globalUnbind('click', t.globalClickCallback);
     76                delete t.media.player;
    7577        },
    7678
Note: See TracChangeset for help on using the changeset viewer.