Bug 17351
| Summary: | Rendering differs depending on the order that files are fetched | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | William Siegrist <wsiegrist> |
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | hyatt, mitz, sam |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Mac | ||
| OS: | OS X 10.5 | ||
| URL: | http://www.macosforge.org/files/offset_test/linked.html | ||
William Siegrist
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
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
mitz
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.
William Siegrist
So document.onload fires before the stylesheets are processed?
mitz
(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.
William Siegrist
Thanks, I should have caught the () being there at least. So should this be resolved "Invalid" now?
mitz
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.