[wp-trac] [WordPress Trac] #24813: wp_add_inline_style behaviour changes with SCRIPT_DEBUG
WordPress Trac
noreply at wordpress.org
Sun Jul 21 23:21:24 UTC 2013
#24813: wp_add_inline_style behaviour changes with SCRIPT_DEBUG
---------------------------+-----------------------------------
Reporter: stephenharris | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Appearance | Version: 3.5.2
Severity: normal | Keywords: 2nd-opinion has-patch
---------------------------+-----------------------------------
More specifically the behaviour changes on whether styles are
concatenated: Added CSS is (or isn't) wrapped in `<style>` tags depending
on whether scripts are (or are not) concatenated.
`wp_add_inline_style()` allows for printing additional CSS after the
specified stylesheet has been loaded, which it does in
[https://github.com/WordPress/WordPress/blob/3.5.2/wp-includes/class.wp-
styles.php#L112 WP_Styles::print_inline_style].
The second argument in `print_inline_style()` allows you to print or
return these additional style rules. If set to print, it also prints
`<style>` tags around the CSS. If the second argument is `false`, it just
returns the attached data, with no `<style>` tags added.
The actual bug is [https://github.com/WordPress/WordPress/blob/3.5.2/wp-
includes/class.wp-styles.php#L88 WP_Styles::do_item]. Depending on the
the value `$this->do_concat` it uses `print_inline_style` argument with
the second argument set to true or false.
This means if you use `wp_add_inline_style()` you must enclose the style
rules yourself in `<style>` tags - unless, for example, `SCRIPT_DEBUG` is
set to true.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24813>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list