Skip to content
Snippets Groups Projects
Commit 5ea3813b authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

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.
parent 8c31bae9
No related branches found
No related tags found
No related merge requests found
...@@ -90,21 +90,21 @@ Ext.define('Docs.view.examples.InlinePreview', { ...@@ -90,21 +90,21 @@ Ext.define('Docs.view.examples.InlinePreview', {
*/ */
update: function(code) { update: function(code) {
var options = this.options; var options = this.options;
var iframe = document.getElementById(this.iframeId); var iframe = Ext.get(this.iframeId);
var callback = Ext.Function.bind(this.iframeCallback, this); var callback = Ext.Function.bind(this.iframeCallback, this);
if (iframe) { if (iframe) {
// Something is not quite ready when onload fires. // 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. // 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. // 1 ms works in Chrome, Firefox wants something bigger. Works in IE too.
iframe.onload = function() { iframe.on('load', function() {
Ext.Function.defer(function() { Ext.Function.defer(function() {
// Append newline to code, otherwise we might result in syntax error as // Append newline to code, otherwise we might result in syntax error as
// eval() doesn't like when code ends with line-comment. // 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); }, 100);
}; }, this, {single: true});
iframe.src = "eg-iframe.html"; iframe.dom.src = "eg-iframe.html";
} }
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment