--- common.inc	2007-02-06 01:43:00.000000000 -0600
+++ common.inc.alt_side_effect_monitor	2007-02-06 01:42:22.000000000 -0600
@@ -1591,7 +1591,8 @@
  * @param $scope
  *   (optional) The location in which you want to place the script. Possible
  *   values are 'header' and 'footer' by default. If your theme implements
- *   different locations, however, you can also use these.
+ *   different locations, however, you can also use these. If set to NULL,
+ *   returns an associative array of JavaScript for all scopes.
  * @param $defer
  *   (optional) If set to TRUE, the defer attribute is set on the <script> tag.
  *   Defaults to FALSE. This parameter is not used with $type == 'setting'.
@@ -1616,6 +1617,10 @@
  */
 function _drupal_add_js($data, $type, $scope, $defer, $cache) {
   static $javascript = array();
+  
+  if (!isset($scope)) {
+  	return $javascript;
+  }
 
   if (!isset($javascript[$scope])) {
     $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
