[wp-trac] [WordPress Trac] #25427: wp_style_add_data() doesn't support "downlevel-revealed" conditional comments
WordPress Trac
noreply at wordpress.org
Fri Sep 27 20:22:34 UTC 2013
#25427: wp_style_add_data() doesn't support "downlevel-revealed" conditional
comments
--------------------------+-----------------------------
Reporter: pburke | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.6.1
Severity: normal | Keywords:
--------------------------+-----------------------------
When used to add conditional comments to enqueued stylesheets,
wp_style_add_data() generates code that works great for targeting specific
versions of Internet Explorer ('lt IE 9' etc.), but does not work for
targeting non-IE browsers ('!IE' or '!IEMobile').
Those types of conditional comments are called "downlevel-revealed"
comments, and need a specific syntax so they are read by non-IE browsers
but hidden by IE:
{{{
<!--[if !IE]><!-->
...
<!--<![endif]-->
}}}
The syntax generated by wp_style_add_data() is:
{{{
<!--[if !IE]>
...
<![endif]-->
}}}
... which causes the contained code to be ignored by non-IE browsers.
'''To reproduce:'''
1) In a theme's functions.php file, use wp_style_add_data() to attach a
conditional comment that targets non-IE browsers to the theme's
stylesheet:
{{{
wp_enqueue_style( 'mytheme-style', get_stylesheet_uri(), array(),
'2013-09-27' );
wp_style_add_data( 'mytheme-style', 'conditional', '!IE' );
}}}
2) Enable the theme and view the page in a non-IE browser. Notice that the
browser ignores the stylesheet declaration.
Reference: [http://css-tricks.com/downlevel-hidden-downlevel-revealed/
downlevel-revealed versus downlevel-hidden conditional comments.]
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25427>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list