(bug 41792) Fix Special:Preferences tabs in IE8 compatibility mode
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 20 Nov 2012 16:47:04 +0000 (11:47 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 20 Nov 2012 16:47:04 +0000 (11:47 -0500)
It seems that IE8 lies about supporting "onhashchange" with the standard
feature test when in compatibility mode. So, sadly, we must add in an
explicit browser check if we want this to work.

Change-Id: Ib2c1b150acd0a0b5b16604e8623d6aa78017a9a0

resources/mediawiki.special/mediawiki.special.preferences.js

index 989a986..d8d092b 100644 (file)
@@ -79,7 +79,10 @@ jQuery( document ).ready( function ( $ ) {
        // <a href="#.."> will naturally set the hash, handled by onhashchange.
        // But other things that change the hash will also be catched (e.g. using
        // the Back and Forward browser navigation).
-       if ( 'onhashchange' in window ) {
+       // Note the special check for IE "compatibility" mode.
+       if ( 'onhashchange' in window &&
+               ( document.documentMode === undefined || document.documentMode >= 8 )
+       ) {
                $(window).on( 'hashchange' , function () {
                        var hash = window.location.hash;
                        if ( hash.match( /^#mw-prefsection-[\w\-]+/ ) ) {