-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Normative: Allow Annex B scripts to start with -->
#3244
Normative: Allow Annex B scripts to start with -->
#3244
Conversation
@gibson042 You mentioned on matrix that
but all the browsers I tested accept scripts starting with -->. Do you have a test case? |
It was tested with |
I'll work on tests during this meeting so that it can be merged on time for 2024. |
Tests: tc39/test262#4002 |
35c0ed1
to
197f124
Compare
This PR updates the spec to match web reality (tested in Safari, Firefox, and Chrome -- XS does not implement HTML comments).
Annex B allows HTML closing comments (
--> foo
) after a line terminator, potentially preceded by other comments or spaces (SingleLineHTMLCloseComment
). However, browsers also support them at the beginning of scripts. Some test cases:This PR accomplishes this by adding
HTMLCloseComment
toInputElementHashbangOrRegExp
in Annex B, whereInputElementHashbangOrRegExp
is the parsing goal used for the first token in the script.EDIT There is already a PR fixing this, by @leobalter (#1493), but it was stuck on discussing how to specify this. My version has the advantage of not introducing any new spec language, but I'm happy to close this PR if we find the original one more editorially appealing.
Notes from discussing this in the past: https://github.com/tc39/notes/blob/main/meetings/2019-03/mar-26.md#normative-createdynamicfunction-early-concatenates-body