[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).

http://www.w3.org/Bugs/Public/show_bug.cgi?id=9204


Axel Dahmen <brille1@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|NEEDSINFO                   |




--- Comment #2 from Axel Dahmen <brille1@hotmail.com>  2010-04-01 09:34:52 ---
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.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 1 April 2010 09:34:54 UTC