May be somebody will stumble upon this post and save some time for him/herself.
Apparently—it only become apparent after several hours of trial, cursing and error, as it usually goes with IE—, Internet Explorer (up to version 7) throws a runtime error, if you try to modify innerHTML of the dynamically created element under certain conditions.
The conditions, as it always go with IE, are significantly lacking consistent logic. For starters, if you assign innerHTML to the element before you insert it into a DOM tree, the error may not come up at all, but will surface later, when you try to modify it.
So far it looks like the error mostly comes up, if you change innerHTML of the block element inserted into inline element (which is not kosher in standard-compliant HTML, so it makes sense), and some nested block elements (like DIVs inside Ps—why is that considered wrong, too?—for instance).
So, if one really-really need to insert a division into a paragraph, and work it's innerHTML (like I did), one has to use span instead and set it's display property to block—that seems to trick IE into errorless mode.
I've put up a test page to illustrate all of the above.
Needless to say, Firefox and Safari handle all variations correctly no matter what.
P.S. I am mostly pissed because my Palm T|X had a severe crash this morning, and is currently stuck with a white screen of death (even the reset button doesn't work, damn it). Now I have to wait for the battery to drain and hope that it will reset itself after that.
P.P.S It did. Yay.
Apparently—it only become apparent after several hours of trial, cursing and error, as it usually goes with IE—, Internet Explorer (up to version 7) throws a runtime error, if you try to modify innerHTML of the dynamically created element under certain conditions.
The conditions, as it always go with IE, are significantly lacking consistent logic. For starters, if you assign innerHTML to the element before you insert it into a DOM tree, the error may not come up at all, but will surface later, when you try to modify it.
So far it looks like the error mostly comes up, if you change innerHTML of the block element inserted into inline element (which is not kosher in standard-compliant HTML, so it makes sense), and some nested block elements (like DIVs inside Ps—why is that considered wrong, too?—for instance).
So, if one really-really need to insert a division into a paragraph, and work it's innerHTML (like I did), one has to use span instead and set it's display property to block—that seems to trick IE into errorless mode.
I've put up a test page to illustrate all of the above.
Needless to say, Firefox and Safari handle all variations correctly no matter what.
P.S. I am mostly pissed because my Palm T|X had a severe crash this morning, and is currently stuck with a white screen of death (even the reset button doesn't work, damn it). Now I have to wait for the battery to drain and hope that it will reset itself after that.
P.P.S It did. Yay.