Skip to main content

Bug Tracker

Side navigation

#4464 closed bug (fixed)

Opened April 01, 2009 10:23AM UTC

Closed April 15, 2011 03:53AM UTC

Last modified March 09, 2012 10:14AM UTC

IE cannot get width attribute of detached IMG element

Reported by: netCo Owned by:
Priority: major Milestone: 1.6
Component: attributes Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

i have the following code:

htmltmp = '<div style="width: 1100px;"><img src="test.gif" width="300" id="testphoto" /></div>';

alert($('#testphoto', htmltmp).attr('width'));

the internet explorer shows "0" and the firefox shows the right "300".

internet explorer: 7.0.5730.13

firefox: 3.0.8

Attachments (0)
Change History (5)

Changed November 17, 2010 02:30AM UTC by dmethvin comment:1

status: newopen
summary: internet explorer can't work with contextIE cannot get width attribute of detached IMG element

http://jsfiddle.net/dmethvin/4HQtq/

Confirmed, but only occurs in IE with image elements not attached to the document. The problem is unrelated to context, it is due to the fact that jQuery prefers the image's .width property to its width attribute.

Changed March 25, 2011 06:11PM UTC by dmethvin comment:2

component: coreattributes
keywords: context
milestone: 1.41.6

This may be fixed by the attr rewrite in 1.6; need to check once that's landed.

Changed April 15, 2011 03:53AM UTC by timmywil comment:3

resolution: → fixed
status: openclosed

This bug was a little more complex than that and actually still required a special call in IE, but is fixed. Was related to #5413. http://jsfiddle.net/timmywil/4HQtq/6/

Changed August 25, 2011 02:58PM UTC by tjlawren@gmail.com comment:4

timmywil, so what was the special call required in IE? I'm experiencing the same issue, but jQuery 1.6 is not an option for me. I need to use 1.3.2.

Changed August 25, 2011 03:22PM UTC by timmywil comment:5

You can do getAttribute('width', 2)