Side navigation
#9417 closed bug (duplicate)
Opened May 25, 2011 07:10AM UTC
Closed June 08, 2011 05:38PM UTC
Last modified June 08, 2011 05:38PM UTC
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: | 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
Attachments (0)
Change History (5)
Changed May 25, 2011 02:34PM UTC by comment:1
blockedby: | → 9300 |
---|---|
component: | unfiled → dimensions |
priority: | undecided → low |
status: | new → open |
version: | 1.4.2 → 1.6.1 |
Changed May 25, 2011 08:30PM UTC by comment:2
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?
Changed June 08, 2011 01:58AM UTC by comment:3
summary: | a bug on "width()" → dimensions are unretrievable on an element whose parent is hidden and does not have any styles set |
---|
Changed June 08, 2011 05:38PM UTC by comment:4
resolution: | → duplicate |
---|---|
status: | open → closed |
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.
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.