From: Alexander Ebert Date: Fri, 10 Feb 2012 19:55:44 +0000 (+0100) Subject: Optimized WCF.Collapsible.Simple X-Git-Tag: 2.0.0_Beta_1~1355^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ec161ab28a4f421a73b6293ffaaac8096ee3fdc8;p=GitHub%2FWoltLab%2FWCF.git Optimized WCF.Collapsible.Simple --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 8e13577f13..32737b7132 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -2538,7 +2538,7 @@ WCF.Collapsible.Simple = { if (!$isOpen) { // hide container on init - $($button.data('collapsibleContainer')).hide(); + $('#' + $button.data('collapsibleContainer')).hide(); } $button.click($.proxy(this._toggle, this)); @@ -2550,11 +2550,7 @@ WCF.Collapsible.Simple = { * @param object event */ _toggle: function(event) { - var $button = this._findElement($(event.target)); - if ($button === false) { - return false; - } - + var $button = $(event.currentTarget); var $isOpen = $button.data('isOpen'); var $target = $('#' + $.wcfEscapeID($button.data('collapsibleContainer'))); @@ -2591,26 +2587,6 @@ WCF.Collapsible.Simple = { if ($image.length) { $image.attr('src', $icon); } - }, - - /** - * Finds the anchor element (sometimes the image will show up as target). - * - * @param jQuery element - * @return jQuery - */ - _findElement: function(element) { - if (element.getTagName() == 'a') { - return element; - } - - element = $(element.parent('a')); - if (element.length == 1) { - return element; - } - - console.debug('[WCF.Collapsible.Simple] Could not find valid parent, aborting.'); - return false; } };