Ticket #42804: 42804-update1.patch
File 42804-update1.patch, 6.2 KB (added by , 7 years ago) |
---|
-
wp-includes/class.wp-scripts.php
123 123 public $default_dirs; 124 124 125 125 /** 126 * Holds a string which contains the type attribute for script If 127 * HTML5 support is available then it is initializes as empty string. 128 * 129 * @since 4.9.2 130 * @var string 131 */ 132 private $type_attr = " type='text/javascript'"; 133 134 /** 126 135 * Constructor. 127 136 * 128 137 * @since 2.6.0 … … 130 139 public function __construct() { 131 140 $this->init(); 132 141 add_action( 'init', array( $this, 'init' ), 0 ); 142 143 if ( current_theme_supports( 'html5', 'script' ) ) { 144 $this->type_attr = ''; 145 } 133 146 } 134 147 135 148 /** … … 204 217 return $output; 205 218 } 206 219 207 echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5220 echo "<script{$this->type_attr}>\n"; // CDATA and type='text/javascript' is not needed for HTML 5 208 221 echo "/* <![CDATA[ */\n"; 209 222 echo "$output\n"; 210 223 echo "/* ]]> */\n"; … … 264 277 $after_handle = $this->print_inline_script( $handle, 'after', false ); 265 278 266 279 if ( $before_handle ) { 267 $before_handle = sprintf( "<script type='text/javascript'>\n%s\n</script>\n", $before_handle );280 $before_handle = sprintf( "<script%s>\n%s\n</script>\n", $this->type_attr, $before_handle ); 268 281 } 269 282 270 283 if ( $after_handle ) { 271 $after_handle = sprintf( "<script type='text/javascript'>\n%s\n</script>\n", $after_handle );284 $after_handle = sprintf( "<script%s>\n%s\n</script>\n", $this->type_attr, $after_handle ); 272 285 } 273 286 274 287 if ( $this->do_concat ) { … … 331 344 return true; 332 345 } 333 346 334 $tag = "{$cond_before}{$before_handle}<script type='text/javascript'src='$src'></script>\n{$after_handle}{$cond_after}";347 $tag = "{$cond_before}{$before_handle}<script{$this->type_attr} src='$src'></script>\n{$after_handle}{$cond_after}"; 335 348 336 349 /** 337 350 * Filters the HTML script tag of an enqueued script. … … 401 414 $output = trim( implode( "\n", $output ), "\n" ); 402 415 403 416 if ( $echo ) { 404 printf( "<script type='text/javascript'>\n%s\n</script>\n", $output );417 printf( "<script%s>\n%s\n</script>\n", $this->type_attr, $output ); 405 418 } 406 419 407 420 return $output; -
wp-includes/class.wp-styles.php
101 101 public $default_dirs; 102 102 103 103 /** 104 * Holds a string which contains the type attribute for style If 105 * HTML5 support is available then it is initializes as empty string. 106 * 107 * @since 4.9.2 108 * @var string 109 */ 110 private $type_attr = " type='text/css'"; 111 112 /** 104 113 * Constructor. 105 114 * 106 115 * @since 2.6.0 … … 114 123 * @param WP_Styles $this WP_Styles instance (passed by reference). 115 124 */ 116 125 do_action_ref_array( 'wp_default_styles', array( &$this ) ); 126 127 if ( current_theme_supports( 'html5', 'style' ) ) { 128 $this->type_attr = ''; 129 } 117 130 } 118 131 119 132 /** … … 162 175 // A single item may alias a set of items, by having dependencies, but no source. 163 176 if ( ! $obj->src ) { 164 177 if ( $inline_style = $this->print_inline_style( $handle, false ) ) { 165 $inline_style = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );178 $inline_style = sprintf( "<style id='%s-inline-css'%s>\n%s\n</style>\n", esc_attr( $handle ), $this->type_attr, $inline_style ); 166 179 if ( $this->do_concat ) { 167 180 $this->print_html .= $inline_style; 168 181 } else { … … 221 234 $this->print_html .= $conditional_pre; 222 235 $this->print_html .= $tag; 223 236 if ( $inline_style = $this->print_inline_style( $handle, false ) ) { 224 $this->print_html .= sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );237 $this->print_html .= sprintf( "<style id='%s-inline-css'%s>\n%s\n</style>\n", esc_attr( $handle ), $this->type_attr, $inline_style ); 225 238 } 226 239 $this->print_html .= $conditional_post; 227 240 } else { … … 281 294 return $output; 282 295 } 283 296 284 printf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $output );297 printf( "<style id='%s-inline-css'%s>\n%s\n</style>\n", esc_attr( $handle ), $this->type_attr, $output ); 285 298 286 299 return true; 287 300 } -
wp-includes/embed.php
877 877 * @since 4.4.0 878 878 */ 879 879 function print_embed_styles() { 880 $type_attr = " type='text/css'"; 881 if ( current_theme_supports( 'html5', 'style' ) ) { 882 $type_attr = ''; 883 } 880 884 ?> 881 <style type="text/css">885 <style<?php echo $type_attr; ?>> 882 886 <?php 883 887 if ( SCRIPT_DEBUG ) { 884 888 readfile( ABSPATH . WPINC . '/css/wp-embed-template.css' ); -
wp-includes/formatting.php
5271 5271 } 5272 5272 5273 5273 $printed = true; 5274 5275 $type_attr = " type='text/css'"; 5276 if ( current_theme_supports( 'html5', 'style' ) ) { 5277 $type_attr = ''; 5278 } 5274 5279 ?> 5275 <style type="text/css">5280 <style<?php echo $type_attr; ?>> 5276 5281 img.wp-smiley, 5277 5282 img.emoji { 5278 5283 display: inline !important; -
wp-includes/widgets/class-wp-widget-recent-comments.php
53 53 || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) { 54 54 return; 55 55 } 56 ?> 57 <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style> 58 <?php 56 if ( current_theme_supports( 'html5', 'style' ) ) { 57 echo "<style>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>"; 58 } else { 59 echo "<style type='text/css'>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>"; 60 } 59 61 } 60 62 61 63 /**