Bug Tracker

Modify

Ticket #5728 (closed bug: duplicate)

Opened 3 years ago

Last modified 14 months ago

Cannot access IMG attributes (height, width) in IE if parent is null

Reported by: mazniak Owned by:
Priority: minor Milestone: 1.4
Component: attributes Version: 1.3.2
Keywords: dom, attributes, ie Cc:
Blocking: Blocked by:

Description

On a about:blank page, load jQuery and run the following commands:

foo = $("<img id='foo' src=' http://www.google.com/images/srpr/logo1w.png'>"); foo.attr("height", 111); console.log(foo.attr("height")); does *not* work in IE8 console.log(foo.get(0).getAttribute("height")); does return 111

The 'attr()' method does not return the expected values in IE8, but it does so in Firefox and Safari. This can be remedied by appending the IMG element to a DOM element (like 'html' or 'body') and calling 'attr()' again.

Attachments

index.html Download (825 bytes) - added by mazniak 3 years ago.
A test case for reproducing the bug.

Change History

Changed 3 years ago by mazniak

A test case for reproducing the bug.

comment:1 Changed 3 years ago by dmethvin

  • Component changed from unfiled to attributes
  • Summary changed from Cannot access some IMG attributes (height, width) while IMG element’s parent is null to Cannot access IMG attributes (height, width) in IE if parent is null

comment:2 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to duplicate

comment:3 Changed 3 years ago by snover

Duplicate of #5413.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.