diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js index 277dbf6f6e..b904879244 100644 --- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js @@ -23,8 +23,7 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { 'use strict'; return this === undefined; }() ), - // TODO: MW test runner fires before document.body exists, so we just skip it here. - supportsContentEditable = document.body && 'contentEditable' in document.body; + supportsContentEditable = 'contentEditable' in document.createElement( 'div' ); // Parent constructor ve.init.mw.Target.call( @@ -77,12 +76,14 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { this.tabLayout = 'replace'; browserWhitelisted = ( - $.client.test( ve.init.mw.ViewPageTarget.compatibility, null, true ) || - 'vewhitelist' in currentUri.query + currentUri.query.vewhitelist !== undefined ? + currentUri.query.vewhitelist === '1' : + $.client.test( ve.init.mw.ViewPageTarget.compatibility.whitelist, null, true ) ); browserBlacklisted = ( - $.client.test( ve.init.mw.ViewPageTarget.compatibility, null, true ) || - 'veblacklist' in currentUri.query + currentUri.query.veblacklist !== undefined ? + currentUri.query.veblacklist === '1' : + $.client.test( ve.init.mw.ViewPageTarget.compatibility.blacklist, null, true ) ); // Events @@ -100,8 +101,8 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() { } ); // Initialization - if ( supportsStrictMode && supportsContentEditable && !this.browserBlacklisted ) { - if ( !this.browserWhitelisted || true ) { + if ( supportsStrictMode && supportsContentEditable && !browserBlacklisted ) { + if ( !browserWhitelisted ) { // show warning this.localNoticeMessages.push( 'visualeditor-browserwarning' ); } diff --git a/modules/ve/init/mw/ve.init.mw.Target.js b/modules/ve/init/mw/ve.init.mw.Target.js index 542a1c4611..a2812e70c5 100644 --- a/modules/ve/init/mw/ve.init.mw.Target.js +++ b/modules/ve/init/mw/ve.init.mw.Target.js @@ -175,7 +175,7 @@ ve.init.mw.Target.onLoad = function ( response ) { * @static * @method */ -ve.init.mw.Target.onNoticesReady = function() { +ve.init.mw.Target.onNoticesReady = function () { var i, len, noticeHtmls, tmp, el; // Since we're going to parse them, we might as well save these nodes @@ -195,7 +195,7 @@ ve.init.mw.Target.onNoticesReady = function() { document.body.appendChild( tmp ); // Merge locally and remotely generated notices - noticeHtmls = this.remoteNotices; + noticeHtmls = this.remoteNotices.slice( 0 ); for ( i = 0, len = this.localNoticeMessages.length; i < len; i++ ) { noticeHtmls.push( '
' + ve.init.platform.getParsedMessage( this.localNoticeMessages[i] ) + '
'