Skip to content

Commit b381e86

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@60285 602fd350-edb4-49c9-b593-d223f7449a82
1 parent aa1f5ef commit b381e86

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

src/wp-includes/media.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,9 +2992,6 @@ function wp_underscore_playlist_templates() {
29922992
function wp_playlist_scripts( $type ) {
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 );
30002997
}
@@ -3502,14 +3499,7 @@ function wp_audio_shortcode( $attr, $content = '' ) {
35023499
}
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" />';
35153505

@@ -3787,14 +3777,7 @@ function wp_video_shortcode( $attr, $content = '' ) {
37873777
}
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" />';
38003783

tests/phpunit/tests/media.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,6 @@ public function test_video_shortcode_body() {
999999
$content = apply_filters( 'the_content', $video );
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" />' .
10051004
'<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .

0 commit comments

Comments
 (0)