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

I Am Starting To Worry...

...generally, when the amount of money in my savings exceeds a certain number (and that's not a large number), mainly, because I expect various unpleasant events to take place. Usually, the car breaks down. Sometimes I hit something, but sometimes it breaks by itself just as well. This Tuesday I came to work, parked my Jeep, spent 9 hours at the office, went back to my Jeep and turned the ignition key. Nothing. The lights are on, though, radio works, too - I have power. So it's a fuse, or starter. I checked the fuses (found two which claimed responsibility for the starter operation), one was all right, the other one I couldn't pull out without pliers, so I decided, that it's all right, too. It looked nice from the outside. So I called AAA and asked for the tow to the dealership. The truck came in about half an hour and the driver checked my battery, confirmed that it's not it, and offered me to start my Jeep with a help of two seemingly undocumented individuals, who