Index: misc/tableselect.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/tableselect.js,v
retrieving revision 1.1
diff -u -r1.1 tableselect.js
--- misc/tableselect.js	21 Nov 2006 08:16:39 -0000	1.1
+++ misc/tableselect.js	25 Mar 2007 10:05:36 -0000
@@ -9,8 +9,15 @@
     // Loop through all checkboxes and set their state to the select all checkbox' state.
     checkboxes.each(function() {
       this.checked = selectAll[0].checked;
+      var ptr = $(this).parents('tr:first');
       // Either add or remove the selected class based on the state of the check all checkbox.
-      $(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
+      ptr[this.checked ? 'addClass' : 'removeClass']('selected');
+
+      // Ensure that rowspans are respected.
+      var span = $(this).parents('td').attr('rowspan');
+      for (var i = 1; i < span; i++) {
+        ptr = ptr.next()[this.checked ? 'addClass' : 'removeClass']('selected');
+      }
     });
     // Update the title and the state of the check all box.
     selectAll.attr('title', selectAll[0].checked ? settings.selectNone : settings.selectAll);
@@ -21,8 +28,15 @@
 
   // For each of the checkboxes within the table.
   checkboxes = $('td input:checkbox', table).click(function(e) {
+    var ptr = $(this).parents('tr:first');
     // Either add or remove the selected class based on the state of the check all checkbox.
-    $(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
+    ptr[this.checked ? 'addClass' : 'removeClass' ]('selected');
+
+    // Ensure that rowspans are respected.
+    var span = $(this).parents('td').attr('rowspan');
+    for (var i = 1; i < span; i++) {
+      ptr = ptr.next()[this.checked ? 'addClass' : 'removeClass']('selected');
+    }
 
     // If this is a shift click, we need to highlight everything in the range.
     // Also make sure that we are actually checking checkboxes over a range and
