Merge "Show a warning in edit preview when a template loop is detected"
[lhc/web/wiklou.git] / resources / src / jquery / jquery.makeCollapsible.js
index 9d3df8c..aa76d6d 100644 (file)
                if ( e ) {
                        if (
                                e.type === 'click' &&
-                               e.target.nodeName.toLowerCase() === 'a'
+                               e.target.nodeName.toLowerCase() === 'a' &&
+                               $( e.target ).attr( 'href' )
                        ) {
                                // Don't fire if a link was clicked (for premade togglers)
                                return;
 
                        // Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data).
                        buildDefaultToggleLink = function () {
-                               return $( '<span class="mw-collapsible-text"></span>' )
+                               return $( '<a class="mw-collapsible-text"></a>' )
                                        .text( collapseText )
-                                       .wrap( '<span class="mw-collapsible-toggle"></span>' ).parent()
-                                               .attr( {
-                                                       role: 'button',
-                                                       tabindex: 0
-                                               } )
-                                               .prepend( '<span>[</span>' )
-                                               .append( '<span>]</span>' )
-                                               .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
+                                       .wrap( '<span class="mw-collapsible-toggle"></span>' )
+                                       .parent()
+                                       .attr( {
+                                               role: 'button',
+                                               tabindex: 0
+                                       } )
+                                       .prepend( '<span>[</span>' )
+                                       .append( '<span>]</span>' )
+                                       .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
                        };
 
                        // Check if this element has a custom position for the toggle link