[Webkit-unassigned] [Bug 24998] New: document.documentElement.scrollHeight is reporting absolute height of window rather than height of content

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 1 20:54:11 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=24998

           Summary: document.documentElement.scrollHeight is reporting
                    absolute height of window rather than height of content
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh
               URL: http://www.somethingtoputhere.com/therunaround/
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: mvernal at facebook.com


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.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list