Make WordPress Core

Changeset 60285


Ignore:
Timestamp:
06/05/2025 02:00:28 PM (5 weeks ago)
Author:
desrosj
Message:

Media: Remove inline scripts targeting IE < 9.

In #24902, an inline script was introduced to wp_playlist_scripts(), wp_audio_shortcode(), and wp_video_shortcode() for HTML5 compatibility in browsers running IE 8 and earlier.

These browsers have long been unsupported by WordPress, and unsupported by Microsoft for 9 years or more. So this compatibility code is no longer necessary and can safely be removed.

Hit the road, Jack, and don't ya come back no more, no more, no more, no more!

Props aslamdoctor, mindctrl, nigelnelles, joedolson.
Fixes #63471.

Location:
trunk
Files:
2 edited

Legend:

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

    r59987 r60285  
    29932993    wp_enqueue_style( 'wp-mediaelement' );
    29942994    wp_enqueue_script( 'wp-playlist' );
    2995     ?>
    2996 <!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ); ?>');</script><![endif]-->
    2997     <?php
    29982995    add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
    29992996    add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
     
    35033500    }
    35043501
    3505     $html = '';
    3506 
    3507     if ( 'mediaelement' === $library && 1 === $instance ) {
    3508         $html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
    3509     }
    3510 
    3511     $html .= sprintf( '<audio %s controls="controls">', implode( ' ', $attr_strings ) );
    3512 
     3502    $html    = sprintf( '<audio %s controls="controls">', implode( ' ', $attr_strings ) );
    35133503    $fileurl = '';
    35143504    $source  = '<source type="%s" src="%s" />';
     
    37883778    }
    37893779
    3790     $html = '';
    3791 
    3792     if ( 'mediaelement' === $library && 1 === $instance ) {
    3793         $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
    3794     }
    3795 
    3796     $html .= sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
    3797 
     3780    $html    = sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
    37983781    $fileurl = '';
    37993782    $source  = '<source type="%s" src="%s" />';
  • trunk/tests/phpunit/tests/media.php

    r60251 r60285  
    10001000
    10011001        $expected = '<div style="width: ' . $width . 'px;" class="wp-video">' .
    1002             "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n" .
    10031002            '<video class="wp-video-shortcode" id="video-' . $post_id . '-1" width="' . $width . '" height="' . $h . '" preload="metadata" controls="controls">' .
    10041003            '<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4?_=1" />' .
Note: See TracChangeset for help on using the changeset viewer.