Skip to main content

On The Endless Wonders Of Internet Explorer

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.

Popular posts from this blog

{position:fixed} in iOS 6

I stumbled upon this oddity when upgrading to iOS 6 while working on a mobile advertising project, and it took me a better part of the day to figure out what is going on: all of a sudden an element {position:fixed} stopped working in a correct manner (which is staying put, while the page is scrolling), and started "sticking" to the scrolling page, moving out of the viewport, and then just "jumping" back to the correct location after the scrolling was finished.If you scroll this page , you will see it—hint: that's the one labeled "broken"—assuming that you have a correct device/browser combination. Mine was iPhone4 and iOS 6.0 (6.0.1-6.1.3 behaves just the same). On the original page, where I first encountered the problem, all of my elements were created dynamically using JavaScript, but at the end of the day (literally) it become clear, that the glitch is in the iOS 6 CSS implementation.Here is what happens: if you have an element {position:fixed} whic

iLife Revisited

After several months of DV abstinence, partly caused by an unprecedented attack of GarageBand eiphoria , partly - absence of footage of any value, due to rather eventless existance, I finally decided to return to the most time consuming of all of my activities, and make a movie again. Following is a short summary of the experience. I promise to keep this rant as technically oriented, as I can, in hope, that it might be of some benefit to fellow users. During nearly half of the year, which passed since my last cinematographic endevour, there were a couple of QuickTime updates, iPhoto update, and several system and security updates. Current set-up: System: Mac OS X (10.3.6) iMovie 4.0.1 iDVD 4.0.1 QuickTime 6.2 (Pro) iMac G4 800MHz 1GB RAM Good things first: audio and video ARE in synk throughout the whole 1 hour and 39 minutes of the show. I would be thrilled, if it didn't happen before, but the good thing is that it's still there. This is about it. 1. iMovie is as sl

Who is running MacAddict forums?

I normally hate to complain, but, being a happy subscriber to the magazine for some time now, feel like I do need to express a concern about my recent experience with MacAddict forums section of the web site. Due to some server misbehavior, I had to re-register, my old profile disappeared, while I was updating it. My new profile was assign a label "n00b" (None Of Our Business, if I am not mistaken. This is some way to welcome a new member to the MacAddict community). It could've been cute, but it isn't. And I don't think, it was intended to be: from the post of "Scott": "...using tables for layout...is for lame-ass n00bs..." I have read several more posts in the "Web Design and Development" forum, which, for some reason, was for a couple of days named "George" (the name is back to normal now; but here is how forum moderator "Gipetto" reacted when he was asked about this oddity: "...poop, it blew me away tha