aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/jquery/jquery.makeCollapsible.js
diff options
context:
space:
mode:
authorVictor Porton <porton@narod.ru>2016-06-26 16:30:54 +0300
committerBartosz DziewoƄski <matma.rex@gmail.com>2016-06-30 19:35:01 +0200
commit0eb8eeabd42dfa4af59d423d46aa5ac3d4147688 (patch)
tree58169f1031a5492ba5022a662936bb1d4e5658ab /resources/src/jquery/jquery.makeCollapsible.js
parent1025cc0228c20ad80a9d768ca6d6786020c12d62 (diff)
downloadmediawikicore-0eb8eeabd42dfa4af59d423d46aa5ac3d4147688.tar.gz
mediawikicore-0eb8eeabd42dfa4af59d423d46aa5ac3d4147688.zip
jquery.makeCollapsible: Special case of content inside <li>
Bug: T137676 Change-Id: Ie4228e63a63157e3909e938a4086f46dcbbf6767
Diffstat (limited to 'resources/src/jquery/jquery.makeCollapsible.js')
-rw-r--r--resources/src/jquery/jquery.makeCollapsible.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js
index bdb5ce8af307..501e898ebd5a 100644
--- a/resources/src/jquery/jquery.makeCollapsible.js
+++ b/resources/src/jquery/jquery.makeCollapsible.js
@@ -314,6 +314,7 @@
// If this is not a custom case, do the default: wrap the
// contents and add the toggle link. Different elements are
// treated differently.
+
if ( $collapsible.is( 'table' ) ) {
// If the table has a caption, collapse to the caption
@@ -345,6 +346,12 @@
}
}
+ } else if ( $collapsible.parent().is( 'li' ) &&
+ $collapsible.parent().children( '.mw-collapsible' ).size() === 1
+ ) {
+ // special case of one collapsible in <li> tag
+ $toggleLink = buildDefaultToggleLink();
+ $collapsible.before( $toggleLink );
} else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) {
// The toggle-link will be in the first list-item
$firstItem = $collapsible.find( 'li:first' );