fix(#7099): support for comment finishing with multiple dashes
<!-- xxxx -------> The issue came from a lack of support for backtracking on string matching. The way it is done, if the "end pattern" for consumeRawText starts with twice the same character, you end up having problem when your string being parsed has 3 times this char Example End string: xxyz string to parse: aaaaaaxxxyz calling consumeRawText(false, 'x', attemptParseStr('xyz')) would fail Closes #7119
This commit is contained in:

committed by
Misko Hevery

parent
83c19a1fbc
commit
60a2ba87d4
@ -95,6 +95,26 @@ export function main() {
|
||||
expect(tokenizeAndHumanizeErrors('<!--'))
|
||||
.toEqual([[HtmlTokenType.RAW_TEXT, 'Unexpected character "EOF"', '0:4']]);
|
||||
});
|
||||
|
||||
it('should accept comments finishing by too many dashes (even number)', () => {
|
||||
expect(tokenizeAndHumanizeSourceSpans('<!-- test ---->'))
|
||||
.toEqual([
|
||||
[HtmlTokenType.COMMENT_START, '<!--'],
|
||||
[HtmlTokenType.RAW_TEXT, ' test --'],
|
||||
[HtmlTokenType.COMMENT_END, '-->'],
|
||||
[HtmlTokenType.EOF, '']
|
||||
]);
|
||||
});
|
||||
|
||||
it('should accept comments finishing by too many dashes (odd number)', () => {
|
||||
expect(tokenizeAndHumanizeSourceSpans('<!-- test --->'))
|
||||
.toEqual([
|
||||
[HtmlTokenType.COMMENT_START, '<!--'],
|
||||
[HtmlTokenType.RAW_TEXT, ' test -'],
|
||||
[HtmlTokenType.COMMENT_END, '-->'],
|
||||
[HtmlTokenType.EOF, '']
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('doctype', () => {
|
||||
|
Reference in New Issue
Block a user