#7693 closed bug (duplicate)
outerHeight is broken for hidden block's immediate child
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.6 |
Component: | dimensions | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Code sample: http://pastebin.com/QgYn10ka
I've got 3 blocks A>B>C. C has height of 300px and margins of 10px on all sides.
B is hidden via .css('display', 'none'); then C's outerHeight() is calculated.
outerHeight() gives correct answer (300 for specified example), but outerHeight(true) gives incorrect answer (20 for specified example, expected 320 = 300 + 10 * 2).
Change History (8)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Component: | unfiled → dimensions |
---|---|
Keywords: | needsreview added |
Priority: | undecided → low |
Status: | new → open |
test case this seems to be valid. It looks like this happens because of the intricate logic to retrieve the dimension of hidden elements.
Hint on internal cause: getWH()
returning 0 for outerHeight()
but 20 for outerHeight(true)
if a margin of 10px is set. This behavior has drastically influences the behavior of the get cssHook for width/height (see the val <= 0
check).
This ticket also relates to #7618 as the reason the "css rule value" is returned instead of the computed value has to do with the same pieces of code.
But one question remains open, I can't find anywhere the jQuery states to support innerHeight/Width, outerHeight/Width(true/false) on hidden elements. The release notes say width()/height()
are supported.
comment:4 follow-up: 5 Changed 13 years ago by
Replying to anonymous:
Seems to affect webkit (only) ?
AND if the block contains am <img> without height/width styling.
- but not always. Mostly it works as expected. Very strange..
comment:5 Changed 13 years ago by
Replying to anonymous:
Replying to anonymous:
Seems to affect webkit (only) ?
AND if the block contains am <img> without height/width styling.
- but not always. Mostly it works as expected. Very strange..
No, sorry. It IS consistent and affects both Mozilla and Webkit (at least): If the block with overflow:hidden contains an image with out explicit height, and outerHeight() is called during document.ready, the image's height isn't included - which is understandable, but should be mentioned in the API-page for outerHeight()
comment:6 Changed 13 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
comment:8 Changed 13 years ago by
Keywords: | needsreview removed |
---|
Also, here is jsFiddle'd demo: http://jsfiddle.net/pu5Je/