Closed
Bug 337206
Opened 19 years ago
Closed 19 years ago
window.onload and document.body.onload are triggered before painting background images set by css
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
DUPLICATE
of bug 253851
People
(Reporter: mozilla, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2
Firefox triggers window.onload before it finishes painting background images set by css.
Firefox triggers document.body.onload before it finishes painting background images set by css.
I am seeing this in both Firefox 1.5.0.3 and 1.5.0.2.
All other browsers I have tested wait for the css-set background images to load before triggering window.onload.
I've been discussing this issue on the web dev/ standards forum for a few days, and as of yet there has been no good explanation for this behavior.
Someone suggested that the background images set by the css should not be considered part of the body, and thus not part of the window, but I strongly disagree. I believe they are certainly part of the window, and arguably part of the body. Is there a standard for this?
If there is no official standard, the unofficial standard, as determined by the way browsers have traditionally handled this situation, is that the css-set background images ~are~ part of the window (and the body), and the onload event should not occur until the css-set background images have painted. If this is a "feature" and not a bug, I think it is a big mistake for Firefox not to follow this convention.
There are a lot of reasons why a developer may want to trigger a function immediately after the page fully paints. In the current Firefox, there is no way to do this when background images are set in the css. I see no advantages to this. If window.onload is not the right event handler for this, what is?
You can see the problem in action here:
http://www.sandbox-project.com/test.html
I have tested this page in several browsers, and the only browser that does not behave as I expect is Firefox. Firefox triggers window.onload before it paints the images set in the css. To make this clear on the test page, the function that is triggered by window.onload displays an alert (and does nothing else). Of course, you will have to clear your own browser's image cache to see the problem upon any repeat visit to the page.
Is this a Firefox bug or just a highly undesirable feature? Either way, I hope it is fixed. If I knew C++ I might try to do this myself. :)
I am not sure, but this may be related to bug 308652.
Reproducible: Always
Steps to Reproduce:
1.set several background images using css
2.trigger a function on window.onload or document.body.onload
Actual Results:
unless the css-set background images are small and you have a really fast connection to the internet, the onload event will always trigger before firefox finishes painting the background images.
Expected Results:
Firefox should not trigger the onload event until the entire page has finished painting.
This issue is not specific to Windows XP, but since I have not tested all platforms I did not select "all".
Updated•19 years ago
|
Assignee: nobody → events
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
Comment 1•19 years ago
|
||
Confirming. Just don't expect any progress on this until bug 115107 is fixed.
Status: UNCONFIRMED → NEW
Depends on: 115107
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Comment 2•19 years ago
|
||
*** This bug has been marked as a duplicate of 253851 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Comment 3•19 years ago
|
||
Bug 253851 comment 13 says this could have been done for IE compatibility. If that isn't the case, it would be worth mentioning there.
You need to log in
before you can comment on or make changes to this bug.
Description
•