Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.626
diff -u -p -r1.626 theme.inc
--- includes/theme.inc	11 Dec 2010 02:06:25 -0000	1.626
+++ includes/theme.inc	15 Dec 2010 16:33:49 -0000
@@ -1623,7 +1623,7 @@ function theme_table($variables) {
 
   // Add sticky headers, if applicable.
   if (count($header) && $sticky) {
-    drupal_add_js('misc/tableheader.js');
+    drupal_add_js('misc/tableheader.js', array('weight' => -1));
     // Add 'sticky-enabled' class to the table to identify it for JS.
     // This is needed to target tables constructed by this function.
     $attributes['class'][] = 'sticky-enabled';
Index: modules/block/block-admin-display-form.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block-admin-display-form.tpl.php,v
retrieving revision 1.7
diff -u -p -r1.7 block-admin-display-form.tpl.php
--- modules/block/block-admin-display-form.tpl.php	5 Oct 2009 02:43:01 -0000	1.7
+++ modules/block/block-admin-display-form.tpl.php	15 Dec 2010 16:34:56 -0000
@@ -26,7 +26,7 @@
 ?>
 <?php
   // Add table javascript.
-  drupal_add_js('misc/tableheader.js');
+  drupal_add_js('misc/tableheader.js', array('weight' => -1));
   drupal_add_js(drupal_get_path('module', 'block') . '/block.js');
   foreach ($block_regions as $region => $title) {
     drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-' . $region, NULL, FALSE);
Index: modules/simpletest/tests/theme.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/theme.test,v
retrieving revision 1.23
diff -u -p -r1.23 theme.test
--- modules/simpletest/tests/theme.test	14 Nov 2010 21:04:45 -0000	1.23
+++ modules/simpletest/tests/theme.test	15 Dec 2010 16:35:06 -0000
@@ -119,7 +119,16 @@ class ThemeTableUnitTest extends DrupalW
     $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
     $this->content = theme('table', array('header' => $header, 'rows' => $rows));
     $js = drupal_add_js();
+
+    // Ensure that both tableheader.js and tabledrag.js are included, and that
+    // tabledrag.js runs after tableheader.js, so that its behavior binds to
+    // the weights in the sticky table.
     $this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.'));
+    $this->assertTrue(isset($js['misc/tabledrag.js']), t('tabledrag.js was included.'));
+    $position1 = array_search('misc/tableheader.js', array_keys($js));
+    $position2 = array_search('misc/tabledrag.js', array_keys($js));
+    $this->assertTrue($position2 > $position1, t('tabledrag.js was included after tableheader.js.'));
+
     $this->assertRaw('sticky-enabled',  t('Table has a class of sticky-enabled when $sticky = TRUE.'));
     drupal_static_reset('drupal_add_js');
   }
