From 01724aed550a214b375483088cda6f21608b9265 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 28 Jan 2010 14:00:12 -0700 Subject: [PATCH] id might not exist at the time iframeResize() is re-run --- imp/js/imp.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/imp/js/imp.js b/imp/js/imp.js index cf01aecb5..7ab3b4191 100644 --- a/imp/js/imp.js +++ b/imp/js/imp.js @@ -99,14 +99,15 @@ document.observe('dom:loaded', function() { IMP.iframeResize = function(id, delay) { - id = $(id); - id.setStyle({ height: Math.max(id.contentWindow.document.body.scrollHeight, id.contentWindow.document.lastChild.scrollHeight) + 'px' }); - if (!delay) { - // For whatever reason, browsers will report different heights - // after the initial height setting. Delaying a second height - // setting seems to work most of the time to fix this. - this.iframeResize.bind(this, id, true).delay(0.5); - } + if (id = $(id)) { + id.setStyle({ height: Math.max(id.contentWindow.document.body.scrollHeight, id.contentWindow.document.lastChild.scrollHeight) + 'px' }); + if (!delay) { + // For whatever reason, browsers will report different heights + // after the initial height setting. Delaying a second height + // setting seems to work most of the time to fix this. + this.iframeResize.bind(this, id, true).delay(0.5); + } + } }; // If menu is present, attach event handlers to folder switcher. -- 2.11.0