Open Bug 637319 Opened 13 years ago Updated 2 years ago

Fire load event for inline scripts

Categories

(Core :: DOM: Events, enhancement, P5)

x86_64
Linux
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: serverherder, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20110103 Fedora/3.6.13-1.fc14 Firefox/3.6.13
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20110103 Fedora/3.6.13-1.fc14 Firefox/3.6.13

From the "execute a script block" section, step 5 indicates an asynchronous load event should be fired at local script elements when they complete. 

Otherwise, the script is internal; queue a task to fire a simple event named load at the script element.

http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#script

Gecko only fires the load event when a script contains a non-empty src attribute such as a URL or data-uri. 

Reproducible: Always

Steps to Reproduce:
1. Create script element
2. Assign text attribute
3. Assign onload handler
4. Attach script to DOM
Actual Results:  
Although the script runs, the onload event never fires. 

Expected Results:  
Per the specification, [If] the script is internal; queue a task to fire a simple event named load at the script element.

This is a relatively minor point and in many situations using a data-uri is an acceptable workaround; however, data-uri's cause the script to execute using different rules than those defined for local scripts (async execution, synchronous callback) which is not always acceptable.  

All versions of IE fire the onreadystatechange event on local script elements and IE9 fires the onload event at local scripts as well.  No other browsers exhibit similar behavior.
Component: General → DOM: Events
Product: Firefox → Core
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.