From: MatmaRex Date: Sun, 17 Mar 2013 10:24:18 +0000 (+0100) Subject: (bug 46239) jquery.makeCollapsible: don't fail if no options given X-Git-Tag: 1.31.0-rc.0~20316 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=170cfecb5c05bdc8e77b930afc3fce821f301c68;p=lhc%2Fweb%2Fwiklou.git (bug 46239) jquery.makeCollapsible: don't fail if no options given Also a typo elsewhere. That's what you get when coding at 2 AM. Change-Id: I8dd4f0d06cc5dbf7fe67f2b584c9afe8f5d1b36a --- diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js index e8e59d006a..630002d3df 100644 --- a/resources/jquery/jquery.makeCollapsible.js +++ b/resources/jquery/jquery.makeCollapsible.js @@ -247,6 +247,10 @@ var $collapsible, collapsetext, expandtext, $toggle, $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval; + if ( options === undefined ) { + options = {}; + } + // Ensure class "mw-collapsible" is present in case .makeCollapsible() // is called on element(s) that don't have it yet. $collapsible = $(this).addClass( 'mw-collapsible' ); @@ -259,7 +263,7 @@ } // Use custom text or default? - collapsetext = options.collapsetext || $collapsible.attr( 'data-collapsetext' ) || mw.msg( 'collapsible-collapse' ); + collapsetext = options.collapseText || $collapsible.attr( 'data-collapsetext' ) || mw.msg( 'collapsible-collapse' ); expandtext = options.expandText || $collapsible.attr( 'data-expandtext' ) || mw.msg( 'collapsible-expand' ); // Create toggle link with a space around the brackets ( [text] )