aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap/studip_helper_attributes.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/assets/javascripts/bootstrap/studip_helper_attributes.js')
-rw-r--r--resources/assets/javascripts/bootstrap/studip_helper_attributes.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/resources/assets/javascripts/bootstrap/studip_helper_attributes.js b/resources/assets/javascripts/bootstrap/studip_helper_attributes.js
index 54f8da3..0ea34bf 100644
--- a/resources/assets/javascripts/bootstrap/studip_helper_attributes.js
+++ b/resources/assets/javascripts/bootstrap/studip_helper_attributes.js
@@ -298,24 +298,24 @@ $(document).on('keydown', '.enter-accessible', function(event) {
$(document).on('click keydown', '[data-toggles]', function (event) {
if ((event.type === 'keydown' && event.key === 'Enter') || event.type === 'click') {
- const target = event.currentTarget.dataset.toggles;
- //Check if the target is a checkbox. These have to be toggled differently than
- //other elements:
+ const target = this.dataset.toggles;
+ // Check if the target is a checkbox. These have to be toggled differently than
+ // other elements:
if ($(target).is(':checkbox')) {
- //Toggle the checked state of the checkbox:
+ // Toggle the checked state of the checkbox:
$(target).prop('checked', !$(target).prop('checked'));
} else {
- //Do the normal toggle operation:
+ // Do the normal toggle operation:
$(target).toggle();
}
- const controls = $(event.currentTarget).attr('aria-controls');
+ const controls = $(this).attr('aria-controls');
if (controls) {
// Find elements which control the expanded status of the same element.
const elements = $('[aria-controls="' + controls + '"]');
- const expanded = $(event.currentTarget).attr('aria-expanded') === 'true';
+ const expanded = $(this).attr('aria-expanded') === 'true';
// Set the aria-expanded status accordingly.
- elements.attr('aria-expanded', !expanded);
+ elements.attr('aria-expanded', expanded ? 'false' : 'true');
}
event.preventDefault();