W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > September 2011

[Bug 14195] New: Script and stylesheet elements need clearly defined rules for `load` and `error`

From: <bugzilla@jessica.w3.org>
Date: Sat, 17 Sep 2011 21:06:21 +0000
To: public-html-bugzilla@w3.org
Message-ID: <bug-14195-2486@http.www.w3.org/Bugs/Public/>

           Summary: Script and stylesheet elements need clearly defined
                    rules for `load` and `error`
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: w3c@getify.myspamkiller.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,

It is observed that the spec is not very crisp on the topic of how `error`
events fire (in the absence of a `load` event) for both script elements and
stylesheet elements -- specifically dynamically created elements. 

This ostensibly has led to the current state of such event support
cross-browser -- which is very inconsistent/buggy. It is requested that
clarification be made for both events for both element types, such that
specific bugs can filed against each browser to bring them all into

Specifically, it seems like in the case of `load` and `error`, one of the two
events should *always* fire for a script/stylesheet element. There should never
be a case where an element falls in between and fires neither event.

Furthermore, we should be crisp/clear on what constitutes a successful "load"
of such elements, so that the absence of `load` can predictably be fired as

I suggest:

* `load` should only fire if the element in question results in a 2xx or 3xx
HTTP status code. `load` should fire even if the parsing/execution of the
resource fails, but should always fire *after* that attempt, to maintain how
existing script.onload works.

* `error` should fire in any other case, which would correspond to 4xx and 5xx
HTTP error status codes.

* `error` is *not* to fire for parse/execution errors in either element type
(script, stylesheet) -- it is purely for "failed to load" type errors.



In various browsers, various HTTP status codes result in either the `error`
event firing or not, and in some cases, neither a `load` nor a `error` fires.
The behavior is even more confusing because it's not the same for scripts as it
is for stylesheets.

There's even a case where a browser fires `error` in the event of a script
error, which is confusingly incompatible with other browsers on the topic.

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 Saturday, 17 September 2011 21:06:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:02:03 UTC