From 15b2390e4155b21b55749489ac0b88880054b08f Mon Sep 17 00:00:00 2001 From: Dries <dries@buytaert.net> Date: Sun, 15 Jul 2012 06:05:40 -0700 Subject: [PATCH] - Patch #1684868 by nod_: JSHint simpletest. --- core/modules/simpletest/simpletest.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/core/modules/simpletest/simpletest.js b/core/modules/simpletest/simpletest.js index 6b098c1cff0e..70489664907e 100644 --- a/core/modules/simpletest/simpletest.js +++ b/core/modules/simpletest/simpletest.js @@ -69,31 +69,27 @@ Drupal.behaviors.simpleTestSelectAll = { // Each time a single-test checkbox is checked or unchecked, make sure // that the associated group checkbox gets the right state too. - var updateGroupCheckbox = function () { + function updateGroupCheckbox() { var checkedTests = 0; for (var i = 0; i < testCheckboxes.length; i++) { - $('#' + testCheckboxes[i]).each(function () { - if (($(this).attr('checked'))) { - checkedTests++; - } - }); + if ($('#' + testCheckboxes[i]).prop('checked')) { + checkedTests++; + } } - $(groupCheckbox).attr('checked', (checkedTests === testCheckboxes.length)); - }; + $(groupCheckbox).prop('checked', (checkedTests === testCheckboxes.length)); + } // Have the single-test checkboxes follow the group checkbox. groupCheckbox.change(function () { - var checked = !!($(this).attr('checked')); + var checked = $(this).prop('checked'); for (var i = 0; i < testCheckboxes.length; i++) { - $('#' + testCheckboxes[i]).attr('checked', checked); + $('#' + testCheckboxes[i]).prop('checked', checked); } }); // Have the group checkbox follow the single-test checkboxes. for (var i = 0; i < testCheckboxes.length; i++) { - $('#' + testCheckboxes[i]).change(function () { - updateGroupCheckbox(); - }); + $('#' + testCheckboxes[i]).change(updateGroupCheckbox); } // Initialize status for the group checkbox correctly. -- GitLab