diff --git a/core/modules/simpletest/simpletest.js b/core/modules/simpletest/simpletest.js
index 6b098c1cff0e6e887845e9f12055b964f87a4ddd..70489664907e6a48cb94add5c6a76430ba4a9d97 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.