Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / resources / src / jquery / jquery.makeCollapsible.js
index 09306f6..20bd405 100644 (file)
@@ -5,7 +5,7 @@
  * familiarise yourself with that CSS before making any changes to this code.
  *
  * Dual licensed:
- * - CC BY 3.0 <http://creativecommons.org/licenses/by/3.0>
+ * - CC BY 3.0 <https://creativecommons.org/licenses/by/3.0>
  * - GPL2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
  *
  * @class jQuery.plugin.makeCollapsible
                if ( options.wasCollapsed !== undefined ) {
                        wasCollapsed = options.wasCollapsed;
                } else {
+                       // eslint-disable-next-line no-jquery/no-class-state
                        wasCollapsed = $collapsible.hasClass( 'mw-collapsed' );
                }
 
                                                }
                                        } 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
                                        $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
                        } );
 
                        // 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.