Index: modules/field/field.attach.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.attach.inc,v
retrieving revision 1.44
diff -u -r1.44 field.attach.inc
--- modules/field/field.attach.inc	31 Aug 2009 06:37:36 -0000	1.44
+++ modules/field/field.attach.inc	4 Sep 2009 23:47:25 -0000
@@ -490,7 +490,7 @@
 
   // Add custom weight handling.
   list($id, $vid, $bundle) = field_attach_extract_ids($obj_type, $object);
-  $form['#attached_css'][] = drupal_get_path('module', 'field') . '/theme/field.css';
+  $form['#attached']['css'][] = drupal_get_path('module', 'field') . '/theme/field.css';
   $form['#pre_render'][] = '_field_extra_weights_pre_render';
   $form['#extra_fields'] = field_extra_fields($bundle);
 
@@ -1090,7 +1090,7 @@
 
   // Add custom weight handling.
   list($id, $vid, $bundle) = field_attach_extract_ids($obj_type, $object);
-  $output['#attached_css'][] = drupal_get_path('module', 'field') . '/theme/field.css';
+  $output['#attached']['css'][] = drupal_get_path('module', 'field') . '/theme/field.css';
   $output['#pre_render'][] = '_field_extra_weights_pre_render';
   $output['#extra_fields'] = field_extra_fields($bundle);
 
Index: modules/user/user.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v
retrieving revision 1.76
diff -u -r1.76 user.admin.inc
--- modules/user/user.admin.inc	27 Aug 2009 20:25:28 -0000	1.76
+++ modules/user/user.admin.inc	4 Sep 2009 23:49:48 -0000
@@ -651,7 +651,7 @@
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
 
-  $form['#attached_js'] = array(drupal_get_path('module', 'user') . '/user.permissions.js');
+  $form['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.permissions.js';
 
   return $form;
 }
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.368
diff -u -r1.368 form.inc
--- includes/form.inc	29 Aug 2009 16:30:14 -0000	1.368
+++ includes/form.inc	4 Sep 2009 23:46:30 -0000
@@ -2245,9 +2245,9 @@
   $element['#group_members'] = &$form_state['groups'][$parents];
 
   // Contains form element summary functionalities.
