From 5ea3813b1519068f6660b235a63dc6a63217ee4e Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Fri, 11 May 2012 11:43:34 +0300 Subject: [PATCH] Fix inline examples in IE8. Using Ext.Element#on to attach load event handler to iframe element. Assigning handler directly to iframe.onload didn't work in IE8. I'm sure it also fixes the same problem in IE7 (at least it does so in IE7-mode of IE8), and the fix itself is just applying the right way of doing things. --- template/app/view/examples/InlinePreview.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/template/app/view/examples/InlinePreview.js b/template/app/view/examples/InlinePreview.js index a743782c..33668f20 100644 --- a/template/app/view/examples/InlinePreview.js +++ b/template/app/view/examples/InlinePreview.js @@ -90,21 +90,21 @@ Ext.define('Docs.view.examples.InlinePreview', { */ update: function(code) { var options = this.options; - var iframe = document.getElementById(this.iframeId); + var iframe = Ext.get(this.iframeId); var callback = Ext.Function.bind(this.iframeCallback, this); if (iframe) { // Something is not quite ready when onload fires. // I'm unsure what I should wait for. So I'm currently adding just this nasty delay. // 1 ms works in Chrome, Firefox wants something bigger. Works in IE too. - iframe.onload = function() { + iframe.on('load', function() { Ext.Function.defer(function() { // Append newline to code, otherwise we might result in syntax error as // eval() doesn't like when code ends with line-comment. - iframe.contentWindow.loadInlineExample(code+"\n", options, callback); + iframe.dom.contentWindow.loadInlineExample(code+"\n", options, callback); }, 100); - }; - iframe.src = "eg-iframe.html"; + }, this, {single: true}); + iframe.dom.src = "eg-iframe.html"; } }, -- GitLab