Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.843
diff -u -r1.843 common.inc
--- includes/common.inc	8 Jan 2009 19:09:49 -0000	1.843
+++ includes/common.inc	9 Jan 2009 14:21:53 -0000
@@ -1981,13 +1981,17 @@
  *   file added to the list, if exists in the same directory. This CSS file
  *   should contain overrides for properties which should be reversed or
  *   otherwise different in a right-to-left display.
+ *
+ *   Note that if $options or $options['type'] is 'reset', then $path will be
+ *   ignored.
  * @param $options
  *   (optional) A string defining the type of CSS that is being added in the
  *   $path parameter ('module' or 'theme'), or an associative array of
  *   additional options, with the following keys:
  *     - 'type'
- *       The type of stylesheet that is being added. Types are: module or
- *       theme. Defaults to 'module'.
+ *       The type of stylesheet that is being added. Types are: 'module',
+ *       'theme', or 'reset'. Defaults to 'module'. If the type is 'reset',
+ *       then the CSS will be reset, ignoring $path and other $options.
  *     - 'media'
  *       The media type for the stylesheet, e.g., all, print, screen. Defaults
  *       to 'all'.
@@ -2014,32 +2018,31 @@
  *
  *       Typical candidates for caching are for example styles for nodes across
  *       the site, or used in the theme.
- * @param $reset
- *   (optional) Resets the currently loaded cascading stylesheets.
  * @return
  *   An array of CSS files.
  */
-function drupal_add_css($path = NULL, $options = NULL, $reset = FALSE) {
+function drupal_add_css($path = NULL, $options = NULL) {
   static $css = array();
   global $language;
 
+  // Construct the options, taking the defaults into consideration.
+  if (isset($options)) {
+    if (!is_array($options)) {
+      $options = array('type' => $options);
+    }
+  }
+  else {
+    $options = array();
+  }
+
   // Request made to reset the CSS added so far.
-  if ($reset) {
+  if (isset($options['type']) && $options['type'] == 'reset') {
     $css = array();
   }
 
   // Create an array of CSS files for each media type first, since each type needs to be served
   // to the browser differently.
   if (isset($path)) {
-    // Construct the options, taking the defaults into consideration.
-    if (isset($options)) {
-      if (!is_array($options)) {
-        $options = array('type' => $options);
-      }
-    }
-    else {
-      $options = array();
-    }
     $options += array(
       'type' => 'module',
       'media' => 'all',
@@ -2341,6 +2344,7 @@
  *       array is directly placed in Drupal.settings. All modules should wrap
  *       their actual configuration settings in another variable to prevent
  *       the pollution of the Drupal.settings namespace.
+ *   - 'reset': Anything in $data will be ignored.
  * @param $options
  *   (optional) A string defining the type of JavaScript that is being added
  *   in the $data parameter ('file'/'setting'/'inline'), or an array which
@@ -2348,7 +2352,9 @@
  *   always pass the string 'setting' only.
  *   - type
  *       The type of JavaScript that is to be added to the page. Allowed
- *       values are 'file', 'inline' or 'setting'. Defaults to 'file'.
+ *       values are 'file', 'inline', 'setting', or 'reset'. Defaults to
+ *       'file'. Note that if type is 'reset', then $data and all other
+ *       $options will be ignored.
  *   - scope
  *       The location in which you want to place the script. Possible values
  *       are 'header' or 'footer'. If your theme implements different regions,
@@ -2381,13 +2387,11 @@
  *   - preprocess
  *       Aggregate the JavaScript if the JavaScript optimization setting has
  *       been toggled in admin/settings/performance. Defaults to TRUE.
- * @param $reset
- *   (optional) Resets the currently loaded JavaScript.
  * @return
  *   The contructed array of JavaScript files.
  * @see drupal_get_js()
  */
-function drupal_add_js($data = NULL, $options = NULL, $reset = FALSE) {
+function drupal_add_js($data = NULL, $options = NULL) {
   static $javascript = array();
 
   // Construct the options, taking the defaults into consideration.
@@ -2401,14 +2405,14 @@
   }
   $options += drupal_js_defaults($data);
 
-  // Preprocess can only be set if caching is enabled.
-  $options['preprocess'] = $options['cache'] ? $options['preprocess'] : FALSE;
-
-  // Request made to reset the JavaScript added so far.
-  if ($reset) {
+  if ($options['type'] == 'reset') {
+    // Request made to reset the JavaScript added so far
     $javascript = array();
   }
 
+  // Preprocess can only be set if caching is enabled.
+  $options['preprocess'] = $options['cache'] ? $options['preprocess'] : FALSE;
+
   if (isset($data)) {
     // Add jquery.js and drupal.js, as well as the basePath setting, the
     // first time a Javascript file is added.
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.20
diff -u -r1.20 common.test
--- modules/simpletest/tests/common.test	8 Jan 2009 19:09:49 -0000	1.20
+++ modules/simpletest/tests/common.test	9 Jan 2009 14:22:00 -0000
@@ -170,7 +170,7 @@
   function setUp() {
     parent::setUp();
     // Reset drupal_add_css() before each test.
-    drupal_add_css(NULL, NULL, TRUE);
+    drupal_add_css(NULL, 'reset');
   }
 
   /**
@@ -352,7 +352,7 @@
     variable_set('preprocess_js', 0);
 
     // Reset drupal_add_js() before each test.
-    drupal_add_js(NULL, NULL, TRUE);
+    drupal_add_js(NULL, 'reset');
   }
 
   function tearDown() {
@@ -404,7 +404,7 @@
    */
   function testReset() {
     drupal_add_js('misc/collapse.js');
-    drupal_add_js(NULL, NULL, TRUE);
+    drupal_add_js(NULL, 'reset');
     $this->assertEqual(array(), drupal_add_js(), t('Resetting the JavaScript correctly empties the cache.'));
   }
 
