From 170cfecb5c05bdc8e77b930afc3fce821f301c68 Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Sun, 17 Mar 2013 11:24:18 +0100 Subject: [PATCH] (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 --- resources/jquery/jquery.makeCollapsible.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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] ) -- 2.20.1