Ensure that inline styles attached to conditional stylesheets are also conditional.

Adds unit test.

Props georgestephanis.
Fixes #29180.

Built from https://develop.svn.wordpress.org/trunk@31031


git-svn-id: http://core.svn.wordpress.org/trunk@31012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-03 04:10:21 +00:00
parent e649887e40
commit f7aef5b69a
2 changed files with 11 additions and 4 deletions

View File

@ -107,17 +107,24 @@ class WP_Styles extends WP_Dependencies {
}
}
if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) {
$tag = "<!--[if {$obj->extra['conditional']}]>\n" . $tag . "<![endif]-->\n";
$conditional_pre = $conditional_post = '';
if ( isset( $obj->extra['conditional'] ) && $obj->extra['conditional'] ) {
$conditional_pre = "<!--[if {$obj->extra['conditional']}]>\n";
$conditional_post = "<![endif]-->\n";
}
if ( $this->do_concat ) {
$this->print_html .= $conditional_pre;
$this->print_html .= $tag;
if ( $inline_style = $this->print_inline_style( $handle, false ) )
if ( $inline_style = $this->print_inline_style( $handle, false ) ) {
$this->print_html .= sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );
}
$this->print_html .= $conditional_post;
} else {
echo $conditional_pre;
echo $tag;
$this->print_inline_style( $handle );
echo $conditional_post;
}
return true;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31030';
$wp_version = '4.2-alpha-31031';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.