Side navigation
#9945 closed bug (wontfix)
Opened August 01, 2011 02:27AM UTC
Closed December 29, 2012 10:46PM UTC
Last modified December 29, 2012 10:49PM UTC
Percentage Width Elements in Hidden Divs
Reported by: | kgorsky | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | css | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Lets say you have an element with a css width of 94%.
And lets say you put that element inside a div with the css display value of "none".
When you call width() on the first element, you are returned a pixel value based on the percent, ie, 94px.
Attachments (0)
Change History (19)
Changed August 01, 2011 02:42AM UTC by comment:1
component: | unfiled → css |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
Changed August 01, 2011 02:43AM UTC by comment:2
resolution: | invalid |
---|---|
status: | closed → reopened |
Changed August 01, 2011 02:43AM UTC by comment:3
resolution: | → duplicate |
---|---|
status: | reopened → closed |
Changed August 01, 2011 02:49AM UTC by comment:5
Replying to [comment:1 rwaldron]:
jQuery intentionally normalizes all css property values to pixel units
If you look the example in the link I gave, the actual width that should be returned is not 94px.
When the parent element is hidden, jQuery returns the percentage value (ie, 94%) as a pixel value (ie, 94px) even though the ACTUAL width may be 300px.
Changed August 01, 2011 03:01AM UTC by comment:6
resolution: | duplicate |
---|---|
status: | closed → reopened |
Thanks for the heads up.
Confirmed, further reduced: http://jsfiddle.net/rwaldron/xTgvF/
Changed August 01, 2011 03:02AM UTC by comment:7
status: | reopened → open |
---|
Changed August 01, 2011 03:02AM UTC by comment:8
milestone: | None → 1.7 |
---|---|
priority: | low → high |
Changed October 14, 2011 11:16PM UTC by comment:9
so, this comes down to just returning a value like null,false,undefined, or 0 when a unit other than px is specified on a child of a hidden div.
Question is, what value should it return?
Changed October 18, 2011 03:35AM UTC by comment:10
yeah, percentage values for any of width,padding,margin,or border will result in the answer being goofy. If any of them contain percentages, the whole calculation should report 0.
This is also a needsdocs.
Very similar to #10117
Changed October 24, 2011 04:26PM UTC by comment:11
milestone: | 1.7 → 1.next |
---|---|
owner: | → timmywil |
status: | open → assigned |
Per meeting, pushing this until we have time to refactor.
Changed June 21, 2012 03:08PM UTC by comment:12
#11944 is a duplicate of this ticket.
Changed October 10, 2012 02:43AM UTC by comment:13
Hello ! Are you still working on this bug ?
Changed October 21, 2012 11:17PM UTC by comment:14
We need a solution for this bug, please help us!
Changed October 22, 2012 05:38PM UTC by comment:15
owner: | timmywil |
---|---|
status: | assigned → open |
Changed November 02, 2012 04:12AM UTC by comment:16
I'm going to look at this issue, but wanted to touch base with anyone who might have made progress here or has any insight before I do.
Changed November 08, 2012 04:57AM UTC by comment:17
Pull request:
Changed December 29, 2012 10:46PM UTC by comment:18
resolution: | → wontfix |
---|---|
status: | open → closed |
There is no good answer here for this bug, and it's not a good practice to be querying hidden elements for height/width info anyway. I'm going to close this as wontifx and open a docs issue.
Changed December 29, 2012 10:49PM UTC by comment:19
Docs issue here: https://github.com/jquery/api.jquery.com/issues/197
jQuery intentionally normalizes all css property values to pixel units