This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10521 - Should say explicitly that parser-initiated script-running fails without setting 'already started' if the script is no longer in the document when the parser tries to run the script
Summary: Should say explicitly that parser-initiated script-running fails without sett...
Status: CLOSED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P1 critical
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-01 12:28 UTC by Henri Sivonen
Modified: 2010-10-07 12:00 UTC (History)
4 users (show)

See Also:


Attachments

Description Henri Sivonen 2010-09-01 12:28:28 UTC
By code inspection, attempts to run a script in Gecko bail out before setting 'already started' if the script is not in a document. AFAICT, the spec doesn't cover this case when the parser tries to run script.
Comment 1 Ian 'Hixie' Hickson 2010-09-25 19:33:20 UTC
How can the script not be in the document?
Comment 2 Simon Pieters 2010-09-27 12:41:00 UTC
I think something like:

<button onclick="s=document.getElementsByTagName('script')[0]; s.parentNode.removeChild(s)">remove</button>
<script>
// the parser has inserted the script element into the document
// server sleeps for a while here and you click on the button
alert(1);
</script>

(or by using setTimeout etc)
Comment 3 Henri Sivonen 2010-09-28 11:05:47 UTC
Or simply
<div>
<script>
// detach the div from the document
</script>
<script>
// this script won't be in the document when the parser tries to run it
</script>
Comment 4 Ian 'Hixie' Hickson 2010-09-30 08:30:24 UTC
Makes sense.
Comment 5 Ian 'Hixie' Hickson 2010-10-06 17:37:32 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 6 contributor 2010-10-06 17:37:42 UTC
Checked in as WHATWG revision r5585.
Check-in comment: Scripts not in documents don't execute.
http://html5.org/tools/web-apps-tracker?from=5584&to=5585