Opened 13 years ago
Closed 13 years ago
#21162 closed enhancement (duplicate)
Add !IE conditional comment on $wp_styles->add_data
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
There is no way to use $wp_styles->add_data("css_ie", "conditional", "!IE");
and target non-IE browsers.
There are use cases for this for example:
<!--[if (gt IE 8) | (IEMobile)]><!--> <link rel='stylesheet' href='<?php bloginfo("template_url"); ?>/css/style.css'><!--<![endif]--> <!--[if (lt IE 9) & (!IEMobile)]> <link rel='stylesheet' href='<?php bloginfo("template_url"); ?>/css/ie.css'><![endif]-->
I do not know how to attach a patch or diff file but I changed the code in class.wp-styles.php between lines 69 and 75 to:
if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) { if (strpos(strtoupper($obj->extra['conditional']), "!IE")) { $tag .= "<!--[if {$obj->extra['conditional']}]><!-->\n"; $end_cond = "<!--<![endif]-->\n"; } else { $tag .= "<!--[if {$obj->extra['conditional']}]>\n"; $end_cond = "<![endif]-->\n"; }
which seems to work.
Change History (2)
Note: See
TracTickets for help on using
tickets.
It should probably be:
in order to distinguish between !IEMobile and !IE
I guess there could be a more elegant solution?