Mutable variable access inside a callback
authorAlexander Ebert <ebert@woltlab.com>
Wed, 18 Nov 2020 19:00:04 +0000 (20:00 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 18 Nov 2020 19:00:04 +0000 (20:00 +0100)
wcfsetup/install/files/js/WCF.js

index 1d368bf745eeaab3680c534ba2d60f8819d95e37..df59bbfb5f0ab53eb91465e24fa6d332849d823a 100755 (executable)
@@ -1869,8 +1869,8 @@ if (COMPILER_TARGET_DEFAULT) {
                 * @param        array                objectIDs
                 */
                triggerEffect: function (objectIDs) {
-                       for (var $index in this._containers) {
-                               var $container = $('#' + this._containers[$index]);
+                       this._containers.forEach((function (id) {
+                               var $container = $('#' + id);
                                var $button = $container.find(this._buttonSelector);
                                if (WCF.inArray($button.data('objectID'), objectIDs)) {
                                        var self = this;
@@ -1887,7 +1887,7 @@ if (COMPILER_TARGET_DEFAULT) {
                                                }
                                        });
                                }
-                       }
+                       }).bind(this));
                }
        });