jQuery IE7 on-the-fly images

Posted by Scott Evernden on Stack Overflow See other posts from Stack Overflow or by Scott Evernden
Published on 2010-03-31T17:37:13Z Indexed on 2010/03/31 17:43 UTC
Read the original article Hit count: 202

Filed under:
|
|

The simplified version of the problem I am seeing in IE7 can be demonstated using FireBug Lite.

On a page loaded with jQuery, I open FireBug Lite (via bookmarket) and I enter the following:

image = $('<img src="http://example.com/boofar.jpg" border="12" 
                    width="95" height="95" title="Booya">')[0];

and the result echoed is:

<img title="Booya" contentEditable="inherit" start="fileopen" 
                    loop="1" src="http://example.com/boofar.jpg" border="12">

Where are the width and height attributes? Furthermore,

 image.width;

and

 image.attributes.width.value;

return 0 and "0".

Seen this with both jQuery 1.2.6 as well as 1.4.2. It does the right thing in IE8 and FF.

Any ideas where those attributes went? Very annoying....

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ie7