From add6322e5a6fda3547801d2456ce934322c2b13f Mon Sep 17 00:00:00 2001 From: Paul Nicholls Date: Mon, 24 Aug 2015 15:46:44 +1200 Subject: [PATCH] MDL-51190 javascript: Make "maximised embed" compatible with MS Edge MS Edge exhibits strange behaviour when M.util.init_maximised_embed hides the embedded document by setting its width and height to 0px. Toggling display:none instead achieves the intended goal without breaking Edge. --- lib/javascript-static.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index be47fdd5f7e..817afd189a7 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -343,8 +343,7 @@ M.util.init_maximised_embed = function(Y, id) { }; var resize_object = function() { - obj.setStyle('width', '0px'); - obj.setStyle('height', '0px'); + obj.setStyle('display', 'none'); var newwidth = get_htmlelement_size('maincontent', 'width') - 35; if (newwidth > 500) { @@ -360,13 +359,16 @@ M.util.init_maximised_embed = function(Y, id) { newheight = 400; } obj.setStyle('height', newheight+'px'); + obj.setStyle('display', ''); }; resize_object(); // fix layout if window resized too - window.onresize = function() { - resize_object(); - }; + Y.use('event-resize', function (Y) { + Y.on("windowresize", function() { + resize_object(); + }); + }); }; /**