Bug 141254 - Script ordering for scripts dynamically inserted is wrong
Summary: Script ordering for scripts dynamically inserted is wrong
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Windows 8
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-04 11:14 PST by Ryan Molden
Modified: 2022-07-30 13:23 PDT (History)
4 users (show)

See Also:


Attachments
Repro for bug (989 bytes, application/octet-stream)
2015-02-04 11:15 PST, Ryan Molden
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Molden 2015-02-04 11:14:34 PST
When scripts are dynamically inserted by another script, via <DOM script node>.parentElement.insertBefore they are run out of order vis-à-vis the statically declared scripts in the HTML file.

Repro: 

Extract attached archive to directory, modify A.js to set the newly created script node's src attribute to the proper path where you extracted the repro files, load test.html in WebKit.

Expected:

Alert ordering to be "Executing A.js" ->  "Executing A1.js" -> "Executing B.js"


Actual:

Alert ordering is "Executing A.js" ->  "Executing B.js" -> "Executing A1.js"

In IE ordering is as expected. In Chrome it is the same as WebKit. Not sure who is correct here via the standards, but if there is latitude allowed I think IEs ordering is the most sensible and logical.
Comment 1 Ryan Molden 2015-02-04 11:15:31 PST
Created attachment 246038 [details]
Repro for bug
Comment 2 Ahmad Saleem 2022-07-30 07:21:19 PDT
I am unable to reproduce this bug in Safari 15.6 based on attached test case, I noticed following behavior across all browsers (Chrome Canary 106 and Firefox Nightly 105):

Alert ordering is "Executing A.js" ->  "Executing B.js"

A1.js does not get loaded at all in any browsers.

I am not sure about web-spec but since all browsers are in consensus. Do we need to do more or this can be marked as "RESOLVED WONTFIX" or accordingly anything appropriate. Thanks!
Comment 3 Ryosuke Niwa 2022-07-30 13:23:51 PDT
All browsers match. -> Config changed