UNCONFIRMED 24998
document.documentElement.scrollHeight is reporting absolute height of window rather than height of content
https://bugs.webkit.org/show_bug.cgi?id=24998
Summary document.documentElement.scrollHeight is reporting absolute height of window ...
Mike Vernal
Reported 2009-04-01 20:54:11 PDT
In Safari 3+ and Safari 4, the document.documentElement.scrollHeight property is reporting the max() of the content height and the current browser window height, rather than just the content height. This is breaking some automatic iframe resizing logic that Facebook relies upon. Long story short, there is a feature in facebook that allows a parent to communicate with an iframe from a different domain and resize it as appropriate. It roughly works by having the iframe figure out it's ideal height and send a message to the parent asking it to resize itself. This isn't working in Safari3/Safari4 (it works in FF/IE) because scrollHeight is including extra vertical space if the user manually resizes the window (or if the content gets shorter). Here's the code we use to figure out the current size of the window: /** * Get size of current document * documentSize * @return FB.Size */ get_documentSize: function() { var s = s = FB.$create_Size(document.body.scrollWidth, document.body.scrollHeight); if (s.w <= 0) { s.w = document.documentElement.scrollWidth; } if (s.h <= 0) { s.h = document.documentElement.scrollHeight; } return s; }, You can see this if you do the following: 1) Log out of facebook (if logged-in) 2) Go to http://www.somethingtoputhere.com/therunaround/ 3) When the login button appears, click it. A new browser window will popup. 4) Resize the height of the window. Note the scrollHeight. Thanks.
Attachments
Michael Dayah
Comment 2 2009-06-25 23:04:44 PDT
I can confirm scrollWidth sometimes contains the offsetWidth instead of the full width of dE.scrollWidth which disrupts my fit-to-window switching of style sheets. I couldn't duplicate this by simply placing a long line of text and alerting scrollWidth, but I can on ptable.com. After visiting, make sure the site scrolls out of the window boundaries by selecting the Wide checkbox and use the address bar to alert d.dE.scrollWidth. It will never be more than the window width regardless of how much larger dE is. Builds with a correct scrollWidth will automatically switch style sheets as the window resizes, and newer builds will not.
Michael Dayah
Comment 3 2009-06-27 22:58:39 PDT
Build 42042 does not have this bug. Build 42043 does.
Michael Dayah
Comment 4 2009-06-28 08:41:39 PDT
Note You need to log in before you can comment on or make changes to this bug.