Closed
Bug 205119
Opened 21 years ago
Closed 21 years ago
document.addEventListener('load', ...) doesn't
Categories
(Core :: DOM: Events, defect)
Tracking
()
People
(Reporter: ian, Assigned: saari)
References
()
Details
The following script fails to execute: document.addEventListener('load', function() { document.getElementsByTagName('P')[0].firstChild.data = "PASS"; }, true); If I replace "document" with "window" it works fine. It also works if I use an onload attribute or the window.onload property. Testcase in URL.
Comment 1•21 years ago
|
||
Actually, the DOM spec does not define very well what this event should be fired on.... DOM3 Events says something about firing it on an Element, which does not make any sense at all for whole document loads. What makes you think this event should ever fire with the document as the target?
Reporter | ||
Comment 2•21 years ago
|
||
Wouldn't it bubble all the way back to the document anyway? (I have no idea.)
Comment 3•21 years ago
|
||
Load devents do not bubble. See the DOM Events spec.
Reporter | ||
Comment 4•21 years ago
|
||
Indeed. Ok. So, the spec doesn't say what we should fire it on, but it does say that "unload" fires on <body>. Unfortunately, if you are adding the script from some code in the <head> element of the document, there is no <body> to speak of. So what's the standard compliant way to do this? Should I bring this up in www-dom and ask the WG?
Comment 5•21 years ago
|
||
Probably a good idea, yes.
Reporter | ||
Comment 6•21 years ago
|
||
This is actually a dupe, I suck. I'll mail www-dom. *** This bug has been marked as a duplicate of 99820 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•