makeCollapsible: fix state of nested collapsibles
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Tue, 8 May 2018 20:46:56 +0000 (22:46 +0200)
committerJdlrobson <jrobson@wikimedia.org>
Thu, 10 May 2018 00:00:21 +0000 (00:00 +0000)
When collapsing or expanding an element which has nested other
collapsibles, the labels of all nested toggles were updating to the
value of the parent, while their state was not.

Apply to the specific toggle only, just as the classes are applied to
just the specific toggle.

Bug: T168689
Change-Id: I1c3c29dc9ca4ccbf8da83796e56964a7a6d58a81

resources/src/jquery/jquery.makeCollapsible.js

index e355196..c3d7dbf 100644 (file)
                        collapseText = options.toggleText.collapseText;
                        expandText = options.toggleText.expandText;
 
-                       $textContainer = $collapsible.find( '.mw-collapsible-text' );
+                       $textContainer = $toggle.find( '.mw-collapsible-text' );
                        if ( $textContainer.length ) {
                                $textContainer.text( wasCollapsed ? collapseText : expandText );
                        }