| Page 2 of 2 | [ 13 posts ] | Go to page Previous1, 2 |
Mark
|
Hi Michael,
Unfortunately that site's gone the way of the Dodo. Here's a snippet that may help you. Code: <iframe src="local.html" id="frame"></iframe> <script type="text/javascript" charset="utf-8" src="http://yui.yahooapis.com/3.1.1/build/yui/yui-min.js"></script> <script type="text/javascript"> YUI().use("node", function(Y) { var frame = Y.one('#frame'), win = Y.Node.getDOMNode(frame.get('contentWindow')), doc = win.document; YUI({ win: win, doc: doc }).use('node', function(innerY) { innerY.one('body').setStyles({ backgroundColor: 'red', color: 'white' }).append('<p>YUI3 was loaded!</p>'); }); }); </script> |
|
Hello,
I've been trying to use YUI instance with an iframe following the method described in this topic. It works in Chrome 15 and Firefox 7 and fails in IE7 and IE8. Here is part of the code: Code: ... var printFrameNode = A.Node.create('<iframe id="print_frame" width="640" height="0" frameborder="0" src="about:blank"></iframe>'); var body = A.one('body'); body.append(printFrameNode); var frame = A.Node.getDOMNode(A.one('#print_frame')); var printWin = frame.contentWindow; YUI({ win: printWin, doc: printWin.document }).use('node', function(F) { }); ... IE8 console prints that the problem is in dom-base.js file and I found out that the variable documentElement is null after this line of code: Code: var documentElement = Y.config.doc.documentElement This variable is checked for various properties in the Y.mix method that follows the initialization of the variable. I tried to create the iframe node with html element inside: Code: A.Node.create('<iframe id="print_frame" width="640" height="0" frameborder="0" src="about:blank"><!DOCTYPE html><html><head><title></title></head><body></body></html></iframe>'); But still the same error occurs. Do you have any idea for this issue? Is this a bug in YUI library? |
Juan Ignacio DopazoYUI Contributor
|
No, it's just that IE takes a little time to create the document structure in an iframe. You should give the Frame class a try.
|
| Page 2 of 2 | [ 13 posts ] | Go to page Previous1, 2 |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group