From ec161ab28a4f421a73b6293ffaaac8096ee3fdc8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 10 Feb 2012 20:55:44 +0100 Subject: [PATCH] Optimized WCF.Collapsible.Simple --- wcfsetup/install/files/js/WCF.js | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) 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; } }; -- 2.20.1