From f2e25f60972772224db5e6f6313a28d3564ccf8a Mon Sep 17 00:00:00 2001 From: Dries <dries@buytaert.net> Date: Tue, 8 Jan 2013 12:00:40 -0500 Subject: [PATCH] - Issue #1880798 by droplet: Fixed tableselect.js performances. --- core/misc/tableselect.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js index 36af8647d4b1..cf294046852d 100644 --- a/core/misc/tableselect.js +++ b/core/misc/tableselect.js @@ -11,7 +11,7 @@ Drupal.behaviors.tableSelect = { Drupal.tableSelect = function () { // Do not add a "Select all" checkbox if there are no rows with checkboxes in the table - if ($(this).find('td input:checkbox').length === 0) { + if ($(this).find('td input[type="checkbox"]').length === 0) { return; } @@ -21,7 +21,7 @@ Drupal.tableSelect = function () { var strings = { 'selectAll': Drupal.t('Select all rows in this table'), 'selectNone': Drupal.t('Deselect all rows in this table') }; var updateSelectAll = function (state) { // Update table's select-all checkbox (and sticky header's if available). - $table.prev('table.sticky-header').andSelf().find('th.select-all input:checkbox').each(function() { + $table.prev('table.sticky-header').andSelf().find('th.select-all input[type="checkbox"]').each(function() { $(this).attr('title', state ? strings.selectNone : strings.selectAll); this.checked = state; }); @@ -29,7 +29,7 @@ Drupal.tableSelect = function () { // Find all <th> with class select-all, and insert the check all checkbox. $table.find('th.select-all').prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).click(function (event) { - if ($(event.target).is('input:checkbox')) { + if ($(event.target).is('input[type="checkbox"]')) { // Loop through all checkboxes and set their state to the select all checkbox' state. checkboxes.each(function () { this.checked = event.target.checked; @@ -42,7 +42,7 @@ Drupal.tableSelect = function () { }); // For each of the checkboxes within the table that are not disabled. - checkboxes = $table.find('td input:checkbox:enabled').click(function (e) { + checkboxes = $table.find('td input[type="checkbox"]:enabled').click(function (e) { // Either add or remove the selected class based on the state of the check all checkbox. $(this).closest('tr').toggleClass('selected', this.checked); @@ -75,7 +75,7 @@ Drupal.tableSelectRange = function (from, to, state) { $i = $(i); // Either add or remove the selected class based on the state of the target checkbox. $i.toggleClass('selected', state); - $i.find('input:checkbox').attr('checked', state); + $i.find('input[type="checkbox"]').attr('checked', state); if (to.nodeType) { // If we are at the end of the range, stop. -- GitLab