Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ericduran on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
In Drupal 8 the drupal_add_js()
function $options
parameter now also supports a browsers option just like drupal_add_css()
. This allows JavaScript to be wrapped in conditional comments. Example:
drupal_add_js($some_path . '/file.js', array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE))); ?>
Outputs:
<!--[if lte IE 8]>
<script type="text/javascript" src="http://example.com/some/path/file.js"></script>
<![endif]-->
Impacts:
Module developers
Themers
Comments
D7?
Any chance of a backport for this? Sorry if I'm asking in the wrong place.
============================
Resonetrics: Better Tools for Building Brands
http://resonetrics.com
http://technologyformarketers.com
http://kittenassociates.org
http://www.linkedin.com/in/sammooreatresonetrics