Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1254
diff -u -p -r1.1254 common.inc
--- includes/common.inc	14 Nov 2010 21:04:45 -0000	1.1254
+++ includes/common.inc	16 Nov 2010 20:05:15 -0000
@@ -2867,6 +2867,13 @@ function drupal_get_css($css = NULL, $sk
   // Sort CSS items, so that they appear in the correct order.
   uasort($css, 'drupal_sort_css_js');
 
+  // Provide the page with information about the individual CSS files used,
+  // information not otherwise available when CSS aggregation is enabled. The
+  // setting is attached later in this function, but is set here, so that CSS
+  // files removed below are still considered "used" and prevented from being
+  // added in a later AJAX request.
+  $setting['ajaxPageState']['css'] = array_fill_keys(array_keys($css), 1);
+
   // Remove the overridden CSS files. Later CSS files override former ones.
   $previous_item = array();
   foreach ($css as $key => $item) {
@@ -2886,10 +2893,6 @@ function drupal_get_css($css = NULL, $sk
     '#type' => 'styles',
     '#items' => $css,
   );
-
-  // Provide the page with information about the individual CSS files used,
-  // information not otherwise available when CSS aggregation is enabled.
-  $setting['ajaxPageState']['css'] = array_fill_keys(array_keys($css), 1);
   $styles['#attached']['js'][] = array('type' => 'setting', 'data' => $setting);
 
   return drupal_render($styles);
