Bug Tracker

Opened 12 years ago

Closed 9 years ago

#3011 closed bug (duplicate)

Dimensions fails to return dimensions when visiblity is set to hidden

Reported by: jdsharp Owned by:
Priority: major Milestone: 1.3
Component: dimensions Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description

Testing in 1.2.6 using innerWidth() on an element who's parent is visibility: hidden returns 0 in Firefox. Below are two test cases. This behavior changed in 1.2.6 with dimensions integrated into core.

http://jdsharp.us/jQuery/debug/scrollbar-1.2.6.html http://jdsharp.us/jQuery/debug/scrollbar-1.2.3-dimensions.html

Change History (4)

comment:1 Changed 12 years ago by jdsharp

I isolated the issue to how width/height calculations are different from 1.2.3+dimensions to 1.2.6. In the dimensions plugin element.clientWidth is read if the element isn't visible. In 1.2.6 the element is "shown" temporarily, the property (offsetWidth) is read, and then hidden again. The issue is that if visibility is set for a parent element the element in question won't become "visible" by merely setting the css attributes.

I'll work on a patch and see what I can come up with.

comment:2 Changed 12 years ago by flesler

Component: coredimensions
Owner: set to brandon

comment:3 Changed 11 years ago by brandon

Owner: brandon deleted

comment:4 Changed 9 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #4541 which has more discussion.

Note: See TracTickets for help on using tickets.