Interop differences in iframe html/body offsetHeights as reported by Chrome and Firefox
Categories
(Core :: Layout, enhancement)
Tracking
()
People
(Reporter: twisniewski, Unassigned)
References
()
Details
(Whiteboard: [webcompat])
Attachments
(1 file)
420 bytes,
text/html
|
Details |
In the attached test-case, Chrome and Firefox are reporting very different body and documentElement offsetHeights. It seems that Chrome reports the height
given in the iframes' height
attribute (150 by default on my system). Firefox reports the height of the content, but can report different values for the body
and html
where Chrome reports the same height (if body {margin:0}
) is specified.
This can cause iframes to end up being set to heights too short for their content if sites size the iframes by document.body.offsetHeight
(or scrollingElement
) rather than document.documentElement.offsetHeight
, which works in Chrome if the body is given that zero margin CSS. For instance, see the table in the site given in the bug URL (as discovered at https://webcompat.com/issues/36362)
I'm not sure what the 'correct' behavior is here, but achieving some level of interop on this seems like a good way to keep iframe-resizing scripts from being too tricky to implement, like the one this site uses (https://github.com/davidjbradshaw/iframe-resizer).
Reporter | ||
Comment 1•5 years ago
|
||
Updated•5 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 2•7 months ago
|
||
As linked webcompat issue https://webcompat.com/issues/36362 is fixed now, unsetting webcompat priority.
Description
•