Bug Tracker

Modify

Ticket #3011 (closed bug: duplicate)

Opened 5 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 5 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 5 years ago by flesler

  • Owner set to brandon
  • Component changed from core to dimensions

comment:3 Changed 4 years ago by brandon

  • Owner brandon deleted

comment:4 Changed 3 years ago by dmethvin

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

Dup of #4541 which has more discussion.

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.