Make WordPress Core

Changeset 29193


Ignore:
Timestamp:
07/16/2014 07:31:30 PM (11 years ago)
Author:
wonderboymusic
Message:

Cleanup after [29179]:

Don't attach nodes to the view instance and check if the iframe still exists before resizing.

Props avryl.
See #28905.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r29191 r29193  
    163163
    164164                    resize = function() {
    165                         $( iframe ).height( $( iframeDoc.body ).height() );
     165                        // Make sure the iframe still exists.
     166                        iframe.contentWindow && $( iframe ).height( $( iframeDoc.body ).height() );
    166167                    };
    167168
     
    516517            },
    517518
    518             setNode: function ( event, editor, node ) {
    519                 if ( node ) {
    520                     this.node = node;
    521                 }
     519            setNode: function ( event, editor ) {
    522520                editor.on( 'hide', this.pausePlayers );
    523521
     
    577575
    578576            pausePlayers: function() {
    579                 var p, win = $( 'iframe', this.node ).get(0).contentWindow;
    580                 if ( win && win.mejs ) {
    581                     for ( p in win.mejs.players ) {
    582                         win.mejs.players[p].pause();
    583                     }
    584                 }
     577                this.getNodes( function( editor, node ) {
     578                    var p, win = $( 'iframe', node ).get(0).contentWindow;
     579
     580                    if ( win && win.mejs ) {
     581                        for ( p in win.mejs.players ) {
     582                            win.mejs.players[p].pause();
     583                        }
     584                    }
     585                });
    585586            },
    586587
    587588            unsetPlayers: function() {
    588                 var p, win = $( 'iframe', this.node ).get(0).contentWindow;
    589                 if ( win && win.mejs ) {
    590                     for ( p in win.mejs.players ) {
    591                         win.mejs.players[p].remove();
    592                     }
    593                 }
     589                this.getNodes( function( editor, node ) {
     590                    var p, win = $( 'iframe', node ).get(0).contentWindow;
     591
     592                    if ( win && win.mejs ) {
     593                        for ( p in win.mejs.players ) {
     594                            win.mejs.players[p].remove();
     595                        }
     596                    }
     597                });
    594598            },
    595599
Note: See TracChangeset for help on using the changeset viewer.