-  $element['#attached_js']['misc/form.js'] = array('weight' => JS_LIBRARY + 1);
+  $element['#attached']['js']['misc/form.js'] = array('weight' => JS_LIBRARY + 1);
   if (!empty($element['#collapsible'])) {
-    $element['#attached_js']['misc/collapse.js'] = array();
+    $element['#attached']['js'][] = 'misc/collapse.js';
   }
 
   return $element;
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.981
diff -u -r1.981 common.inc
--- includes/common.inc	31 Aug 2009 18:43:12 -0000	1.981
+++ includes/common.inc	4 Sep 2009 23:46:05 -0000
@@ -3177,14 +3177,21 @@
 }
 
 /**
- * Adds all the attached libraries, JavaScript and CSS to the page.
+ * Add to the page all structures attached to a render() structure.
  *
- * @param $libraries
- *   An array of depending libraries to be added.
- * @param $js
- *   An array of JavaScript components to add.
- * @param $css
- *   An array of cascading stylesheets to add.
+ * Libraries, JavaScript, CSS and other types of custom structures are attached
+ * to elements using the #attached property. The #attached property contains an
+ * associative array, where the keys are the the types of the structure, and
+ * the value the attached data. For example:
+ * @code
+ * $build['#attached'] = array(
+ *   'js' => array(drupal_get_path('module', 'taxonomy') . '/taxonomy.js'),
+ *   'css' => array(drupal_get_path('module', 'taxonomy') . '/taxonomy.css'),
+ * );
+ * @endcode
+ *
+ * @param $elements
+ *   The structured array describing the data being rendered.
  * @param $weight
  *   The default weight of JavaScript and CSS being added. This is only applied
  *   to the stylesheets and JavaScript items that don't have an explicit weight
@@ -3197,12 +3204,26 @@
  *   Will return FALSE if there were any missing library dependencies. TRUE will
  *   be returned if all library dependencies were met.
  *
- * @see drupal_add_library(), drupal_render()
- */
-function drupal_process_attached(array $libraries = array(), array $js = array(), array $css = array(), $weight = JS_DEFAULT, $dependency_check = FALSE) {
+ * @see drupal_add_library().
+ * @see drupal_add_js().
+ * @see drupal_add_css().
+ * @see drupal_render().
+ */
+function drupal_process_attached($elements, $weight = JS_DEFAULT, $dependency_check = FALSE) {
+  // If there is nothing to process then return. 
+  if (empty($elements['#attached'])) {
+    return;
+  }
+  // Add defaults to the special attached structures that should be processed differently.
+  $elements['#attached'] += array(
+    'library' => array(),
+    'js' => array(),
+    'css' => array(),
+  );
+
   // Add the libraries first.
   $success = TRUE;
-  foreach ($libraries as $library) {
+  foreach ($elements['#attached']['library'] as $library) {
     if (drupal_add_library($library[0], $library[1]) === FALSE) {
       $success = FALSE;
       // Exit if the dependency is missing.
@@ -3213,8 +3234,10 @@
   }
 
   // Add both the JavaScript and the CSS.
-  foreach (array('js' => $js, 'css' => $css) as $type => $items) {
-    foreach ($items as $data => $options) {
+  // The parameters for drupal_add_js() and drupal_add_css() require special
+  // handling.
+  foreach (array('js', 'css') as $type) {
+    foreach ($elements['#attached'][$type] as $data => $options) {
       // If the value is not an array, it's a filename and passed as first
       // (and only) argument.
       if (!is_array($options)) {
@@ -3234,6 +3257,15 @@
       call_user_func('drupal_add_' . $type, $data, $options);
     }
   }
+
+  // Add additional types of attachments specified in the render() structure.
+  // Libraries, Javascript and CSS have been added already, as they require
+  // special handling.
+  $types = array_diff(array_keys($elements['#attached']), array('library', 'js', 'css'));
+  foreach ($types as $type) {
+    call_user_func_array("drupal_add_$type", $elements['#attached'][$type]);
+  }
+
   return $success;
 }
 
@@ -3266,7 +3298,12 @@
   if (!isset($added[$module][$name])) {
     if ($library = drupal_get_library($module, $name)) {
       // Add all components within the library.
-      $added[$module][$name] = drupal_process_attached($library['dependencies'], $library['js'], $library['css'], JS_LIBRARY, TRUE);
+      $elements['#attached'] = array(
+        'library' => $library['dependencies'],
+        'js' => $library['js'],
+        'css' => $library['css'],
+      );
+      $added[$module][$name] = drupal_process_attached($elements, JS_LIBRARY, TRUE);
     }
     else {
       // Requested library does not exist.
@@ -4115,12 +4152,9 @@
     }
   }
 
-  // Add additional libraries, CSS and JavaScript associated with this element.
-  drupal_process_attached(
-    isset($elements['#attached_library']) ? $elements['#attached_library'] : array(),
-    isset($elements['#attached_js']) ? $elements['#attached_js'] : array(),
-    isset($elements['#attached_css']) ? $elements['#attached_css'] : array()
-  );
+  // Add additional libraries, CSS, JavaScript an other custom
+  // attached data associated with this element.
+  drupal_process_attached($elements);
 
   $prefix = isset($elements['#prefix']) ? $elements['#prefix'] : '';
   $suffix = isset($elements['#suffix']) ? $elements['#suffix'] : '';
@@ -4226,12 +4260,9 @@
   $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
 
   if (!empty($cid) && $cache = cache_get($cid, $bin)) {
-    // Add additional libraries, CSS and JavaScript associated with this element.
-    drupal_process_attached(
-      isset($cache->data['#attached_library']) ? $cache->data['#attached_library'] : array(),
-      isset($cache->data['#attached_js']) ? $cache->data['#attached_js'] : array(),
-      isset($cache->data['#attached_css']) ? $cache->data['#attached_css'] : array()
-    );
+    // Add additional libraries, JavaScript, CSS and other data attached
+    // to this element.
+    drupal_process_attached($cache->data);
     // Return the rendered output.
     return $cache->data['#markup'];;
   }
@@ -4258,12 +4289,8 @@
   }
 
   $data['#markup'] = $markup;
-  // Persist additional CSS and JavaScript files associated with this element.
-  foreach (array('css', 'js', 'library') as $kind) {
-    if (!empty($elements['#attached_' . $kind])) {
-      $data['#attached_' . $kind] = $elements['#attached_' . $kind];
-    }
-  }
+  // Persist attached data associated with this element.
+  $data['#attached'] = $elements['#attached'];
   $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
   $expire = isset($elements['#cache']['expire']) ? $elements['#cache']['expire'] : CACHE_PERMANENT;
   cache_set($cid, $data, $bin, $expire);
@@ -4386,6 +4413,7 @@
     '#title' => '',
     '#attributes' => array(),
     '#required' => FALSE,
+    '#attached' => array(),
   );
 }
 
Index: includes/ajax.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/ajax.inc,v
retrieving revision 1.7
diff -u -r1.7 ajax.inc
--- includes/ajax.inc	27 Aug 2009 04:40:12 -0000	1.7
+++ includes/ajax.inc	4 Sep 2009 23:45:16 -0000
@@ -292,7 +292,7 @@
   // we avoid the problem by checking if the JavaScript has already been added.
   if (!isset($js_added[$element['#id']]) && (isset($element['#ajax']['callback']) || isset($element['#ajax']['path'])) && isset($element['#ajax']['event'])) {
     drupal_add_library('system', 'form');
-    $element['#attached_js'] = array('misc/ajax.js');
+    $element['#attached']['js'][] = 'misc/ajax.js';
 
     $ajax_binding = array(
       'url'      => isset($element['#ajax']['callback']) ? url('system/ajax') : url($element['#ajax']['path']),
Index: modules/color/color.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.module,v
retrieving revision 1.69
diff -u -r1.69 color.module
--- modules/color/color.module	1 Sep 2009 20:39:55 -0000	1.69
+++ modules/color/color.module	4 Sep 2009 23:46:47 -0000
@@ -148,22 +148,24 @@
     '#title' => t('Color set'),
     '#options' => $info['schemes'],
     '#default_value' => $current,
-    // Add Farbtastic color picker.
-    '#attached_library' => array(
-      array('system', 'farbtastic'),
-    ),
-    // Add custom CSS.
-    '#attached_css' => array(
-      $base . '/color.css' => array('preprocess' => FALSE),
-    ),
-    // Add custom JavaScript.
-    '#attached_js' => array(
-      $base . '/color.js',
-      array(
-        'data' => array('color' => array(
-          'reference' => color_get_palette($theme, TRUE),
-        )),
-        'type' => 'setting',
+    '#attached' => array(
+      // Add Farbtastic color picker.
+      'library' => array(
+        array('system', 'farbtastic'),
+      ),
+      // Add custom CSS.
+      'css' => array(
+        $base . '/color.css' => array('preprocess' => FALSE),
+      ),
+      // Add custom JavaScript.
+      'js' => array(
+        $base . '/color.js',
+        array(
+          'data' => array(
+            'color' => array('reference' => color_get_palette($theme, TRUE)),
+          ),
+          'type' => 'setting',
+        ),
       ),
     ),
   );
Index: modules/image/image.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v
retrieving revision 1.9
diff -u -r1.9 image.admin.inc
--- modules/image/image.admin.inc	24 Aug 2009 00:14:20 -0000	1.9
+++ modules/image/image.admin.inc	4 Sep 2009 23:47:51 -0000
@@ -15,7 +15,9 @@
   $styles = image_styles();
   $page['image_style_list'] = array(
     '#markup' => theme('image_style_list', $styles),
-    '#attached_css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
+    '#attached' => array(
+      'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
+    ),
   );
 
   return $page;
@@ -40,7 +42,9 @@
   $form_state['image_style'] = $style;
   $form = array(
     '#tree' => TRUE,
-    '#attached_css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
+    '#attached' => array(
+      'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
+    ),
   );
 
   // Allow the name of the style to be changed.
@@ -313,7 +317,9 @@
 
   $form = array(
     '#tree' => TRUE,
-    '#attached_css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
+    '#attached' => array(
+      'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)),
+    ),
   );
   if (function_exists($effect['form callback'])) {
     $form['data'] = call_user_func($effect['form callback'], $effect['data']);
Index: modules/tracker/tracker.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v
retrieving revision 1.24
diff -u -r1.24 tracker.pages.inc
--- modules/tracker/tracker.pages.inc	31 Aug 2009 06:52:49 -0000	1.24
+++ modules/tracker/tracker.pages.inc	4 Sep 2009 23:49:34 -0000
@@ -76,7 +76,9 @@
     '#rows' => $rows,
     '#header' => array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last updated')),
     '#theme' => 'table',
-    '#attached_css' => array(drupal_get_path('module', 'tracker') . '/tracker.css' => array('preprocess' => FALSE)),
+    '#attached' => array(
+      'css' => array(drupal_get_path('module', 'tracker') . '/tracker.css' => array('preprocess' => FALSE)),
+    ),
   );
   $page['pager'] = array(
     '#theme' => 'pager',
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.784
diff -u -r1.784 system.module
--- modules/system/system.module	1 Sep 2009 16:50:12 -0000	1.784
+++ modules/system/system.module	4 Sep 2009 23:49:24 -0000
@@ -3101,8 +3101,10 @@
   if (system_run_cron_image_access()) {
     $page['page_bottom']['run_cron'] = array(
       // Trigger cron run via AJAX.
-      '#attached_js' => array(
-        '(function($){ $.get(' . drupal_to_js(url('system/run-cron-image')) . '); })(jQuery);' => array('type' => 'inline', 'scope' => 'header'),
+      '#attached' => array(
+        'js' => array(
+          '(function($){ $.get(' . drupal_to_js(url('system/run-cron-image')) . '); })(jQuery);' => array('type' => 'inline', 'scope' => 'header'),
+        ),
       ),
       // Trigger cron run for clients not supporting JavaScript (fall-back).
       '#markup' => theme('system_run_cron_image', 'system/run-cron-image'),
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.256
diff -u -r1.256 upload.module
--- modules/upload/upload.module	24 Aug 2009 00:14:22 -0000	1.256
+++ modules/upload/upload.module	4 Sep 2009 23:49:42 -0000
@@ -231,7 +231,9 @@
         '#collapsible' => TRUE,
         '#collapsed' => empty($node->files),
         '#group' => 'additional_settings',
-        '#attached_js' => array(drupal_get_path('module', 'upload') . '/upload.js'),
+        '#attached' => array(
+          'js' => array(drupal_get_path('module', 'upload') . '/upload.js'),
+        ),
         '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
         '#weight' => 30,
       );
Index: modules/upload/upload.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.admin.inc,v
retrieving revision 1.15
diff -u -r1.15 upload.admin.inc
--- modules/upload/upload.admin.inc	22 Aug 2009 09:48:34 -0000	1.15
+++ modules/upload/upload.admin.inc	4 Sep 2009 23:49:37 -0000
@@ -69,8 +69,8 @@
     '#type' => 'fieldset',
     '#title' => t('General settings'),
     '#collapsible' => TRUE,
-    '#attached_css' => array(
-      drupal_get_path('module', 'upload') . '/upload.admin.css',
+    '#attached'=> array(
+      'css' => array(drupal_get_path('module', 'upload') . '/upload.admin.css'),
     ),
   );
   $form['settings_general']['upload_max_resolution'] = array(
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.511
diff -u -r1.511 book.module
--- modules/book/book.module	31 Aug 2009 17:06:08 -0000	1.511
+++ modules/book/book.module	4 Sep 2009 23:46:41 -0000
@@ -445,7 +445,9 @@
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
     '#group' => 'additional_settings',
-    '#attached_js' => array(drupal_get_path('module', 'book') . '/book.js'),
+    '#attached' => array(
+      'js' => array(drupal_get_path('module', 'book') . '/book.js'),
+    ),
     '#tree' => TRUE,
     '#attributes' => array('class' => array('book-outline-form')),
   );
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.67
diff -u -r1.67 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	31 Aug 2009 20:44:22 -0000	1.67
+++ modules/taxonomy/taxonomy.admin.inc	4 Sep 2009 23:49:33 -0000
@@ -151,7 +151,9 @@
     '#maxlength' => 255,
     '#description' => t('The unique machine readable name for this vocabulary, used for theme templates, can only contain lowercase letters, numbers and underscores.'),
     '#required' => TRUE,
-    '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings),
+    '#attached' => array(
+      'js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings),
+    ),
   );
   $form['help'] = array(
     '#type' => 'textfield',
Index: modules/menu/menu.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v
retrieving revision 1.56
diff -u -r1.56 menu.admin.inc
--- modules/menu/menu.admin.inc	24 Aug 2009 01:49:41 -0000	1.56
+++ modules/menu/menu.admin.inc	4 Sep 2009 23:48:05 -0000
@@ -448,7 +448,9 @@
       '#maxsize' => MENU_MAX_MENU_NAME_LENGTH_UI,
       '#description' => t('This text will be used to construct the URL for the menu. The name must contain only lowercase letters, numbers and hyphens, and must be unique.'),
       '#required' => TRUE,
-      '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings),
+      ),
     );
   }
 
Index: modules/menu/menu.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v
retrieving revision 1.202
diff -u -r1.202 menu.module
--- modules/menu/menu.module	31 Aug 2009 17:06:09 -0000	1.202
+++ modules/menu/menu.module	4 Sep 2009 23:48:16 -0000
@@ -412,7 +412,9 @@
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
       '#group' => 'additional_settings',
-      '#attached_js' => array(drupal_get_path('module', 'menu') . '/menu.js'),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'menu') . '/menu.js'),
+      ),
       '#tree' => TRUE,
       '#weight' => -2,
       '#attributes' => array('class' => array('menu-item-form')),
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.91
diff -u -r1.91 content_types.inc
--- modules/node/content_types.inc	24 Aug 2009 19:26:46 -0000	1.91
+++ modules/node/content_types.inc	4 Sep 2009 23:48:20 -0000
@@ -101,7 +101,9 @@
       '#maxlength' => 32,
       '#required' => TRUE,
       '#description' => t('The machine-readable name of this content type. This text will be used for constructing the URL of the <em>add new content</em> page for this content type. This name must contain only lowercase letters, numbers, and underscores. Underscores will be converted into hyphens when constructing the URL of the <em>add new content</em> page. This name must be unique.'),
-      '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings),
+      ),
     );
   }
   else {
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.78
diff -u -r1.78 node.pages.inc
--- modules/node/node.pages.inc	25 Aug 2009 10:27:14 -0000	1.78
+++ modules/node/node.pages.inc	4 Sep 2009 23:48:28 -0000
@@ -172,7 +172,9 @@
       // Collapsed by default when "Create new revision" is unchecked
       '#collapsed' => !$node->revision,
       '#group' => 'additional_settings',
-      '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'node') . '/node.js'),
+      ),
       '#weight' => 20,
     );
     $form['revision_information']['revision'] = array(
@@ -198,7 +200,9 @@
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
     '#group' => 'additional_settings',
-    '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'),
+    '#attached' => array(
+      'js' => array(drupal_get_path('module', 'node') . '/node.js'),
+    ),
     '#weight' => 90,
   );
   $form['author']['name'] = array(
@@ -229,7 +233,9 @@
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
     '#group' => 'additional_settings',
-    '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'),
+    '#attached' => array(
+      'js' => array(drupal_get_path('module', 'node') . '/node.js'),
+    ),
     '#weight' => 95,
   );
   $form['options']['status'] = array(
Index: modules/file/file.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/file/file.module,v
retrieving revision 1.1
diff -u -r1.1 file.module
--- modules/file/file.module	29 Aug 2009 12:52:32 -0000	1.1
+++ modules/file/file.module	4 Sep 2009 23:47:45 -0000
@@ -50,8 +50,10 @@
     '#upload_validators' => array(),
     '#upload_location' => NULL,
     '#extended' => FALSE,
-    '#attached_css' => array($file_path . '/file.css'),
-    '#attached_js' => array($file_path . '/file.js'),
+    '#attached' => array(
+      'css' => array($file_path . '/file.css'),
+      'js' => array($file_path . '/file.js'),
+    ),
   );
 
   return $elements;
