From: Brion Vibber Date: Wed, 7 Sep 2011 22:03:16 +0000 (+0000) Subject: Followup to r86108, r86854, r96384: table sorter fetch of 'data-sort-value' attribute... X-Git-Tag: 1.31.0-rc.0~27814 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/supprimer.php?a=commitdiff_plain;h=a496d501af58cab0572868a05577603f2cd62f0b;p=lhc%2Fweb%2Fwiklou.git Followup to r86108, r86854, r96384: table sorter fetch of 'data-sort-value' attribute failed on IE 6/7 due to directly using DOM methods not available in those browsers. hasAttribute and getAttribute don't appear until IE 8 in Microsoft-land; switching to jQuery's .attr() resolves this nicely. --- diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index e7691858b8..387bf51ad4 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -76,10 +76,12 @@ } function getElementText( node ) { - if ( node.hasAttribute && node.hasAttribute( 'data-sort-value' ) ) { - return node.getAttribute( 'data-sort-value' ); + var $node = $( node ), + data = $node.attr( 'data-sort-value' ); + if ( data !== undefined ) { + return data; } else { - return $( node ).text(); + return $node.text(); } }