From: MatmaRex Date: Thu, 11 Apr 2013 12:01:07 +0000 (+0200) Subject: jquery.makeCollapsible: minor fixes to togglingHandler() X-Git-Tag: 1.31.0-rc.0~19844^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=9d8314e09ee72f86b5227161f04e29c69f726c95;p=lhc%2Fweb%2Fwiklou.git jquery.makeCollapsible: minor fixes to togglingHandler() Documentation was not consistent with the code. Followup to Id3f457a8, per post-merge code review. Change-Id: If64b685cf697620e3b6fef797767c947f2c1f512 --- diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js index f07f1b7704..09fe06e601 100644 --- a/resources/jquery/jquery.makeCollapsible.js +++ b/resources/jquery/jquery.makeCollapsible.js @@ -150,16 +150,20 @@ * @param {jQuery.Event|null} e either the event or null if unavailable * @param {Object|undefined} options */ - function togglingHandler( $toggle, $collapsible, event, options ) { + function togglingHandler( $toggle, $collapsible, e, options ) { var wasCollapsed, $textContainer, collapseText, expandText; - if ( event ) { + if ( options === undefined ) { + options = {}; + } + + if ( e ) { // Don't fire if a link was clicked, if requested (for premade togglers by default) - if ( options.linksPassthru && $.nodeName( event.target, 'a' ) ) { - return true; + if ( options.linksPassthru && $.nodeName( e.target, 'a' ) ) { + return; } else { - event.preventDefault(); - event.stopPropagation(); + e.preventDefault(); + e.stopPropagation(); } }