From: Cblair91 Date: Mon, 2 May 2016 13:46:34 +0000 (+0000) Subject: jquery.makeCollapsible: Simplify code X-Git-Tag: 1.31.0-rc.0~7131^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=1d31ea08e30b116ab4b22f8638ecee1cddf60a9b;p=lhc%2Fweb%2Fwiklou.git jquery.makeCollapsible: Simplify code Instead of using if checks, use a piping system (like in the first function). Change-Id: Ib96f9db9c56965c336ac85d9bdcf21bdbb4e9cce --- diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index 79e87316e0..bdb5ce8af3 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -153,10 +153,7 @@ */ function togglingHandler( $toggle, $collapsible, e, options ) { var wasCollapsed, $textContainer, collapseText, expandText; - - if ( options === undefined ) { - options = {}; - } + options = options || {}; if ( e ) { if ( @@ -241,9 +238,7 @@ * @chainable */ $.fn.makeCollapsible = function ( options ) { - if ( options === undefined ) { - options = {}; - } + options = options || {}; this.each( function () { var $collapsible, collapseText, expandText, $caption, $toggle, actionHandler, buildDefaultToggleLink,