Fixed WCF.Action.Delete sometimes triggering to early
authorAlexander Ebert <ebert@woltlab.com>
Sat, 13 Dec 2014 23:28:27 +0000 (00:28 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 13 Dec 2014 23:28:27 +0000 (00:28 +0100)
wcfsetup/install/files/js/WCF.js

index 59b27a1b9bb86959b80547ac6740e2db24182fd5..53c2e17198adf9a26b6ac82c1502f3422722f6ce 100755 (executable)
@@ -2822,16 +2822,19 @@ WCF.Action.Delete = Class.extend({
         * Initializes available element containers.
         */
        _initElements: function() {
-               var self = this;
-               $(this._containerSelector).each(function(index, container) {
+               $(this._containerSelector).each((function(index, container) {
                        var $container = $(container);
                        var $containerID = $container.wcfIdentify();
                        
-                       if (!WCF.inArray($containerID, self._containers)) {
-                               self._containers.push($containerID);
-                               $container.find(self._buttonSelector).click($.proxy(self._click, self));
+                       if (!WCF.inArray($containerID, this._containers)) {
+                               var $deleteButton = $container.find(this._buttonSelector);
+                               
+                               if ($deleteButton.length) {
+                                       this._containers.push($containerID);
+                                       $deleteButton.click($.proxy(this._click, this));
+                               }
                        }
-               });
+               }).bind(this));
        },
        
        /**