Index: themes/tests/test_theme/test_theme.info =================================================================== RCS file: /cvs/drupal/drupal/themes/tests/test_theme/test_theme.info,v retrieving revision 1.1 diff -u -r1.1 test_theme.info --- themes/tests/test_theme/test_theme.info 21 Mar 2010 04:05:24 -0000 1.1 +++ themes/tests/test_theme/test_theme.info 24 Apr 2010 10:08:35 -0000 @@ -3,4 +3,5 @@ description = Theme for testing the theme system core = 7.x engine = phptemplate -hidden = TRUE \ No newline at end of file +hidden = TRUE +stylesheets-conditional[lte IE 8][all][] = ie.css Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.922 diff -u -r1.922 system.module --- modules/system/system.module 22 Apr 2010 07:36:50 -0000 1.922 +++ modules/system/system.module 24 Apr 2010 10:08:35 -0000 @@ -2369,6 +2369,17 @@ } } $themes[$key]->info['stylesheets'] = $pathed_stylesheets; + $pathed_stylesheets_conditional = array(); + if (isset($themes[$key]->info['stylesheets-conditional'])) { + foreach ($themes[$key]->info['stylesheets-conditional'] as $condition => $stylesheets_conditional) { + foreach ($stylesheets_conditional as $media => $stylesheets) { + foreach ($stylesheets as $stylesheet) { + $pathed_stylesheets_conditional[$condition][$media][$stylesheet] = dirname($themes[$key]->uri) . '/' . $stylesheet; + } + } + } + } + $themes[$key]->info['stylesheets-conditional'] = $pathed_stylesheets_conditional; // Give the scripts proper path information. $scripts = array(); Index: modules/simpletest/tests/common_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common_test.module,v retrieving revision 1.10 diff -u -r1.10 common_test.module --- modules/simpletest/tests/common_test.module 2 Mar 2010 08:47:41 -0000 1.10 +++ modules/simpletest/tests/common_test.module 24 Apr 2010 10:08:34 -0000 @@ -41,6 +41,12 @@ 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); + $items['conditional-styles'] = array( + 'title' => 'Conditional styles test', + 'page callback' => 'common_test_conditional_styles', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); return $items; } @@ -198,3 +204,11 @@ drupal_add_css(drupal_get_path('module', 'node') . '/node.css?arg1=value1&arg2=value2'); return ''; } + +/** + * Function to test 'browsers' option for drupal_add_css(). + */ +function common_test_conditional_styles() { + drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css', array('browsers' => array('IE' => 'lt IE 5', '!IE' => FALSE), 'preprocess' => FALSE)); + return 'Add conditional style'; +} Index: modules/simpletest/tests/common.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v retrieving revision 1.110 diff -u -r1.110 common.test --- modules/simpletest/tests/common.test 22 Apr 2010 21:41:09 -0000 1.110 +++ modules/simpletest/tests/common.test 24 Apr 2010 10:08:34 -0000 @@ -699,6 +699,21 @@ $query_string = substr(variable_get('css_js_query_string', '0'), 0, 1); $this->assertRaw(drupal_get_path('module', 'node') . '/node.css?arg1=value1&arg2=value2&' . $query_string, t('Query string was appended correctly to css.')); } + + /** + * Test 'browsers' option in drupal_add_css(). + */ + function testConditionalStyles() { + // Create user with permission to access content. + $web_user = $this->drupalCreateUser(array('access content')); + $this->drupalLogin($web_user); + $this->drupalGet("conditional-styles"); + $css = '