Ticket #5413 (closed bug: fixed)
tag "img" width/height attribute is zero (IE)
| Reported by: | Ammon | Owned by: | timmywil |
|---|---|---|---|
| Priority: | low | Milestone: | 1.6 |
| Component: | attributes | Version: | 1.5.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
When img tag is hidden (style is "display:none" or contain in a div that has style is "display:none"), use the attr function to get the width/height will return zero, not the actually width/height attribute in img tag.
Attachments
Change History
comment:2 Changed 3 years ago by snover
- Priority changed from major to low
- Status changed from new to open
- Version changed from 1.3.2 to 1.4.3
- Milestone 1.4 deleted
This is caused by .attr using DOM properties instead of HTML attributes. test case
comment:4 Changed 2 years ago by timmywil
- Owner set to timmywil
- Status changed from open to assigned
- Version changed from 1.4.3 to 1.5.2
- Milestone set to 1.6
Even though attrHooks uses getAttribute and fixed this in certain browsers test case with attrhooks, this was still a problem for ie6 and 7. However, an update has been added to fix the issue in the pull request. Commit 45a7f63e1ff90cc15dfde7d9a7df7dc62690c6b1
comment:5 Changed 2 years ago by timmywil
Much shorter solution https://github.com/timmywil/jquery/commit/d0e457c8b70b2e21962cc8cb29d06ab2e16c8ba2
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

