[wp-trac] [WordPress Trac] #16118: Support for wp_enqueue_style with negative conditional comments
WordPress Trac
wp-trac at lists.automattic.com
Thu Jan 6 06:27:03 UTC 2011
#16118: Support for wp_enqueue_style with negative conditional comments
-------------------------+-----------------------------
Reporter: sayontan | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: General | Version: 3.0.4
Severity: normal | Resolution:
Keywords: needs-patch |
-------------------------+-----------------------------
Changes (by nacin):
* keywords: => needs-patch
* type: defect (bug) => enhancement
* milestone: Awaiting Review => Future Release
Old description:
> Please refer to http://core.trac.wordpress.org/ticket/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".
New description:
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".
--
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16118#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list