| Page 1 of 1 | [ 9 posts ] |
|
Hi,
I am trying to insert a bunch of rows into a tables tbody using node.set('innerHTML', stuff). It works fine in FF4 and Chrome, but IE7 through IE9 all complain that the target is invalid. IE10 preview doesn't like it either. You can see it happen here http://www.lexius.co.uk/cms/index.php?o ... howCourses. The script is called yui_training.js In IE the loading spinner never gets replaced with data that was retrieved from the server. I have tried debugging in Microsofts browser developer tool, but I can't get breakpoints to work. It's does break on the error though. Has anyone else encountered anything similar? TIA, Nick |
Juan Ignacio DopazoYUI Contributor
|
Have you tried node.setContent()?
|
|
Hi Juan,
Thanks for the suggestion. I just changed my node.set("innerHTML", stuff) to node.setContent(stuff) but it still gives the same results. It works in all browsers except IE (any version including IE10 preview). Nick |
Alberto SantiniYUI Contributor
|
Hello Nick.
It seems the following line in loadPage() throws the error: Y.one('#training_form #courses').set("innerHTML", loadingMsg); Using Juan's suggestion it seems it works nice: Y.one('#training_form #courses').setContent(loadingMsg); Hope that helps, Alberto P.S.: Generally speaking, you can switch to raw or debug YUI code and inspect the call stack with a debugger to investigate the issue. |
|
Alberto,
I reduced the problem to just one line of js embeded in html and you can see it here: http://jsfiddle.net/nickweavers/gGEh3/ If you show this page in IE9 or IE8 and click run it will not execute. If you do the same in Chrome, FF or Opera it will. This example uses pure JS so I think this is just a bug in the MS javascript processor. |
Juan Ignacio DopazoYUI Contributor
|
Yeah, it doesn't work with pure JS either because of IE. IE usually throws an error when you try to insert malformed HTML via innerHTML. It does the same when you try insert a node into a parent that doesn't accept it (for example, a <tr> inside a <table>, not a <tbody>) either with innerHTML or appendChild.
In my IE9 browser setContent() worked fine. I guessed it did because it was creating a node and attaching it instead of just using innerHTML. Does this work for you? http://jsfiddle.net/juandopazo/9vY8Z/2/ |
|
Thanks Juan and Alberto,
I have to fes up - I had forgotten to turn the Y.one('#training_form #courses').set("innerHTML", loadingMessage) that comes before the fetching and loading of rows into a Y.one('#training_form #courses').setContent(loadingMessage). Alberto had pointed this out, but it didn't register as I was fixated on the insertion of rows. |
Juan Ignacio DopazoYUI Contributor
|
LOL Take a look at today's post in the IEBlog:
Quote: Interoperable innerHTML These improvements apply to innerHTML too. Code patterns like these now work as you’d expect in IE10: Code: var select = document.createElement("select"); select.innerHTML = "<option>one</option><option>two</option>"; var table = document.createElement("table"); table.innerHTML = "<tr><td>one</td><td>two</td></tr>"; |
|
Yey! how uncanny is the timing of that
|
| Page 1 of 1 | [ 9 posts ] |
| 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