This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9204 - The onload event is missing a description on when it fires. Particularly on elements downloading auxiliary documents (img, script, link) it is important to specify when exactly that event is fired. Same for onerror and onabort events (and similar).
Summary: The onload event is missing a description on when it fires. Particularly on e...
Status: RESOLVED NEEDSINFO
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: LC
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-06 21:20 UTC by contributor
Modified: 2010-10-04 14:56 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2010-03-06 21:20:32 UTC
Section: http://www.whatwg.org/specs/web-apps/current-work/#event-handlers-on-elements,-document-objects,-and-window-objects

Comment:
The onload event is missing a description on when it fires. Particularly on
elements downloading auxiliary documents (img, script, link) it is important
to specify when exactly that event is fired. Same for onerror and onabort
events (and similar).

Posted from: 93.206.147.106
Comment 1 Ian 'Hixie' Hickson 2010-03-30 22:20:03 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: I don't understand. Could you elaborate? As far as I can tell, the spec goes to great lengths to define when 'load' events fire, as with 'error' and 'abort' events.
Comment 2 Axel Dahmen 2010-04-01 09:34:52 UTC
This sort of refers to bug #9205.

In the course of trying to manipulate an HTML document by DOM manipulation I observed a strange discrepancy in behaviour between the <img> and the <script> object.

While the <img> objects starts downloading a referenced external resource as soon as the "src" attribute gets set (and onload() is fired accordingly), in Internet Explorer the <script> element seems to only initialize some part of downloading sequence. IE doesn't support the onload() event, yet it fires the onreadystatechanged event with value "loading". But it won't fire the onreadystatechanged event with value "complete" until the newly created DOM element becomes added to the DOM tree of the HTML document.

I believe this discrepancy in IE is very irritating and should be obsolated by definition.


Here's a flow table to better visualize what happens:

CREATING AN IMAGE:
1)  create document element    {document.createElement("img");}
2)  assign an IRI to the "scr" attribute
3)  the external resource gets loaded into the cache
4)  the onload event is triggered

in contrast to:

CREATING A SCRIPT REFERENCE:
-non IE-
1)  create document element    {document.createElement("script");}
2)  assign an IRI to the "src" attribute
3)  the external resource gets loaded into the cache
4)  the onload event is triggered

-IE-
1)  create document element    {document.createElement("script");}
2)  assign an IRI to the "src" attribute
3)  the external resource begins getting loaded into the cache
4)  the onreadystatechanged event is triggered with value "loading"
--  nothing more happens until:
5)  add the new script element to the HTML document tree
6)  the onreadystatechanged event is triggered with value "complete"


I believe the ambiguity between onload and onreadystatechanged should be obsolated at all. The onreadystatechanged event doesn't provide any additional useful information and complicates code unnecessarily.
Comment 3 Ian 'Hixie' Hickson 2010-04-12 07:26:06 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: I don't understand. According to HTML5, there is no "readystate" event on <script>. What part of the processing of <script> are you asking be changed? If you could refer to specific text in the spec you think is wrong, that would be rather helpful.
Comment 4 Axel Dahmen 2010-05-07 03:36:45 UTC
I can't find a description in the spec about which events are fired for the script element. Could you please point me to the appropriate section?

As I wrote in another bug, the HTML5 spec has become huge and hard to survey. A reorganization might feel appropriate, creating more subsections for each tag, so the user can searche for, e.g., "DTD", "DOM", "Events", "Description", "Workflow" etc.
Comment 5 Ian 'Hixie' Hickson 2010-08-17 19:03:05 UTC
Search for "fire a" in:
   http://www.whatwg.org/specs/web-apps/current-work/complete/scripting-1.html#script