use tab name, not tab index for anchors on Special:Preferences. Bug 29672 . Patch...
authorLeo Koppelkamm <diebuche@users.mediawiki.org>
Mon, 11 Jul 2011 09:54:40 +0000 (09:54 +0000)
committerLeo Koppelkamm <diebuche@users.mediawiki.org>
Mon, 11 Jul 2011 09:54:40 +0000 (09:54 +0000)
includes/HTMLForm.php
resources/mediawiki.special/mediawiki.special.preferences.js

index 975ea6c..aeec390 100644 (file)
@@ -701,7 +701,7 @@ class HTMLForm {
                                }
                                $attributes = array();
                                if ( $displayTitle ) { 
-                                       $attributes["title"] = $key; 
+                                       $attributes["title"] = Sanitizer::escapeId( $key );
                                }
                                $subsectionHtml .= Xml::fieldset( $legend, $section, $attributes ) . "\n";
                        }
index 1b2cefe..98ae253 100644 (file)
@@ -17,14 +17,15 @@ $( '#preferences' )
                                        if ( i === 0 ) {
                                                $(legend).parent().show();
                                        }
+                                       var ident = $(legend).parent().attr( 'title' );
                                        $( '#preftoc' ).append(
                                                $( '<li></li>' )
                                                        .addClass( i === 0 ? 'selected' : null )
                                                        .append(
                                                                $( '<a></a>')
                                                                        .text( $(legend).text() )
-                                                                       .attr( 'id', 'preftab-' + i + '-tab' )
-                                                                       .attr( 'href', '#preftab-' + i ) // Use #preftab-N instead of #prefsection-N to avoid jumping on click
+                                                                       .attr( 'id', 'preftab-' + ident + '-tab' )
+                                                                       .attr( 'href', '#preftab-' + ident ) // Use #preftab-N instead of #prefsection-N to avoid jumping on click
                                                                        .click( function() {
                                                                                $(this).parent().parent().find( 'li' ).removeClass( 'selected' );
                                                                                $(this).parent().addClass( 'selected' );
@@ -41,7 +42,7 @@ $( '#preferences' )
 // On document ready:
 $( function() {
        var hash = window.location.hash;
-       if( hash.match( /^#preftab-[\d]+$/ ) ) {
+       if( hash.match( /^#preftab-/ ) ) {
                var $tab = $( hash + '-tab' );
                $tab.click();
        }