Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/67374


Change subject: Bind the history state change event after replace state
......................................................................

Bind the history state change event after replace state

This makes qunit run correctly in phantomjs, makes special
pages work again and alll the thingggs

Change-Id: I42f48f8a21dff6120e67a0e3b27147e99f4c1b29
---
M javascripts/common/history-alpha.js
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/74/67374/1

diff --git a/javascripts/common/history-alpha.js 
b/javascripts/common/history-alpha.js
index fef4e0d..6b50434 100644
--- a/javascripts/common/history-alpha.js
+++ b/javascripts/common/history-alpha.js
@@ -31,10 +31,13 @@
                // FIXME: use fuzzy link hijacking in the main namespace - core 
should be updated to make links more explicit
                var useFuzzyLinkHijacking = mw.config.get( 'wgNamespaceNumber' 
) === mw.config.get( 'wgNamespaceIds' )[''];
 
-               // Bind to StateChange Event
+               // initial history state does not contain title
+               // run before binding to avoid nasty surprises
+               History.replaceState( null, mw.config.get( 'wgTitle' ) );
+
+               // Bind to future StateChange Events
                History.Adapter.bind( window, 'statechange', function(){
                        var s = History.getState();
-
                        new Page( { title: s.title, el: $( '#content' ) } ).on( 
'error', function() {
                                window.location.reload(); // the page either 
doesn't exist or was a Special:Page so force a refresh
                        } );
@@ -100,9 +103,6 @@
 
                        hijackLinks( $( '#content_0' ), useFuzzyLinkHijacking );
                } );
-
-               // initial history state does not contain title
-               History.replaceState( null, mw.config.get( 'wgTitle' ) );
        }
 
        if ( History.enabled ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/67374
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42f48f8a21dff6120e67a0e3b27147e99f4c1b29
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to