-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure unary expression continuation is a word boundary
- Loading branch information
1 parent
785a593
commit 72b3379
Showing
4 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"htmljs-parser": patch | ||
--- | ||
|
||
Fix regression where the parser would continue unary keyword expressions even if the keyword was inside a word boundary. Eg `<div class=thing_new x>` would cause the parser to see the expression as `thing_` and `new x`. |
80 changes: 80 additions & 0 deletions
80
src/__tests__/fixtures/attr-complex-unary/__snapshots__/attr-complex-unary.expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
1╭─ tag a = class b {} | ||
│ │ │ │ ╰─ attrValue.value "class b {}" | ||
│ │ │ ╰─ attrValue "= class b {}" | ||
│ │ ╰─ attrName | ||
╰─ ╰─ tagName "tag" | ||
2╭─ | ||
╰─ ╰─ openTagEnd | ||
3╭─ tag a = class, b | ||
│ │ │ │ │ ╰─ attrName | ||
│ │ │ │ ╰─ attrValue.value "class" | ||
│ │ │ ╰─ attrValue "= class" | ||
│ │ ╰─ attrName | ||
│ ├─ closeTagEnd(tag) | ||
╰─ ╰─ tagName "tag" | ||
4╭─ | ||
╰─ ╰─ openTagEnd | ||
5╭─ <tag a = class></tag> | ||
│ ││ │ │ │ ││ │ ╰─ closeTagEnd(tag) | ||
│ ││ │ │ │ ││ ╰─ closeTagName "tag" | ||
│ ││ │ │ │ │╰─ closeTagStart "</" | ||
│ ││ │ │ │ ╰─ openTagEnd | ||
│ ││ │ │ ╰─ attrValue.value "class" | ||
│ ││ │ ╰─ attrValue "= class" | ||
│ ││ ╰─ attrName | ||
│ │╰─ tagName "tag" | ||
│ ├─ closeTagEnd(tag) | ||
╰─ ╰─ openTagStart | ||
6├─ | ||
7╭─ <tag a = class/> | ||
│ ││ │ │ │ ╰─ openTagEnd:selfClosed "/>" | ||
│ ││ │ │ ╰─ attrValue.value "class" | ||
│ ││ │ ╰─ attrValue "= class" | ||
│ ││ ╰─ attrName | ||
│ │╰─ tagName "tag" | ||
╰─ ╰─ openTagStart | ||
8├─ | ||
9╭─ tag a = classthing b | ||
│ │ │ │ │ ╰─ attrName | ||
│ │ │ │ ╰─ attrValue.value "classthing" | ||
│ │ │ ╰─ attrValue "= classthing" | ||
│ │ ╰─ attrName | ||
╰─ ╰─ tagName "tag" | ||
10╭─ | ||
╰─ ╰─ openTagEnd | ||
11╭─ tag a = testclass b | ||
│ │ │ │ │ ╰─ attrName | ||
│ │ │ │ ╰─ attrValue.value "testclass" | ||
│ │ │ ╰─ attrValue "= testclass" | ||
│ │ ╰─ attrName | ||
│ ├─ closeTagEnd(tag) | ||
╰─ ╰─ tagName "tag" | ||
12╭─ | ||
╰─ ╰─ openTagEnd | ||
13╭─ tag a = test_class b | ||
│ │ │ │ │ ╰─ attrName | ||
│ │ │ │ ╰─ attrValue.value "test_class" | ||
│ │ │ ╰─ attrValue "= test_class" | ||
│ │ ╰─ attrName | ||
│ ├─ closeTagEnd(tag) | ||
╰─ ╰─ tagName "tag" | ||
14╭─ | ||
╰─ ╰─ openTagEnd | ||
15╭─ tag a = test$class b | ||
│ │ │ │ │ ╰─ attrName | ||
│ │ │ │ ╰─ attrValue.value "test$class" | ||
│ │ │ ╰─ attrValue "= test$class" | ||
│ │ ╰─ attrName | ||
│ ├─ closeTagEnd(tag) | ||
╰─ ╰─ tagName "tag" | ||
16╭─ | ||
╰─ ╰─ openTagEnd | ||
17╭─ tag a = test+class b | ||
│ │ │ │ ╰─ attrValue.value "test+class b" | ||
│ │ │ ╰─ attrValue "= test+class b" | ||
│ │ ╰─ attrName | ||
│ ├─ closeTagEnd(tag) | ||
╰─ ╰─ tagName "tag" | ||
18╭─ | ||
│ ├─ openTagEnd | ||
╰─ ╰─ closeTagEnd(tag) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
tag a = class b {} | ||
|
||
tag a = class, b | ||
|
||
<tag a = class></tag> | ||
|
||
<tag a = class/> | ||
|
||
tag a = classthing b | ||
|
||
tag a = testclass b | ||
|
||
tag a = test_class b | ||
|
||
tag a = test$class b | ||
|
||
tag a = test+class b |
This file contains 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