-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"prepare a script" and scripts moved to a different document #3486
Comments
(Note that when scripts execute relative to insertion via |
I think #2673 is the most ambitious attempt to fix this, but I believe @hiroshige-g hasn't had time to try this in Chrome yet. |
So for the second testcase in #3486 (comment) here's what Gecko is doing:
|
So in terms of how this compares to the spec... As far as I can tell, per https://dom.spec.whatwg.org/#concept-node-insert the "insertion steps" for Those insertion steps land us at https://html.spec.whatwg.org/multipage/infrastructure.html#becomes-connected and https://html.spec.whatwg.org/multipage/scripting.html#the-script-element says that when the script element becomes connected it must immediately prepare the script. That lands in https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script and synchronously lands in the "Otherwise" case of step 25, which runs the script. In particular, per spec as currently written, when |
I consider it a bug that DOM runs the insertion steps so early: whatwg/dom#576 has a fix; I haven't yet written tests or filed a bug against Safari though. Was waiting for more thorough review since it's a rather substantial change. I don't understand what you mean in 3 by the |
Ah, good.
Sorry, I should have been more clear. It's ignored for purposes of running the |
Actually... There are complications about running the insertion steps later, in general. I guess this is only observable with document fragments, so maybe there won't be too much breakage, but it would be a pretty significant behavior change to make all insertion steps run later. |
The change only affects insertion of a |
I feel like this is closed now that #2673 and related refactorings are done, but there's also a lot of discussion of |
This relates to #2137, but since it's not strictly related to the parser I figured I'd file it separately for now. We can merge later on.
It seems that this step does not necessarily depend solely on "parser-inserted".
Aside: does this mean we need to store the "creator document" on the
script
element? The current prose is rather hand-wavy.This only logs "s1 executed" in Chrome, Edge, Firefox, and Safari.
This only logs "s1 executed" in Firefox, but logs "s1 executed", "s2 executed" in Chrome, Edge, and Safari. Does this mean non-Firefox basically wants browsing-context connected as a sole check?
I also tested:
Apart from Firefox everyone implements it. I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1439572 on this.
The text was updated successfully, but these errors were encountered: