From b1ff7f0e9b1c571ab949bccc797c688eb6d29aa0 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 7 May 2019 11:44:41 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B02192=20table-selectable-lines=20:=20repl?= =?UTF-8?q?ace=20another=20:has=20selector,=20and=20use=20existing=20const?= =?UTF-8?q?ant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/table-selectable-lines.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/table-selectable-lines.js b/js/table-selectable-lines.js index f9ecf7ada..cde78b8db 100644 --- a/js/table-selectable-lines.js +++ b/js/table-selectable-lines.js @@ -59,7 +59,7 @@ $(document).ready(function () { $lineClickedInput.click(); }); - $(document).on('change', 'table.listResults', function (event) { + $(document).on('change', TABLE_SELECTOR, function (event) { var $eventTarget = $(event.target); if (!$eventTarget.has(LINE_WITH_INPUT_IN_FIRST_CELL_SELECTOR)) // Originally we had :has in the handler selector but performances were very bad :( @@ -75,7 +75,14 @@ $(document).ready(function () { }); // check_all event is fired for tableSorter JQuery plugin - $(document).on("check_all", TABLE_SELECTOR+':has('+LINE_WITH_INPUT_IN_FIRST_CELL_SELECTOR+')', function () { + $(document).on("check_all", TABLE_SELECTOR, function () { + var $eventTarget = $(event.target); + if (!$eventTarget.has(LINE_WITH_INPUT_IN_FIRST_CELL_SELECTOR)) + // Originally we had :has in the handler selector but performances were very bad :( + // Filtering directly in JQuery is far much quicker ! => N°2192 + { + return; + } $(this).find("tbody>tr").addClass(SELECTED_CLASS); });