Closed
Bug 684197
Opened 13 years ago
Closed 10 years ago
Hidden iframe is not able to calculate the content's scrollHeight
Categories
(Core :: DOM: CSS Object Model, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mail, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.865.0 Safari/535.2 Steps to reproduce: Created an iframe with the CSS property display set to 'none'. Tried to calculate the scollHeight of the content's (src) body. Example: http://jsfiddle.net/2X5FU/1/ (see console log messages returning the heights of a hidden and visible iframe) Actual results: Returns 0 instead of the actual height. Expected results: Return the actual height of the document.body of the iframe src. Webkit-browsers and Internet Explorer does return the actual height.
Updated•10 years ago
|
Component: General → DOM: CSS Object Model
Product: Firefox → Core
![]() |
||
Comment 1•10 years ago
|
||
We don't perform layout in display:none iframes, because there is no sane way to do it: a display:none iframe has no dimensions, but the sizes of things inside it depend on the dimensions of the iframe.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Comment 2•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #1) > We don't perform layout in display:none iframes, because there is no sane > way to do it: a display:none iframe has no dimensions, but the sizes of > things inside it depend on the dimensions of the iframe. Sorry Boris but I don't get the point. I can understand that you don't want to spend time in layout of something that is not going to be displayed but (from MDN) "The Element.scrollHeight read-only attribute is a measurement of the height of an element's content including content not visible on the screen due to overflow." If the iframe has size 0x0 all its content is overflowing. In my use-case I want to resize the iframe (in the onload event) on a size based on the scrollWidth and scrollHeight of some elements of the content even if it has "display: none" or some of its parents have "display: none" because they might become visible at some point in the future (and I'd like to resize it onload as I'm writing a library and I have no control over when the element is made visible). Could you clearify better why you won't fix this, or reopen it ?
You need to log in
before you can comment on or make changes to this bug.
Description
•