Index: modules/file/file.field.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/file/file.field.inc,v
retrieving revision 1.1
diff -u -r1.1 file.field.inc
--- modules/file/file.field.inc	29 Aug 2009 12:52:32 -0000	1.1
+++ modules/file/file.field.inc	4 Sep 2009 23:47:35 -0000
@@ -71,9 +71,7 @@
   $defaults = field_info_field_settings($field['type']);
   $settings = array_merge($defaults, $field['settings']);
 
-  $form = array(
-    '#attached_js' => array(drupal_get_path('module', 'file') . '/file.js'),
-  );
+  $form['#attached']['js'][] = drupal_get_path('module', 'file') . '/file.js';
 
   $form['display_field'] = array(
     '#type' => 'checkbox',
@@ -119,9 +117,7 @@
 function file_field_instance_settings_form($field, $instance) {
   $settings = $instance['settings'];
 
-  $form = array(
-    '#attached_js' => array(drupal_get_path('module', 'file') . '/file.js'),
-  );
+  $form['#attached']['js'][] = drupal_get_path('module', 'file') . '/file.js';
 
   $form['max_filesize'] = array(
     '#type' => 'textfield',
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.69
diff -u -r1.69 common.test
--- modules/simpletest/tests/common.test	25 Aug 2009 21:16:31 -0000	1.69
+++ modules/simpletest/tests/common.test	4 Sep 2009 23:48:50 -0000
@@ -859,14 +859,10 @@
   }
 
   /**
-   * Tests the addition of libraries through the #attached_library property.
+   * Tests the addition of libraries through the #attached['library'] property.
    */
   function testAttachedLibrary() {
-    $element = array(
-      '#attached_library' => array(
-        array('system', 'farbtastic'),
-      )
-    );
+    $element['#attached']['library'][] = array('system', 'farbtastic');
     drupal_render($element);
     $scripts = drupal_get_js();
     $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('The attached_library property adds the additional libraries.'));
Index: modules/path/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.module,v
retrieving revision 1.169
diff -u -r1.169 path.module
--- modules/path/path.module	28 Aug 2009 14:40:12 -0000	1.169
+++ modules/path/path.module	4 Sep 2009 23:48:31 -0000
@@ -234,7 +234,9 @@
       '#collapsible' => TRUE,
       '#collapsed' => empty($path),
       '#group' => 'additional_settings',
-      '#attached_js' => array(drupal_get_path('module', 'path') . '/path.js'),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'path') . '/path.js'),
+      ),
       '#access' => user_access('create url aliases'),
       '#weight' => 30,
     );
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.765
diff -u -r1.765 comment.module
--- modules/comment/comment.module	29 Aug 2009 10:46:40 -0000	1.765
+++ modules/comment/comment.module	4 Sep 2009 23:47:14 -0000
@@ -590,7 +590,7 @@
       $comments = comment_load_multiple($cids);
       comment_prepare_thread($comments);
       $build = comment_build_multiple($comments);
