Side navigation
#8150 closed bug (fixed)
Opened February 02, 2011 09:53PM UTC
Closed April 10, 2011 08:02PM UTC
Last modified March 09, 2012 09:33AM UTC
removeAttr issue in webkit, firefox
Reported by: | chad.jefferies@gmail.com | Owned by: | timmywil |
---|---|---|---|
Priority: | blocker | Milestone: | 1.6 |
Component: | attributes | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When scrolled to a point in a page, anywhere below the top and removeAttr("width") or removeAttr("height") is called on an img element, it forces the page to scroll to the top or near the top. Calling the DOM method removeAttribute on the same element does not cause this behavior. The image of course should be the same width and height of the attribute values, so that when the attributes are removed, the image element itself does not adjust.
This happens in the following browsers on a windows xp system:
Chrome 8.0.552.237
Firefox 3.6.11
Safari 5.0 (7533.16)
IE6 :(
Attachments (0)
Change History (4)
Changed February 02, 2011 09:56PM UTC by comment:1
component: | unfiled → attributes |
---|---|
owner: | → chad.jefferies@gmail.com |
status: | new → pending |
Changed February 03, 2011 10:30AM UTC by comment:2
milestone: | 1.next → 1.5.1 |
---|---|
owner: | chad.jefferies@gmail.com → jitter |
priority: | undecided → low |
status: | pending → assigned |
version: | 1.4.2 → 1.5 |
Confirmed.
This happens because .removeAttr
calls .attr( "height", "" )
before removing the attribute (due some IE bugs). Which in this case basically causes the image height to be 0px
for a very short amount of time before the height attribute is removed. Short but long enough for some browsers to reflow the page and jumping to top of the page.
In Chrome, for me, it even breaks scrolling the page after having hit .removeAttr("height")
.
Changed March 31, 2011 07:06AM UTC by comment:3
milestone: | 1.5.1 → 1.6 |
---|---|
owner: | jitter → timmywil |
priority: | low → blocker |
Fixed in attrhooks for 1.6. http://jsfiddle.net/timmywil/YB8VF/7/
Changed April 10, 2011 08:02PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | assigned → closed |
Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!
Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.