From 441711eda9b7b38bb4c17bcdd25dd75e0ac82634 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 8 Mar 2019 15:30:27 +0000 Subject: [PATCH] jquery.tablesorter: Remove dead node check in getElementSortKey() In 2012, commit 39d1f3967be9d added special handling image elements, and for Cite references. This inadvertently broke handling of sorting for tables with colspanned cells, which have node = undefined in the cache. In 2013, commit e203fdfc74f18 restored handling of node = undefined. In 2015, commit 7a5f4e46d10ea made colspan expanded in the cache just as rowspan was already. Thus making this code dead. It's odd to see $(node) before this check, and even a call within this conditional. This worked, as long way to return ''. Change-Id: Ia823a3ec29371be39fab3d626ed8647ee469951b --- resources/src/jquery.tablesorter/jquery.tablesorter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/src/jquery.tablesorter/jquery.tablesorter.js b/resources/src/jquery.tablesorter/jquery.tablesorter.js index 6107af1883..a5a1783601 100644 --- a/resources/src/jquery.tablesorter/jquery.tablesorter.js +++ b/resources/src/jquery.tablesorter/jquery.tablesorter.js @@ -59,6 +59,10 @@ return false; } + /** + * @param {HTMLElement} node + * @return {string} + */ function getElementSortKey( node ) { var $node = $( node ), // Use data-sort-value attribute. @@ -71,9 +75,6 @@ // like charAt, toLowerCase and split are expected. return String( data ); } - if ( !node ) { - return $node.text(); - } if ( node.tagName.toLowerCase() === 'img' ) { return $node.attr( 'alt' ) || ''; // handle undefined alt } -- 2.20.1