X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fjquery%2Fjquery.tablesorter.js;h=f134aabd71b576df6987d93fccd928a6653bf179;hb=81e7541c85a4a00e14dd085e31a69a565eae3567;hp=f054aaac40bbbfb7943e3fb5f6c584694609ac59;hpb=28dc1840f5b7c788eee82eab897f91468e13bc89;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index f054aaac40..f134aabd71 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -230,7 +230,7 @@ * @param $table jQuery object for a */ function emulateTHeadAndFoot( $table ) { - var $rows = $table.find( 'tr' ); + var $rows = $table.find( '> tbody > tr' ); if( !$table.get(0).tHead ) { var $thead = $( '' ); $rows.each( function() { @@ -241,7 +241,7 @@ } $thead.append( this ); } ); - $table.prepend( $thead ); + $table.children('tbody').before( $thead ); } if( !$table.get(0).tFoot ) { var $tfoot = $( '' ); @@ -270,7 +270,7 @@ }); $tableHeaders = $( longest ); } - $tableHeaders = $tableHeaders.find( 'th' ).each( function( index ) { + $tableHeaders = $tableHeaders.children( 'th' ).each( function( index ) { this.column = realCellIndex; var colspan = this.colspan; @@ -442,13 +442,13 @@ function explodeRowspans( $table ) { // Split multi row cells into multiple cells with the same content - $table.find( '[rowspan]' ).each(function() { + $table.find( '> tbody > tr > [rowspan]' ).each(function() { var rowSpan = this.rowSpan; this.rowSpan = 1; var cell = $( this ); var next = cell.parent().nextAll(); for ( var i = 0; i < rowSpan - 1; i++ ) { - var td = next.eq( i ).find( 'td' ); + var td = next.eq( i ).children( 'td' ); if ( !td.length ) { next.eq( i ).append( cell.clone() ); } else if ( this.cellIndex === 0 ) { @@ -585,8 +585,13 @@ cacheRegexs(); // Apply event handling to headers - // this is to big, perhaps break it out? + // this is too big, perhaps break it out? $headers.click( function( e ) { + if ( e.target.nodeName.toLowerCase() == 'a' ) { + // The user clicked on a link inside a table header + // Do nothing and let the default link click action continue + return true; + } if ( firstTime ) { firstTime = false; @@ -594,9 +599,14 @@ // Legacy fix of .sortbottoms // Wrap them inside inside a tfoot (because that's what they actually want to be) & // and put the at the end of the
- var $sortbottoms = $table.find( 'tr.sortbottom' ); + var $sortbottoms = $table.find( '> tbody > tr.sortbottom' ); if ( $sortbottoms.length ) { - $table.append( $( '' ).append( $sortbottoms ) ) + var $tfoot = $table.children( 'tfoot' ); + if ( $tfoot.length ) { + $tfoot.eq(0).prepend( $sortbottoms ); + } else { + $table.append( $( '' ).append( $sortbottoms ) ) + } } explodeRowspans( $table ); @@ -663,12 +673,7 @@ }; return false; } - } ) - // Allow links in headers to be clicked - .find( 'a' ).click( function( e ) { - e.stopPropagation(); } ); - } ); },