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
@ -267,8 +267,16 @@ class _HtmlTokenizer {
|
||||
}
|
||||
|
||||
private _attemptStr(chars: string): boolean {
|
||||
var indexBeforeAttempt = this.index;
|
||||
var columnBeforeAttempt = this.column;
|
||||
var lineBeforeAttempt = this.line;
|
||||
for (var i = 0; i < chars.length; i++) {
|
||||
if (!this._attemptCharCode(StringWrapper.charCodeAt(chars, i))) {
|
||||
// If attempting to parse the string fails, we want to reset the parser
|
||||
// to where it was before the attempt
|
||||
this.index = indexBeforeAttempt;
|
||||
this.column = columnBeforeAttempt;
|
||||
this.line = lineBeforeAttempt;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user