diff options
Diffstat (limited to 'core/misc/tableselect.js')
-rw-r--r-- | core/misc/tableselect.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js index 52425c5628b1..cead6c011618 100644 --- a/core/misc/tableselect.js +++ b/core/misc/tableselect.js @@ -18,18 +18,18 @@ } var table = this; - var checkboxes = void 0; - var lastChecked = void 0; + var checkboxes; + var lastChecked; var $table = $(table); var strings = { selectAll: Drupal.t('Select all rows in this table'), selectNone: Drupal.t('Deselect all rows in this table') }; + var updateSelectAll = function updateSelectAll(state) { $table.prev('table.sticky-header').addBack().find('th.select-all input[type="checkbox"]').each(function () { var $checkbox = $(this); var stateChanged = $checkbox.prop('checked') !== state; - $checkbox.attr('title', state ? strings.selectNone : strings.selectAll); if (stateChanged) { @@ -50,11 +50,9 @@ $checkbox.closest('tr').toggleClass('selected', this.checked); }); - updateSelectAll(event.target.checked); } }); - checkboxes = $table.find('td input[type="checkbox"]:enabled').on('click', function (e) { $(this).closest('tr').toggleClass('selected', this.checked); @@ -63,10 +61,8 @@ } updateSelectAll(checkboxes.length === checkboxes.filter(':checked').length); - lastChecked = e.target; }); - updateSelectAll(checkboxes.length === checkboxes.filter(':checked').length); }; |