-      $build['#attached_css'][] = drupal_get_path('module', 'comment') . '/comment.css';
+      $build['#attached']['css'][] = drupal_get_path('module', 'comment') . '/comment.css';
       $build['pager']['#theme'] = 'pager';
       $additions['comments'] = $build;
     }
@@ -940,7 +940,9 @@
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
       '#group' => 'additional_settings',
-      '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
+      ),
     );
     $form['comment']['comment_default_mode'] = array(
       '#type' => 'checkbox',
@@ -1006,7 +1008,9 @@
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
       '#group' => 'additional_settings',
-      '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
+      '#attached' => array(
+        'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
+       ),
       '#weight' => 30,
     );
     $comment_count = isset($node->nid) ? db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() : 0;
@@ -1614,7 +1618,7 @@
   $node = node_load($comment->nid);
 
   if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
-    $form_state['#attached_js'][] = drupal_get_path('module', 'comment') . '/comment.js';
+    $form_state['#attached']['js'][] = drupal_get_path('module', 'comment') . '/comment.js';
   }
 
   $comment = (array) $comment;
Index: modules/toolbar/toolbar.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.module,v
retrieving revision 1.9
diff -u -r1.9 toolbar.module
--- modules/toolbar/toolbar.module	31 Aug 2009 20:23:36 -0000	1.9
+++ modules/toolbar/toolbar.module	4 Sep 2009 23:49:34 -0000
@@ -61,12 +61,14 @@
   $module_path = drupal_get_path('module', 'toolbar');
   $build = array(
     '#theme' => 'toolbar',
-    '#attached_js' => array(
-      $module_path . '/toolbar.js',
-      array('data' => 'misc/jquery.cookie.js', 'weight' => JS_LIBRARY + 2),
-    ),
-    '#attached_css' => array(
-      $module_path . '/toolbar.css',
+    '#attached'=> array(
+      'js' => array(
+        $module_path . '/toolbar.js',
+        array('data' => 'misc/jquery.cookie.js', 'weight' => JS_LIBRARY + 2),
+      ),
+      'css' => array(
+        $module_path . '/toolbar.css',
+      ),
     ),
   );
 
