JGonera has uploaded a new change for review.
https://gerrit.wikimedia.org/r/81012
Change subject: Don't use document.body
......................................................................
Don't use document.body
Can't be trusted, is null in some cases.
Bug: 52361
Bug: 53282
Change-Id: Ifb45718a29b8d3147be483349b30a4bc080604d6
---
M javascripts/common/Overlay.js
M tests/javascripts/common/test_Overlay.js
2 files changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/12/81012/1
diff --git a/javascripts/common/Overlay.js b/javascripts/common/Overlay.js
index f3c79f5..339bd57 100644
--- a/javascripts/common/Overlay.js
+++ b/javascripts/common/Overlay.js
@@ -11,7 +11,7 @@
className: 'mw-mf-overlay',
closeOnBack: false,
// use document.body rather than 'body' - for some reasons this
has odd consequences on Opera Mobile (see bug 52361)
- appendTo: document.body,
+ appendTo: '#mw-mf-viewport',
initialize: function( options ) {
var self = this;
options = options || {};
diff --git a/tests/javascripts/common/test_Overlay.js
b/tests/javascripts/common/test_Overlay.js
index a216fbb..8ef9925 100644
--- a/tests/javascripts/common/test_Overlay.js
+++ b/tests/javascripts/common/test_Overlay.js
@@ -5,7 +5,7 @@
QUnit.test( 'Simple overlay', 1, function() {
var overlay = new Overlay( { heading: '<h2>Title</h2>', content: 'Text'
} );
overlay.show();
- strictEqual( overlay.$el[0].parentNode, document.body, 'In DOM' );
+ strictEqual( overlay.$el[0].parentNode, $( '#mw-mf-viewport' )[0], 'In
DOM' );
overlay.hide();
} );
@@ -40,7 +40,7 @@
// now close the top stacked one...
overlayTwo.$( '.cancel' ).trigger( 'tap' );
strictEqual( overlayTwo.$el[0].parentNode, null, 'No longer in DOM' );
- strictEqual( overlay.$el[0].parentNode, document.body, 'Still in DOM' );
+ strictEqual( overlay.$el[0].parentNode, $( '#mw-mf-viewport' )[0],
'Still in DOM' );
strictEqual( $( 'html' ).hasClass( 'overlay-enabled' ), true, 'Still in
overlay mode' );
overlay.hide();
} );
--
To view, visit https://gerrit.wikimedia.org/r/81012
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb45718a29b8d3147be483349b30a4bc080604d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: JGonera <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits