Support for wp_enqueue_style with negative conditional comments — at Version 1
|Reported by:||sayontan||Owned by:|
|Component:||Script Loader||Keywords:||has-patch needs-testing dev-feedback 3.6-early|
Description (last modified by nacin)
Please refer to #10891. It refers to the support for conditional comments using the global variable, wp_styles.
I have noticed that if you pass a negative conditional comment, however, this breaks. E.g. Let's say you have a lot of CSS3 rules, which don't apply to IE. You would not include that CSS:
<!--[if !IE]>--> <link rel="stylesheet" id="my-handle-css" href="http://my.url.com/css3.css" type="text/css" media="all"/> <!--<![endif]-->
I know that IE9 supports CSS3, but I am using the above for illustrative purposes. One would expect that to include the conditional comment above you would do this between the register and the enqueue commands:
$GLOBALS['wp_styles']->add_data('my-handle', 'conditional', '!IE');
If you add a conditional tag to wp_styles, however, the generated markup is incorrect:
<!--[if !IE]> <link rel='stylesheet' id='my-handle-css' href='http://my.url.com/css3.css' type='text/css' media='all' /> <![endif]-->
Note the missing --> after [if !IE]>, and <!-- before <![endif]. This has the effect of hiding the CSS from all browsers, which wasn't the original intention. So probably a separate handling approach is required for "show" type of conditional comments than for "hide".