Index: misc/tableheader.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/tableheader.js,v
retrieving revision 1.32
diff -u -r1.32 tableheader.js
--- misc/tableheader.js	28 Jul 2010 01:38:28 -0000	1.32
+++ misc/tableheader.js	31 Jul 2010 18:42:15 -0000
@@ -35,7 +35,7 @@
     .insertBefore(this.originalTable)
     .css({ position: 'fixed', top: '0px' });
   this.stickyHeader = this.originalHeader.clone(true)
-    .hide()
+    .css('visibility', 'hidden')
     .appendTo(this.stickyTable);
   this.stickyHeaderCells = this.stickyHeader.find('> tr > th');
 
@@ -43,23 +43,11 @@
   $(window)
     .bind('scroll.drupal-tableheader', $.proxy(this, 'eventhandlerRecalculateStickyHeader'))
     .bind('resize.drupal-tableheader', { calculateWidth: true }, $.proxy(this, 'eventhandlerRecalculateStickyHeader'))
-    // Make sure the anchor being scrolled into view is not hidden beneath the
-    // sticky table header. Adjust the scrollTop if it does.
-    .bind('drupalDisplaceAnchor.drupal-tableheader', function () {
-      window.scrollBy(0, -self.stickyTable.outerHeight());
-    })
-    // Make sure the element being focused is not hidden beneath the sticky
-    // table header. Adjust the scrollTop if it does.
-    .bind('drupalDisplaceFocus.drupal-tableheader', function (event) {
-      if (self.stickyVisible && event.clientY < (self.stickyOffsetTop + self.stickyTable.outerHeight()) && event.$target.closest('sticky-header').length === 0) {
-        window.scrollBy(0, -self.stickyTable.outerHeight());
-      }
-    })
     .triggerHandler('resize.drupal-tableheader');
 
   // We hid the header to avoid it showing up erroneously on page load;
   // we need to unhide it now so that it will show up when expected.
-  this.stickyHeader.show();
+  this.stickyHeader.css('visibility', '');
 };
 
 /**
@@ -80,7 +68,7 @@
   var viewHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
   if (calculateWidth || this.viewHeight !== viewHeight) {
     this.viewHeight = viewHeight;
-    this.vPosition = this.originalTable.offset().top - 4 - this.stickyOffsetTop;
+    this.vPosition = this.originalTable.offset().top - this.stickyOffsetTop;
     this.hPosition = this.originalTable.offset().left;
     this.vLength = this.originalTable[0].clientHeight - 100;
     calculateWidth = true;
@@ -90,22 +78,15 @@
   var hScroll = document.documentElement.scrollLeft || document.body.scrollLeft;
   var vOffset = (document.documentElement.scrollTop || document.body.scrollTop) - this.vPosition;
   this.stickyVisible = vOffset > 0 && vOffset < this.vLength;
-  this.stickyTable.css({ left: (-hScroll + this.hPosition) + 'px', visibility: this.stickyVisible ? 'visible' : 'hidden' });
+  this.stickyTable.css({ left: parseInt(-hScroll + this.hPosition) + 'px', visibility: this.stickyVisible ? 'visible' : 'hidden' });
 
   // Only perform expensive calculations if the sticky header is actually
   // visible or when forced.
   if (this.stickyVisible && (calculateWidth || !this.widthCalculated)) {
     this.widthCalculated = true;
     // Resize header and its cell widths.
-    this.stickyHeaderCells.each(function (index) {
-      var cellWidth = self.originalHeaderCells.eq(index).css('width');
-      // Exception for IE7.
-      if (cellWidth == 'auto') {
-        cellWidth = self.originalHeaderCells.get(index).clientWidth + 'px';
-      }
-      $(this).css('width', cellWidth);
-    });
-    this.stickyTable.css('width', this.originalTable.css('width'));
+    this.stickyHeaderCells.width(function (index) { return self.originalHeaderCells.eq(index).width() + self.originalHeaderCells.get(index).clientLeft; });
+    this.stickyTable.width(this.originalTable.get(0).clientWidth + this.originalTable.get(0).clientLeft);
   }
 };
 
