Very odd IE iframe onresize bug, anyone seen this before?

Hello all,

I have discovered the most odd Internet Explorer bug and wonder if any of you guys have ever seen anything like this and maybe have some ideas … I had a hard time finding anything about this bug online as it’s hard to describe… I found other bugs with close keywords but not this one.

Here goes :

You have a table with an unique cell (bug present regardless of number of cells) with some element in it and an iframe. The iframe has width and height both set to percentage values (usually 100% to fit the cell).

Now, when you change in any way the className of the first element (or change src if it’s an image), the iframe’s document has its onresize event fired. That could make sense if the size of the iframe really changed, but no !
if you change the className in a mouseover handler (menu rollover for example), then the resize event is continually fired inside the iframe ! Even if you just change the background color of the element (which does not resize the element obviously).

I know iframes are not great, but I unfortunately have no choice to keep it or not …

Interesting thing, if any of the width/height attributes of the iframe are set to a fixed non percentage value, the bug goes away. Same thing if you take the iframe outside of the table.

Seems to affect IE6 IE7 and sometimes IE8 (apparently only when the file is loaded from the file:// protocol)

Here is a sample minimal page which isolates the issue : http://fs.istratov.be/iebug.html

So, any ideas / workarounds maybe ? I thought of setting width or height of the iframe with javascript to a static value everytime the parent document gets resized, but it’s a bit of a pain and I would rather avoid this if I could.

Thanks for your expertise :slight_smile:

Using a valid DTD will prevent it occuring.

You mean, a doctype ? Well, I’m out of luck here since this sh*t is part of something much bigger and if I put a doctype then it completely screws all the thing :frowning: I would love to add one though, but well …