(bug 46239) jquery.makeCollapsible: don't fail if no options given
authorMatmaRex <matma.rex@gmail.com>
Sun, 17 Mar 2013 10:24:18 +0000 (11:24 +0100)
committerMatmaRex <matma.rex@gmail.com>
Sun, 17 Mar 2013 10:24:18 +0000 (11:24 +0100)
Also a typo elsewhere. That's what you get when coding at 2 AM.

Change-Id: I8dd4f0d06cc5dbf7fe67f2b584c9afe8f5d1b36a

resources/jquery/jquery.makeCollapsible.js

index e8e59d0..630002d 100644 (file)
                        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' );
                        }
 
                        // 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 (&nbsp;[text]&nbsp;)