From: Leo Koppelkamm Date: Mon, 11 Jul 2011 09:54:40 +0000 (+0000) Subject: use tab name, not tab index for anchors on Special:Preferences. Bug 29672 . Patch... X-Git-Tag: 1.31.0-rc.0~28939 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=0482a70d82757c16a96573767e8b81888ffad9d5;p=lhc%2Fweb%2Fwiklou.git use tab name, not tab index for anchors on Special:Preferences. Bug 29672 . Patch by Jarry1250. Ping r91757 --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 975ea6cf8d..aeec390baa 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -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"; } diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index 1b2cefe05b..98ae25325e 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -17,14 +17,15 @@ $( '#preferences' ) if ( i === 0 ) { $(legend).parent().show(); } + var ident = $(legend).parent().attr( 'title' ); $( '#preftoc' ).append( $( '
  • ' ) .addClass( i === 0 ? 'selected' : null ) .append( $( '') .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(); }