From f270cda0707aff5804ea5bbfd3e44000eaa0d871 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 17 Mar 2009 02:59:27 +0000 Subject: #350275 by mfer: Fix regression in tablesort after introduction of jQuery 1.3.2. --- misc/tabledrag.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'misc/tabledrag.js') diff --git a/misc/tabledrag.js b/misc/tabledrag.js index d07b3c780..ace82cfc0 100644 --- a/misc/tabledrag.js +++ b/misc/tabledrag.js @@ -523,7 +523,16 @@ Drupal.tableDrag.prototype.findDropTargetRow = function(x, y) { var row = rows[n]; var indentDiff = 0; var rowY = $(row).offset().top; - var rowHeight = parseInt($(row).outerHeight()) / 2; + // Because Safari does not report offsetHeight on table rows, but does on + // table cells, grab the firstChild of the row and use that instead. + // http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari. + if (row.offsetHeight == 0) { + var rowHeight = parseInt(row.firstChild.offsetHeight) / 2; + } + // Other browsers. + else { + var rowHeight = parseInt(row.offsetHeight) / 2; + } // Because we always insert before, we need to offset the height a bit. if ((y > (rowY - rowHeight)) && (y < (rowY + rowHeight))) { @@ -1074,4 +1083,4 @@ Drupal.theme.prototype.tableDragChangedWarning = function () { return '
' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t("Changes made in this table will not be saved until the form is submitted.") + '
'; }; -})(jQuery); \ No newline at end of file +})(jQuery); -- cgit v1.2.3