WordPress.org

Make WordPress Core

Changeset 36708


Ignore:
Timestamp:
02/25/2016 10:22:43 AM (4 years ago)
Author:
swissspidy
Message:

Embeds: Use a more accessible way to initially hide the iframe.

This fixes a bug in Firefox where assets inside the iframe aren't being displayed because they have no computed style.

See #35894.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed.php

    r36693 r36708  
    778778    if ( ! empty( $content[1] ) ) {
    779779        // We have a blockquote to fall back on. Hide the iframe by default.
    780         $html = str_replace( '<iframe', '<iframe style="display:none;"', $html );
     780        $html = str_replace( '<iframe', '<iframe style="position: absolute; clip: rect(1px, 1px, 1px, 1px);"', $html );
    781781        $html = str_replace( '<blockquote', '<blockquote class="wp-embedded-content"', $html );
    782782    }
     
    954954 */
    955955function _oembed_filter_feed_content( $content ) {
    956     return str_replace( '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;"', '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"', $content );
     956    return str_replace( '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);"', '<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"', $content );
    957957}
    958958
  • trunk/src/wp-includes/js/wp-embed.js

    r36648 r36708  
    5151            }
    5252
    53             source.style.display = '';
     53            source.removeAttribute( 'style' );
    5454
    5555            /* Resize the iframe on request. */
  • trunk/tests/phpunit/tests/oembed/filterResult.php

    r35577 r36708  
    8484        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
    8585
    86         $this->assertEquals( '<blockquote class="wp-embedded-content"></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;"></iframe>', $actual );
     86        $this->assertEquals( '<blockquote class="wp-embedded-content"></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);"></iframe>', $actual );
    8787    }
    8888
     
    9191        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
    9292
    93         $this->assertEquals( '<blockquote class="wp-embedded-content"><a href=""></a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;"></iframe>', $actual );
     93        $this->assertEquals( '<blockquote class="wp-embedded-content"><a href=""></a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);"></iframe>', $actual );
    9494    }
    9595
Note: See TracChangeset for help on using the changeset viewer.