X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fjquery%2Fjquery.makeCollapsible.js;h=20bd405038e6f145fbe867c864601fd11aee25d9;hb=689d07b81d7271eeeae95b6508be9dd952399679;hp=f5f047503d0fd4fea1c5053331b95670f6aa699d;hpb=5bba9d230c25759c616cefe326fcb37cb4405d84;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index f5f047503d..20bd405038 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -5,7 +5,7 @@ * familiarise yourself with that CSS before making any changes to this code. * * Dual licensed: - * - CC BY 3.0 + * - CC BY 3.0 * - GPL2 * * @class jQuery.plugin.makeCollapsible @@ -82,7 +82,6 @@ } } - // eslint-disable-next-line jquery/no-animate-toggle $containers.toggle( action === 'expand' ); hookCallback(); } @@ -123,6 +122,7 @@ if ( options.wasCollapsed !== undefined ) { wasCollapsed = options.wasCollapsed; } else { + // eslint-disable-next-line no-jquery/no-class-state wasCollapsed = $collapsible.hasClass( 'mw-collapsed' ); } @@ -271,7 +271,7 @@ } } else { // The toggle-link will be in one of the cells (td or th) of the first row - $firstItem = $collapsible.find( 'tr:first th, tr:first td' ); + $firstItem = $collapsible.find( 'tr' ).first().find( 'th, td' ); $toggle = $firstItem.find( '> .mw-collapsible-toggle' ); // If theres no toggle link, add it to the last cell @@ -289,7 +289,7 @@ $collapsible.before( $toggle ); } else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) { // The toggle-link will be in the first list-item - $firstItem = $collapsible.find( 'li:first' ); + $firstItem = $collapsible.find( 'li' ).first(); $toggle = $firstItem.find( '> .mw-collapsible-toggle' ); // If theres no toggle link, add it @@ -339,6 +339,7 @@ } ); // Initial state + // eslint-disable-next-line no-jquery/no-class-state if ( options.collapsed || $collapsible.hasClass( 'mw-collapsed' ) ) { // One toggler can hook to multiple elements, and one element can have // multiple togglers. This is the sanest way to handle that.