Changeset 46164 for trunk/src/wp-includes/class.wp-styles.php
- Timestamp:
- 09/18/2019 02:49:30 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class.wp-styles.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-styles.php
r46088 r46164 102 102 103 103 /** 104 * Holds a string which contains the type attribute for style tag. 105 * 106 * If the current theme does not declare HTML5 support for 'style', 107 * then it initializes as `type='text/css'`. 108 * 109 * @since 5.3.0 110 * @var string 111 */ 112 private $type_attr = ''; 113 114 /** 104 115 * Constructor. 105 116 * … … 115 126 */ 116 127 do_action_ref_array( 'wp_default_styles', array( &$this ) ); 128 129 if ( ! current_theme_supports( 'html5', 'style' ) ) { 130 $this->type_attr = " type='text/css'"; 131 } 117 132 } 118 133 … … 157 172 158 173 if ( $inline_style ) { 159 $inline_style_tag = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style ); 174 $inline_style_tag = sprintf( 175 "<style id='%s-inline-css'%s>\n%s\n</style>\n", 176 esc_attr( $handle ), 177 $this->type_attr, 178 $inline_style 179 ); 160 180 } else { 161 181 $inline_style_tag = ''; … … 198 218 199 219 $rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 200 $title = isset( $obj->extra['title'] ) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : ''; 201 202 $tag = "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n"; 220 $title = isset( $obj->extra['title'] ) ? sprintf( "title='%s'", esc_attr( $obj->extra['title'] ) ) : ''; 221 222 $tag = sprintf( 223 "<link rel='%s' id='%s-css' %s href='%s'%s media='%s' />\n", 224 $rel, 225 $handle, 226 $title, 227 $href, 228 $this->type_attr, 229 $media 230 ); 203 231 204 232 /** … … 224 252 } 225 253 226 $rtl_tag = "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n"; 254 $rtl_tag = sprintf( 255 "<link rel='%s' id='%s-rtl-css' %s href='%s'%s media='%s' />\n", 256 $rel, 257 $handle, 258 $title, 259 $rtl_href, 260 $this->type_attr, 261 $media 262 ); 263 227 264 /** This filter is documented in wp-includes/class.wp-styles.php */ 228 265 $rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media ); … … 299 336 } 300 337 301 printf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $output ); 338 printf( 339 "<style id='%s-inline-css'%s>\n%s\n</style>\n", 340 esc_attr( $handle ), 341 $this->type_attr, 342 $output 343 ); 302 344 303 345 return true;
Note: See TracChangeset
for help on using the changeset viewer.