Make WordPress Core

Ticket #35657: 35657.3.diff

File 35657.3.diff, 1.2 KB (added by swissspidy, 10 years ago)
  • src/wp-includes/js/wp-embed-template.js

    diff --git src/wp-includes/js/wp-embed-template.js src/wp-includes/js/wp-embed-template.js
    index 2960991..16f6708 100644
     
    2626                        share_dialog_close = document.querySelector( '.wp-embed-share-dialog-close' ),
    2727                        share_input = document.querySelectorAll( '.wp-embed-share-input' ),
    2828                        share_dialog_tabs = document.querySelectorAll( '.wp-embed-share-tab-button button' ),
     29                        featured_image = document.querySelector( '.wp-embed-featured-image img' ),
    2930                        i;
    3031
    3132                if ( share_input ) {
     
    139140                sendEmbedMessage( 'height', Math.ceil( document.body.getBoundingClientRect().height ) );
    140141
    141142                // Send the document's height again after the featured image has been loaded.
    142                 document.querySelector( '.wp-embed-featured-image img' ).addEventListener( 'load', function() {
    143                         sendEmbedMessage( 'height', Math.ceil( document.body.getBoundingClientRect().height ) );
    144                 } );
     143                if ( featured_image ) {
     144                        featured_image.addEventListener( 'load', function() {
     145                                sendEmbedMessage( 'height', Math.ceil( document.body.getBoundingClientRect().height ) );
     146                        } );
     147                }
    145148
    146149                /**
    147150                 * Detect clicks to external (_top) links.