mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibJS: "-->" preceded by token on same line isn't start of HTML-like comment
B.1.3 HTML-like Comments
The syntax and semantics of 11.4 is extended as follows except that this
extension is not allowed when parsing source code using the goal symbol
Module:
Syntax (only relevant part included)
SingleLineHTMLCloseComment ::
LineTerminatorSequence HTMLCloseComment
HTMLCloseComment ::
WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt]
Fixes #3810.
This commit is contained in:
committed by
Andreas Kling
parent
a10d09faba
commit
69845ae460
Notes:
sideshowbarker
2024-07-19 01:39:12 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/69845ae460d Pull-request: https://github.com/SerenityOS/serenity/pull/3868 Issue: https://github.com/SerenityOS/serenity/issues/3810
@@ -1,25 +1,29 @@
|
||||
test("regular comments", () => {
|
||||
const source = `var i = 0;
|
||||
|
||||
const source = `
|
||||
var i = 0;
|
||||
// i++;
|
||||
/* i++; */
|
||||
/*
|
||||
i++;
|
||||
*/
|
||||
/**/ i++;
|
||||
return i;`;
|
||||
|
||||
expect(source).toEvalTo(0);
|
||||
expect(source).toEvalTo(1);
|
||||
});
|
||||
|
||||
test("html comments", () => {
|
||||
const source = `var i = 0;
|
||||
const source = `
|
||||
var i = 0;
|
||||
var j = 0;
|
||||
<!-- i++; --> i++;
|
||||
<!-- i++;
|
||||
i++;
|
||||
--> i++;
|
||||
/**/ --> i++;
|
||||
j --> i++;
|
||||
return i;`;
|
||||
|
||||
expect(source).toEvalTo(1);
|
||||
expect(source).toEvalTo(2);
|
||||
});
|
||||
|
||||
test("unterminated multi-line comment", () => {
|
||||
|
||||
Reference in New Issue
Block a user