Commit 15b2390e authored by Dries's avatar Dries

- Patch #1684868 by nod_: JSHint simpletest.

parent ac981fcc
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment