jquery.makeCollapsible: Use pseudo elements for square brackets around toggle
authorjdlrobson <jdlrobson@gmail.com>
Wed, 4 Apr 2018 23:12:38 +0000 (16:12 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 12 Apr 2018 16:27:32 +0000 (16:27 +0000)
We want to use this in Minerva and mixing presentation with functionality
makes styling it differently difficult.

This change will also make it easier to deal with the reflow on
initialisation (see follow up If9c8f0974e3a4b08e4a66d37f7f5adf67d7305).

Change-Id: I4d96226c63563f16ad181e06f6bd12e6cf6bec67

resources/src/jquery/jquery.makeCollapsible.css
resources/src/jquery/jquery.makeCollapsible.js

index 2e5efba..693cd7f 100644 (file)
@@ -6,6 +6,12 @@
        -ms-user-select: none;
        user-select: none;
 }
+.mw-collapsible-toggle:before {
+       content: '[';
+}
+.mw-collapsible-toggle:after {
+       content: ']';
+}
 /* Align the toggle based on the direction of the content language */
 /* @noflip */
 .mw-content-ltr .mw-collapsible-toggle,
index aa76d6d..7826bab 100644 (file)
@@ -8,7 +8,6 @@
  * @class jQuery.plugin.makeCollapsible
  */
 ( function ( $, mw ) {
-
        /**
         * Handler for a click on a collapsible toggler.
         *
                                                role: 'button',
                                                tabindex: 0
                                        } )
-                                       .prepend( '<span>[</span>' )
-                                       .append( '<span>]</span>' )
                                        .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
                        };