Open Bug 1577904 Opened 5 years ago Updated 3 days ago

Interop differences in iframe html/body offsetHeights as reported by Chrome and Firefox

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

People

(Reporter: twisniewski, Unassigned)

References

()

Details

(Whiteboard: [webcompat])

Attachments

(1 file)

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).

Attached file testcase.html
Webcompat Priority: ? → revisit
Webcompat Priority: revisit → P3
Severity: normal → S3

As linked webcompat issue https://webcompat.com/issues/36362 is fixed now, unsetting webcompat priority.

Webcompat Priority: P3 → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: