Move style for #wikiPreview to mediawiki.action.edit.styles.css
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.view.redirect.js
index 52e0d4e..29a5a79 100644 (file)
@@ -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 ) {
                        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 ) {