Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9417 closed bug (duplicate)

dimensions are unretrievable on an element whose parent is hidden and does not have any styles set

Reported by: samuel Owned by:
Priority: low Milestone: 1.next
Component: dimensions Version: 1.6.1
Keywords: Cc:
Blocked by: #9300 Blocking:

Description

<span id="test" style="display:none;">ffffff</span> $("#test").width() OK

but <div id="mydiv" style="display:none;"> <span id="test"> ffffff</span> </div>

$("#test").width() is 0 Error

I can`t get the width when the span in a hidden div

Change History (5)

comment:1 Changed 12 years ago by Timmy Willison

Blocked by: 9300 added
Component: unfileddimensions
Priority: undecidedlow
Status: newopen
Version: 1.4.21.6.1

http://jsfiddle.net/timmywil/S8H2w/1/

It would be great if we could get this working, but it's not easy.

Related to #9300. This is different in that this element does not have a width set in its styles to retrieve as a fallback.

comment:2 Changed 12 years ago by Mike Sherov <mike.sherov@…>

I suppose instead of doing jQuery.swap() on the element itself, we could jQuery.swap all the "display:none;" parents of the element as well... that's a brute force approach, but it may work?

comment:3 Changed 12 years ago by Timmy Willison

Summary: a bug on "width()"dimensions are unretrievable on an element whose parent is hidden and does not have any styles set

comment:4 Changed 12 years ago by dmethvin

Resolution: duplicate
Status: openclosed

I think we decided this was too gruesome to handle long ago. Mike Sherov's method will often work but would potentially be very slow in the general case. I don't think we'd want to be an enabler of bad practice.

comment:5 Changed 12 years ago by dmethvin

Duplicate of #7618.

Note: See TracTickets for help on using tickets.