A page with a link to a stylesheet and a link to a javascript file that changes some styles, will actually render differently based on which of those 2 links is fetched first. Firefox seems to treat them "top down" in the ultimate HTML but nightly webkit can be made to change its rendering with enough pushing of the refresh button. An "inlined" version that does not exhibit this behavior is here: http://www.macosforge.org/files/offset_test/inline.html
When the script asks for contdiv.offsetHeight, if the style sheet has not loaded yet, then the result will be 0. Script execution does not block on pending style sheets.
So document.onload fires before the stylesheets are processed?
(In reply to comment #2) > So document.onload fires before the stylesheets are processed? This statement: document.onload = resize_content(); calls resize_content() *immediately* (and sets document.onload to null). You probably meant to do window.onload = resize_content; (setting the property to the function, not its return value). Note that if you do that, then the document.write statement in resize_content() will replace the document's contents, so I suggest that you remove it as well.
Thanks, I should have caught the () being there at least. So should this be resolved "Invalid" now?
I think there is a separate bug requesting that scripts block on style sheets when accessing layout properties, which would be possible if JavaScriptCore was made interruptible.