From: MatmaRex Date: Sat, 24 Nov 2012 15:54:56 +0000 (+0100) Subject: (bug 34876) improve $.makeCollapsible performance on the initial collapsing X-Git-Tag: 1.31.0-rc.0~21185^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=5feb83885885719e7db1896b4c36e51952f85bd4;p=lhc%2Fweb%2Fwiklou.git (bug 34876) improve $.makeCollapsible performance on the initial collapsing The logic for it was already present (options.instantHide), but it was slightly incorrect, causing the instant hiding not to happen under some circumstances. Unfortunately one of the circumstances was collapsed items on the watchlist, causing performance issues. Change-Id: I13313ec4930487566545ede53f25a8e67b9b9f28 --- diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js index ad156070dd..ace4a55e5d 100644 --- a/resources/jquery/jquery.makeCollapsible.js +++ b/resources/jquery/jquery.makeCollapsible.js @@ -74,26 +74,26 @@ $.fn.makeCollapsible = function () { $containers = $collapsible.find( '> tbody > tr' ); if ( $defaultToggle ) { // Exclude tablerow containing togglelink - $containers.not( $defaultToggle.closest( 'tr' ) ).stop(true, true).fadeOut(); + $containers = $containers.not( $defaultToggle.closest( 'tr' ) ); + } + + if ( options.instantHide ) { + $containers.hide(); } else { - if ( options.instantHide ) { - $containers.hide(); - } else { - $containers.stop( true, true ).fadeOut(); - } + $containers.stop( true, true ).fadeOut(); } } else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) { $containers = $collapsible.find( '> li' ); if ( $defaultToggle ) { // Exclude list-item containing togglelink - $containers.not( $defaultToggle.parent() ).stop( true, true ).slideUp(); + $containers = $containers.not( $defaultToggle.parent() ); + } + + if ( options.instantHide ) { + $containers.hide(); } else { - if ( options.instantHide ) { - $containers.hide(); - } else { - $containers.stop( true, true ).slideUp(); - } + $containers.stop( true, true ).slideUp(); } } else { @@ -111,10 +111,14 @@ $.fn.makeCollapsible = function () { // Otherwise assume this is a customcollapse with a remote toggle // .. and there is no collapsible-content because the entire element should be toggled } else { - if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) { - $collapsible.fadeOut(); + if ( options.instantHide ) { + $collapsible.hide(); } else { - $collapsible.slideUp(); + if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) { + $collapsible.fadeOut(); + } else { + $collapsible.slideUp(); + } } } }