mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Check for $.fn.closest & use it. Fixes #597
This commit is contained in:
parent
95b89e1719
commit
084ef928d5
@ -804,8 +804,8 @@
|
||||
$cell = $(cell),
|
||||
// update cache - format: function(s, table, cell, cellIndex)
|
||||
// no closest in jQuery v1.2.6 - tbdy = $tb.index( $(cell).closest('tbody') ),$row = $(cell).closest('tr');
|
||||
tbdy = $tb.index( $cell.parents('tbody').filter(':first') ),
|
||||
$row = $cell.parents('tr').filter(':first');
|
||||
tbdy = $tb.index( $.fn.closest ? $cell.closest('tbody') : $cell.parents('tbody').filter(':first') ),
|
||||
$row = $.fn.closest ? $cell.closest('tr') : $cell.parents('tr').filter(':first');
|
||||
cell = $cell[0]; // in case cell is a jQuery object
|
||||
// tbody may not exist if update is initialized while tbody is removed for processing
|
||||
if ($tb.length && tbdy >= 0) {
|
||||
@ -1167,7 +1167,7 @@
|
||||
}
|
||||
if (c.delayInit && isEmptyObject(c.cache)) { buildCache(table); }
|
||||
// jQuery v1.2.6 doesn't have closest()
|
||||
cell = /TH|TD/.test(this.tagName) ? this : $(this).parents('th, td')[0];
|
||||
cell = $.fn.closest ? $(this).closest('th, td')[0] : /TH|TD/.test(this.tagName) ? this : $(this).parents('th, td')[0];
|
||||
// reference original table headers and find the same cell
|
||||
cell = c.$headers[ $headers.index( cell ) ];
|
||||
if (!cell.sortDisabled) {
|
||||
|
@ -1478,7 +1478,7 @@ ts.addWidget({
|
||||
})
|
||||
.find('.' + ts.css.resizer + ',.' + ts.css.grip)
|
||||
.bind('mousedown', function(event) {
|
||||
// save header cell and mouse position; closest() not supported by jQuery v1.2.6
|
||||
// save header cell and mouse position
|
||||
$target = $(event.target).closest('th');
|
||||
var $header = c.$headers.filter('[data-column="' + $target.attr('data-column') + '"]');
|
||||
if ($header.length > 1) { $target = $target.add($header); }
|
||||
|
Loading…
Reference in New Issue
Block a user