X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fsrc%2Fmediawiki.action%2Fmediawiki.action.view.redirect.js;h=29a5a79f9bdd0595420aae0e15eb1d89b36b9ec4;hb=f38e4d61ec113c9bb016c47b12268999980cd982;hp=52e0d4e3d21d33bc6f519cf024f69eebe97e0810;hpb=4e8930d78ca0cf006fe8b59eba2bae71ed340ddc;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.action/mediawiki.action.view.redirect.js b/resources/src/mediawiki.action/mediawiki.action.view.redirect.js index 52e0d4e3d2..29a5a79f9b 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.redirect.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.redirect.js @@ -9,10 +9,7 @@ var profile = $.client.profile(), canonical = mw.config.get( 'wgInternalRedirectTargetUrl' ), fragment = null, - shouldChangeFragment, index; - - // Clear internal mw.config entries, so that no one tries to depend on them - mw.config.set( 'wgInternalRedirectTargetUrl', null ); + node, shouldChangeFragment, index; index = canonical.indexOf( '#' ); if ( index !== -1 ) { @@ -30,12 +27,15 @@ canonical += location.hash; } - // This will also cause the browser to scroll to given fragment + // Note that this will update the hash in a modern browser, retaining back behaviour history.replaceState( /*data=*/ history.state, /*title=*/ document.title, /*url=*/ canonical ); - - // …except for IE 10 and 11. Prod it with a location.hash change. - if ( shouldChangeFragment && profile.name === 'msie' && profile.versionNumber >= 10 ) { - location.hash = fragment; + if ( shouldChangeFragment ) { + // Specification for history.replaceState() doesn't require browser to scroll, + // so scroll to be sure (see also T110501). Support for IE9 and IE10. + node = document.getElementById( fragment.slice( 1 ) ); + if ( node ) { + node.scrollIntoView(); + } } } else if ( shouldChangeFragment ) {