[Bug 9984] [parser] Insertion point for script@onload doesn't match Firefox

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


Henri Sivonen <hsivonen@iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bzbarsky@mit.edu,
                   |                            |jonas@sicking.cc
         AssignedTo|hsivonen@iki.fi             |ian@hixie.ch




--- Comment #6 from Henri Sivonen <hsivonen@iki.fi>  2010-08-25 10:45:05 ---
So, in Gecko, there are the following operations of interest (assuming
sicking's patch that adds scriptwillexecute and scriptdidexecute lands in its
current form) is as follows:
 1) the parser gets unblocked.
 2) scriptwillexecute fires.
 3) insertion point becomes non-undefined
 4) the document becomes aware of an external script being evaluated (for
write-neutralization) if applicable
 5) the insertion point becomes the right point for this script
 6) the script is evaluated!
 7) the insertion point stops being the right point for this script
 8) the document becomes unaware of an external script being evaluated
 9) the insertion point potentially becomes undefined
10) scriptdidexecute fires
11) load (for external scripts) fires

Now, to support document.write() from onload, the steps above would need to be
shuffled so that the load event fires before step #7. In that case, onload
would have the insertion point behavior equivalent of the statements in the
event handler being part of the script itself.

Alternatively, load could fire after step #7 but behave for insertion point
purposes as if it were a script immediately after the script proper *but*
executing before external scripts written by the script proper get to execute.

Old Gecko behaves as if the insertion point were the insertion point of the
parent script. WebKit and Opera behave differently from old Gecko and each
other:
http://hsivonen.iki.fi/test/write-on-load.html
In particular, old WebKit doesn't appear to behave the way abarth describes
WebKit's new behavior in comment 0.

Making load behave as if it were a distinct script for insertion point purposes
*and* letting the external scripts written by the script proper run first would
be pain.

In the interest of time, I didn't find out what IE does (since data: URLs don't
work in IE). However, given that there's no use case, no evidence of sites
breaking and no uniform legacy behavior, I'd prefer not to make it possible to
write content to the parser from onload or from the handlers for the new events
sicking is adding.

So I think the spec should change to make it so that the insertion point is
undefined when the onload event handler runs (or when the handlers for the
events sicking is adding run).

-- 
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 Wednesday, 25 August 2010 10:45:10 UTC