Skip to main content

Bug Tracker

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 rwaldron comment:1

component: unfiledattributes
owner: → chad.jefferies@gmail.com
status: newpending

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.

Changed February 03, 2011 10:30AM UTC by jitter comment:2

milestone: 1.next1.5.1
owner: chad.jefferies@gmail.comjitter
priority: undecidedlow
status: pendingassigned
version: 1.4.21.5

Confirmed.

test case

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 timmywil comment:3

milestone: 1.5.11.6
owner: jittertimmywil
priority: lowblocker

Fixed in attrhooks for 1.6. http://jsfiddle.net/timmywil/YB8VF/7/

Changed April 10, 2011 08:02PM UTC by timmywil comment:4

resolution: → fixed
status: assignedclosed