revert: fix(core): parse incorrect ML open tag as text (#29328)
This commit is contained in:
@ -461,14 +461,12 @@ class _Tokenizer {
|
||||
let tagName: string;
|
||||
let prefix: string;
|
||||
let openTagToken: Token|undefined;
|
||||
let tokensBeforeTagOpen = this.tokens.length;
|
||||
const innerStart = this._cursor.clone();
|
||||
try {
|
||||
if (!chars.isAsciiLetter(this._cursor.peek())) {
|
||||
throw this._createError(
|
||||
_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
|
||||
}
|
||||
|
||||
openTagToken = this._consumeTagOpenStart(start);
|
||||
prefix = openTagToken.parts[0];
|
||||
tagName = openTagToken.parts[1];
|
||||
@ -485,10 +483,10 @@ class _Tokenizer {
|
||||
this._consumeTagOpenEnd();
|
||||
} catch (e) {
|
||||
if (e instanceof _ControlFlowError) {
|
||||
// When the start tag is invalid (including invalid "attributes"), assume we want a "<"
|
||||
// When the start tag is invalid, assume we want a "<"
|
||||
this._cursor = innerStart;
|
||||
if (openTagToken) {
|
||||
this.tokens.length = tokensBeforeTagOpen;
|
||||
this.tokens.pop();
|
||||
}
|
||||
// Back to back text tokens are merged at the end
|
||||
this._beginToken(TokenType.TEXT, start);
|
||||
@ -530,10 +528,6 @@ class _Tokenizer {
|
||||
}
|
||||
|
||||
private _consumeAttributeName() {
|
||||
const attrNameStart = this._cursor.peek();
|
||||
if (attrNameStart === chars.$SQ || attrNameStart === chars.$DQ) {
|
||||
throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());
|
||||
}
|
||||
this._beginToken(TokenType.ATTR_NAME);
|
||||
const prefixAndName = this._consumePrefixAndName();
|
||||
this._endToken(prefixAndName);
|
||||
|
Reference in New Issue
Block a user