Repository navigation
Conversation
With `selectorlessEnabled`, the attribute loop in `_consumeTagOpen` only consumed `@` when it was followed by a selectorless name start (`_` or an uppercase letter, i.e. a PascalCase component/directive reference). Any other `@` — a lowercase animation trigger such as `@triggerName`, or a lone `@` — matched neither branch, so the cursor never advanced and the lexer looped forever. Fall through to `_consumeAttribute()` instead, which is what the lexer already does when selectorless syntax is disabled. Fixes #57
commit: |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enableAngularSelectorlessSyntax(the lexer'sselectorlessEnabledoption) hangs forever on any@that is not followed by_or an uppercase letter — e.g. the common lowercase@triggerNameattribute.Closes #57.
Cause
In
_consumeTagOpen, the selectorless branch only consumed@whenisSelectorlessNameStart(nameStart.peek())was true (_orA-Z, i.e. a PascalCase component/directive reference). Every other@fell out of theif/elsewithout consuming a character, so the enclosingwhile (true)never advanced.Fix
Fall through to
_consumeAttribute()when the@cannot start a directive — exactly what the lexer does when selectorless syntax is disabled. A lowercase@nametherefore stays an attribute (matching Angular, where selectorless directives are referenced by their PascalCase class name), and a lone@no longer loops.Tests
packages/compiler/test/ml_parser/lexer_spec.ts:@myDir,@myDir="x",@,@1packages/angular-html-parser/test/index_spec.ts:<div @myDir>,<MyComp @myDir>,<div @>yarn vitest run→ 450 passed,lint:prettierandlint:typesclean.