Commit bd1a2eb
authored
Allow Colon
This pull request updates the parser to allow HTML Attributes to start
with a colon, which is typical in the Vue.js style:
```html
<div :class="classes"></div>
```
Previously, this caused a syntax error:
```js
@ UnexpectedError (location: (1:5)-(1:6))
βββ message: "Unexpected Token. Expected: `TOKEN_IDENTIFIER, TOKEN_AT, TOKEN_ERB_START,TOKEN_WHITESPACE, or TOKEN_NEWLINE`, found: `TOKEN_COLON`."
βββ description: "Unexpected Token"
βββ expected: "TOKEN_IDENTIFIER, TOKEN_AT, TOKEN_ERB_START,TOKEN_WHITESPACE, or TOKEN_NEWLINE"
βββ found: "TOKEN_COLON"
```
Now this parses as:
```js
@ HTMLAttributeNode (location: (1:5)-(1:21))
βββ errors: []
βββ name:
β βββ @ HTMLAttributeNameNode (location: (1:5)-(1:11))
β βββ errors: []
β βββ children: (1 item)
β βββ @ LiteralNode (location: (1:5)-(1:11))
β βββ errors: []
β βββ content: ":class"
β
βββ equals: "=" (location: (1:11)-(1:12))
βββ value:
βββ @ HTMLAttributeValueNode (location: (1:12)-(1:21))
βββ errors: []
βββ open_quote: """ (location: (1:12)-(1:13))
βββ children: (1 item)
β βββ @ LiteralNode (location: (1:13)-(1:20))
β βββ errors: []
β βββ content: "classes"
β
β
βββ close_quote: """ (location: (1:20)-(1:21))
βββ quoted: true
```: in HTML Attribute Names (#496)1 parent 6336595 commit bd1a2eb
File tree
10 files changed
+474
-0
lines changed- src
- test
- parser
- snapshots/parser/attributes_test
10 files changed
+474
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
808 | 822 | | |
809 | 823 | | |
810 | 824 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
162 | 194 | | |
163 | 195 | | |
Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments