Skip to content

Commit 3b2238f

Browse files
authoredOct 10, 2021
JS: Added properties (#3099)
1 parent 3f24dc7 commit 3b2238f

21 files changed

+527
-317
lines changed
 

‎components/prism-actionscript.js

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Prism.languages.actionscript = Prism.languages.extend('javascript', {
44
});
55
Prism.languages.actionscript['class-name'].alias = 'function';
66

7+
// doesn't work with AS because AS is too complex
8+
delete Prism.languages.actionscript['parameter'];
9+
delete Prism.languages.actionscript['literal-property'];
10+
711
if (Prism.languages.markup) {
812
Prism.languages.insertBefore('actionscript', 'string', {
913
'xml': {

‎components/prism-actionscript.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components/prism-javascript.js

+14
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,23 @@ Prism.languages.insertBefore('javascript', 'string', {
9898
},
9999
'string': /[\s\S]+/
100100
}
101+
},
102+
'string-property': {
103+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
104+
lookbehind: true,
105+
greedy: true,
106+
alias: 'property'
101107
}
102108
});
103109

110+
Prism.languages.insertBefore('javascript', 'operator', {
111+
'literal-property': {
112+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
113+
lookbehind: true,
114+
alias: 'property'
115+
},
116+
});
117+
104118
if (Prism.languages.markup) {
105119
Prism.languages.markup.tag.addInlined('script', 'javascript');
106120

‎components/prism-javascript.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components/prism-tsx.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// doesn't work with TS because TS is too complex
66
delete Prism.languages.tsx['parameter'];
7+
delete Prism.languages.tsx['literal-property'];
78

89
// This will prevent collisions between TSX tags and TS generic types.
910
// Idea by https://github.com/karlhorky

‎components/prism-tsx.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components/prism-typescript.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// doesn't work with TS because TS is too complex
2323
delete Prism.languages.typescript['parameter'];
24+
delete Prism.languages.typescript['literal-property'];
2425

2526
// a version of typescript specifically for highlighting types
2627
var typeInside = Prism.languages.extend('typescript', {});

‎components/prism-typescript.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎prism.js

+14
Original file line numberDiff line numberDiff line change
@@ -1647,9 +1647,23 @@ Prism.languages.insertBefore('javascript', 'string', {
16471647
},
16481648
'string': /[\s\S]+/
16491649
}
1650+
},
1651+
'string-property': {
1652+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1653+
lookbehind: true,
1654+
greedy: true,
1655+
alias: 'property'
16501656
}
16511657
});
16521658

1659+
Prism.languages.insertBefore('javascript', 'operator', {
1660+
'literal-property': {
1661+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1662+
lookbehind: true,
1663+
alias: 'property'
1664+
},
1665+
});
1666+
16531667
if (Prism.languages.markup) {
16541668
Prism.languages.markup.tag.addInlined('script', 'javascript');
16551669

‎tests/languages/javascript+http/issue2733.test

+13-13
Original file line numberDiff line numberDiff line change
@@ -47,66 +47,66 @@ transfer-encoding: chunked
4747
["application-json", [
4848
["punctuation", "{"],
4949

50-
["string", "\"id\""],
50+
["string-property", "\"id\""],
5151
["operator", ":"],
5252
["number", "1"],
5353
["punctuation", ","],
5454

55-
["string", "\"name\""],
55+
["string-property", "\"name\""],
5656
["operator", ":"],
5757
["string", "\"John Doe\""],
5858
["punctuation", ","],
5959

60-
["string", "\"userName\""],
60+
["string-property", "\"userName\""],
6161
["operator", ":"],
6262
["string", "\"jdoe\""],
6363
["punctuation", ","],
6464

65-
["string", "\"email\""],
65+
["string-property", "\"email\""],
6666
["operator", ":"],
6767
["string", "\"whatever@something.zzz\""],
6868
["punctuation", ","],
6969

70-
["string", "\"phone\""],
70+
["string-property", "\"phone\""],
7171
["operator", ":"],
7272
["string", "\"1234567890\""],
7373
["punctuation", ","],
7474

75-
["string", "\"birthDate\""],
75+
["string-property", "\"birthDate\""],
7676
["operator", ":"],
7777
["string", "\"1878-05-06\""],
7878
["punctuation", ","],
7979

80-
["string", "\"address\""],
80+
["string-property", "\"address\""],
8181
["operator", ":"],
8282
["punctuation", "{"],
8383

84-
["string", "\"street\""],
84+
["string-property", "\"street\""],
8585
["operator", ":"],
8686
["string", "\"Fake St\""],
8787
["punctuation", ","],
8888

89-
["string", "\"street2\""],
89+
["string-property", "\"street2\""],
9090
["operator", ":"],
9191
["string", "\"Apt. 556\""],
9292
["punctuation", ","],
9393

94-
["string", "\"city\""],
94+
["string-property", "\"city\""],
9595
["operator", ":"],
9696
["string", "\"Gwenborough\""],
9797
["punctuation", ","],
9898

99-
["string", "\"state\""],
99+
["string-property", "\"state\""],
100100
["operator", ":"],
101101
["string", "\"ZZ\""],
102102
["punctuation", ","],
103103

104-
["string", "\"zip\""],
104+
["string-property", "\"zip\""],
105105
["operator", ":"],
106106
["string", "\"12345\""],
107107

108108
["punctuation", "}"],
109109

110110
["punctuation", "}"]
111111
]]
112-
]
112+
]

‎tests/languages/javascript/class-method_feature.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ class Test {
5757
["punctuation", "("],
5858
["parameter", [
5959
["punctuation", "{"],
60-
" props",
60+
["literal-property", "props"],
6161
["operator", ":"],
6262
["punctuation", "{"],
63-
" a",
63+
["literal-property", "a"],
6464
["operator", ":"],
6565
" _A",
6666
["punctuation", ","],

‎tests/languages/javascript/function-variable_feature.test

+13-16
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,16 @@ a = function () {}, b = () => {}
4343
["punctuation", "("],
4444
["punctuation", ")"],
4545
["punctuation", "{"],
46-
["punctuation","}"],
47-
["punctuation","}"],
46+
["punctuation", "}"],
47+
["punctuation", "}"],
4848

4949
["function-variable", "bar"],
5050
["operator", "="],
5151
["keyword", "async"],
5252
["keyword", "function"],
5353
["function", "baz"],
5454
["punctuation", "("],
55-
["parameter", [
56-
"x"
57-
]],
55+
["parameter", ["x"]],
5856
["punctuation", ")"],
5957
["punctuation", "{"],
6058
["punctuation", "}"],
@@ -63,18 +61,16 @@ a = function () {}, b = () => {}
6361
["operator", "="],
6462
["keyword", "async"],
6563
["punctuation", "("],
66-
["parameter", [
67-
"x"
68-
]],
64+
["parameter", ["x"]],
6965
["punctuation", ")"],
70-
["operator", "=>"], " x\r\n",
66+
["operator", "=>"],
67+
" x\r\n",
7168

7269
["function-variable", "fooBar"],
7370
["operator", "="],
74-
["parameter", [
75-
"x"
76-
]],
77-
["operator", "=>"], " x\r\n",
71+
["parameter", ["x"]],
72+
["operator", "=>"],
73+
" x\r\n",
7874

7975
["function-variable", "fooBar"],
8076
["operator", "="],
@@ -85,7 +81,8 @@ a = function () {}, b = () => {}
8581
" y"
8682
]],
8783
["punctuation", ")"],
88-
["operator", "=>"], " x\r\n",
84+
["operator", "=>"],
85+
" x\r\n",
8986

9087
["function-variable", "ಠ_ಠ"],
9188
["operator", "="],
@@ -118,10 +115,10 @@ a = function () {}, b = () => {}
118115
["punctuation", "("],
119116
["parameter", [
120117
["punctuation", "{"],
121-
" props",
118+
["literal-property", "props"],
122119
["operator", ":"],
123120
["punctuation", "{"],
124-
" a",
121+
["literal-property", "a"],
125122
["operator", ":"],
126123
" _A",
127124
["punctuation", ","],

‎tests/languages/javascript/function_feature.test

+64-13
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,70 @@ foo({ y: fun() })
1515
----------------------------------------------------
1616

1717
[
18-
["function", "foo"], ["punctuation", "("], ["punctuation", ")"],
19-
["function", "foo"], ["punctuation", "("], ["punctuation", ")"],
20-
["function", "foo"], ["punctuation", "."], ["function", "call"], ["punctuation", "("], ["punctuation", ")"],
21-
["function", "foo_bar"], ["punctuation", "("], ["punctuation", ")"],
22-
["function", "foo_bar"], ["punctuation", "("], ["punctuation", ")"],
23-
["function", "f42"], ["punctuation", "("], ["punctuation", ")"],
24-
["function", "_"], ["punctuation", "("], ["punctuation", ")"],
25-
["function", "$"], ["punctuation", "("], ["punctuation", ")"],
26-
["function", "ಠ_ಠ"], ["punctuation", "("], ["punctuation", ")"],
27-
["function", "Ƞȡ_҇"], ["punctuation", "("], ["punctuation", ")"],
28-
["keyword", "if"], ["punctuation", "("], "notAFunction", ["punctuation", ")"],
29-
["function", "foo"], ["punctuation", "("], ["punctuation", "{"], " x ", ["punctuation", "}"], ["punctuation", ")"],
30-
["function", "foo"], ["punctuation", "("], ["punctuation", "{"], " y", ["operator", ":"], ["function", "fun"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "}"], ["punctuation", ")"]
18+
["function", "foo"],
19+
["punctuation", "("],
20+
["punctuation", ")"],
21+
22+
["function", "foo"],
23+
["punctuation", "("],
24+
["punctuation", ")"],
25+
26+
["function", "foo"],
27+
["punctuation", "."],
28+
["function", "call"],
29+
["punctuation", "("],
30+
["punctuation", ")"],
31+
32+
["function", "foo_bar"],
33+
["punctuation", "("],
34+
["punctuation", ")"],
35+
36+
["function", "foo_bar"],
37+
["punctuation", "("],
38+
["punctuation", ")"],
39+
40+
["function", "f42"],
41+
["punctuation", "("],
42+
["punctuation", ")"],
43+
44+
["function", "_"],
45+
["punctuation", "("],
46+
["punctuation", ")"],
47+
48+
["function", "$"],
49+
["punctuation", "("],
50+
["punctuation", ")"],
51+
52+
["function", "ಠ_ಠ"],
53+
["punctuation", "("],
54+
["punctuation", ")"],
55+
56+
["function", "Ƞȡ_҇"],
57+
["punctuation", "("],
58+
["punctuation", ")"],
59+
60+
["keyword", "if"],
61+
["punctuation", "("],
62+
"notAFunction",
63+
["punctuation", ")"],
64+
65+
["function", "foo"],
66+
["punctuation", "("],
67+
["punctuation", "{"],
68+
" x ",
69+
["punctuation", "}"],
70+
["punctuation", ")"],
71+
72+
["function", "foo"],
73+
["punctuation", "("],
74+
["punctuation", "{"],
75+
["literal-property", "y"],
76+
["operator", ":"],
77+
["function", "fun"],
78+
["punctuation", "("],
79+
["punctuation", ")"],
80+
["punctuation", "}"],
81+
["punctuation", ")"]
3182
]
3283

3384
----------------------------------------------------

‎tests/languages/javascript/keyword_feature.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ assert.equal(foo, bar);
207207
["string", "\"./foo.json\""],
208208
["keyword", "assert"],
209209
["punctuation", "{"],
210-
" type",
210+
["literal-property", "type"],
211211
["operator", ":"],
212212
["string", "\"json\""],
213213
["punctuation", "}"],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{ foo: 0, bar: 0 };
2+
{ 'foo': 0, "bar": 0 };
3+
{
4+
// comment
5+
foo: 0,
6+
// comment
7+
"bar": 0
8+
}
9+
10+
const test = new TYPE.Application({
11+
key1: viewDim.x,
12+
key2: viewDim.y,
13+
key3: 0x89ddff,
14+
key4: window.devicePixelRatio || 1,
15+
key5: resize()
16+
});
17+
18+
// doesn't conflict with function properties
19+
{
20+
foo: () => 0,
21+
bar: async function () {}
22+
}
23+
24+
// no problem with keywords
25+
switch(foo) {
26+
default: return true;
27+
}
28+
29+
----------------------------------------------------
30+
31+
[
32+
["punctuation", "{"],
33+
["literal-property", "foo"],
34+
["operator", ":"],
35+
["number", "0"],
36+
["punctuation", ","],
37+
["literal-property", "bar"],
38+
["operator", ":"],
39+
["number", "0"],
40+
["punctuation", "}"],
41+
["punctuation", ";"],
42+
43+
["punctuation", "{"],
44+
["string-property", "'foo'"],
45+
["operator", ":"],
46+
["number", "0"],
47+
["punctuation", ","],
48+
["string-property", "\"bar\""],
49+
["operator", ":"],
50+
["number", "0"],
51+
["punctuation", "}"],
52+
["punctuation", ";"],
53+
54+
["punctuation", "{"],
55+
56+
["comment", "// comment"],
57+
58+
["literal-property", "foo"],
59+
["operator", ":"],
60+
["number", "0"],
61+
["punctuation", ","],
62+
63+
["comment", "// comment"],
64+
65+
["string-property", "\"bar\""],
66+
["operator", ":"],
67+
["number", "0"],
68+
69+
["punctuation", "}"],
70+
71+
["keyword", "const"],
72+
" test ",
73+
["operator", "="],
74+
["keyword", "new"],
75+
["class-name", [
76+
"TYPE",
77+
["punctuation", "."],
78+
"Application"
79+
]],
80+
["punctuation", "("],
81+
["punctuation", "{"],
82+
83+
["literal-property", "key1"],
84+
["operator", ":"],
85+
" viewDim",
86+
["punctuation", "."],
87+
"x",
88+
["punctuation", ","],
89+
90+
["literal-property", "key2"],
91+
["operator", ":"],
92+
" viewDim",
93+
["punctuation", "."],
94+
"y",
95+
["punctuation", ","],
96+
97+
["literal-property", "key3"],
98+
["operator", ":"],
99+
["number", "0x89ddff"],
100+
["punctuation", ","],
101+
102+
["literal-property", "key4"],
103+
["operator", ":"],
104+
" window",
105+
["punctuation", "."],
106+
"devicePixelRatio ",
107+
["operator", "||"],
108+
["number", "1"],
109+
["punctuation", ","],
110+
111+
["literal-property", "key5"],
112+
["operator", ":"],
113+
["function", "resize"],
114+
["punctuation", "("],
115+
["punctuation", ")"],
116+
117+
["punctuation", "}"],
118+
["punctuation", ")"],
119+
["punctuation", ";"],
120+
121+
["comment", "// doesn't conflict with function properties"],
122+
123+
["punctuation", "{"],
124+
125+
["function-variable", "foo"],
126+
["operator", ":"],
127+
["punctuation", "("],
128+
["punctuation", ")"],
129+
["operator", "=>"],
130+
["number", "0"],
131+
["punctuation", ","],
132+
133+
["function-variable", "bar"],
134+
["operator", ":"],
135+
["keyword", "async"],
136+
["keyword", "function"],
137+
["punctuation", "("],
138+
["punctuation", ")"],
139+
["punctuation", "{"],
140+
["punctuation", "}"],
141+
142+
["punctuation", "}"],
143+
144+
["comment", "// no problem with keywords"],
145+
146+
["keyword", "switch"],
147+
["punctuation", "("],
148+
"foo",
149+
["punctuation", ")"],
150+
["punctuation", "{"],
151+
152+
["keyword", "default"],
153+
["operator", ":"],
154+
["keyword", "return"],
155+
["boolean", "true"],
156+
["punctuation", ";"],
157+
158+
["punctuation", "}"]
159+
]

‎tests/languages/javascript/template-string_feature.test

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ console.log(`This is ${it.with({ type: false })}!`)
1818
["string", "foo bar"],
1919
["template-punctuation", "`"]
2020
]],
21+
2122
["template-string", [
2223
["template-punctuation", "`"],
2324
["string", "foo\r\nbar"],
2425
["template-punctuation", "`"]
2526
]],
27+
2628
["template-string", [
2729
["template-punctuation", "`"],
2830
["string", "40+2="],
@@ -35,6 +37,7 @@ console.log(`This is ${it.with({ type: false })}!`)
3537
]],
3638
["template-punctuation", "`"]
3739
]],
40+
3841
["template-string", [
3942
["template-punctuation", "`"],
4043
["interpolation", [
@@ -46,6 +49,7 @@ console.log(`This is ${it.with({ type: false })}!`)
4649
]],
4750
["template-punctuation", "`"]
4851
]],
52+
4953
["template-string", [
5054
["template-punctuation", "`"],
5155
["string", "\\${foo}"],
@@ -56,13 +60,16 @@ console.log(`This is ${it.with({ type: false })}!`)
5660
]],
5761
["template-punctuation", "`"]
5862
]],
63+
5964
["string", "\"foo `a` `b` `c` `d` bar\""],
65+
6066
["string", "\"test // test\""],
6167
["template-string", [
6268
["template-punctuation", "`"],
6369
["string", "template"],
6470
["template-punctuation", "`"]
6571
]],
72+
6673
"\r\n\r\nconsole",
6774
["punctuation", "."],
6875
["function", "log"],
@@ -77,7 +84,7 @@ console.log(`This is ${it.with({ type: false })}!`)
7784
["function", "with"],
7885
["punctuation", "("],
7986
["punctuation", "{"],
80-
" type",
87+
["literal-property", "type"],
8188
["operator", ":"],
8289
["boolean", "false"],
8390
["punctuation", "}"],
@@ -88,12 +95,13 @@ console.log(`This is ${it.with({ type: false })}!`)
8895
["template-punctuation", "`"]
8996
]],
9097
["punctuation", ")"],
98+
9199
["template-string", [
92100
["template-punctuation", "`"],
93101
["interpolation", [
94102
["interpolation-punctuation", "${"],
95103
["punctuation", "{"],
96-
"foo",
104+
["literal-property", "foo"],
97105
["operator", ":"],
98106
["string", "'bar'"],
99107
["punctuation", "}"],

‎tests/languages/jsx/issue1235.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
["script-punctuation", "="],
1414
["punctuation", "{"],
1515
["punctuation", "{"],
16-
" track",
16+
["literal-property", "track"],
1717
["operator", ":"],
1818
["boolean", "true"],
1919
["punctuation", "}"],

‎tests/languages/jsx/issue1335.test

+18-20
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,20 @@
1616
["punctuation", "<"],
1717
["class-name", "Button"]
1818
]],
19-
["attr-name", [
20-
"onClick"
21-
]],
19+
["attr-name", ["onClick"]],
2220
["script", [
2321
["script-punctuation", "="],
2422
["punctuation", "{"],
2523
["punctuation", "("],
26-
["parameter", [
27-
"e"
28-
]],
24+
["parameter", ["e"]],
2925
["punctuation", ")"],
3026
["operator", "=>"],
3127
["keyword", "this"],
3228
["punctuation", "."],
3329
["function", "setState"],
3430
["punctuation", "("],
3531
["punctuation", "{"],
36-
"clicked",
32+
["literal-property", "clicked"],
3733
["operator", ":"],
3834
["boolean", "true"],
3935
["punctuation", "}"],
@@ -42,51 +38,54 @@
4238
]],
4339
["punctuation", "/>"]
4440
]],
41+
4542
["tag", [
4643
["tag", [
4744
["punctuation", "<"],
4845
["class-name", "Component"]
4946
]],
50-
["attr-name", [
51-
"data"
52-
]],
47+
48+
["attr-name", ["data"]],
5349
["script", [
5450
["script-punctuation", "="],
5551
["punctuation", "{"],
5652
["punctuation", "["],
53+
5754
["punctuation", "{"],
58-
"id",
55+
["literal-property", "id"],
5956
["operator", ":"],
6057
["number", "0"],
6158
["punctuation", ","],
62-
" name",
59+
["literal-property", "name"],
6360
["operator", ":"],
6461
["string", "'Joe'"],
6562
["punctuation", "}"],
6663
["punctuation", ","],
64+
6765
["punctuation", "{"],
68-
"id",
66+
["literal-property", "id"],
6967
["operator", ":"],
7068
["number", "1"],
7169
["punctuation", ","],
72-
" name",
70+
["literal-property", "name"],
7371
["operator", ":"],
7472
["string", "'Sue'"],
7573
["punctuation", "}"],
7674
["punctuation", ","],
75+
7776
["punctuation", "]"],
7877
["punctuation", "}"]
7978
]],
79+
8080
["punctuation", "/>"]
8181
]],
82+
8283
["tag", [
8384
["tag", [
8485
["punctuation", "<"],
8586
["class-name", "Component"]
8687
]],
87-
["attr-name", [
88-
"title"
89-
]],
88+
["attr-name", ["title"]],
9089
["script", [
9190
["script-punctuation", "="],
9291
["punctuation", "{"],
@@ -103,14 +102,13 @@
103102
]],
104103
["punctuation", "/>"]
105104
]],
105+
106106
["tag", [
107107
["tag", [
108108
["punctuation", "<"],
109109
["class-name", "Component"]
110110
]],
111-
["attr-name", [
112-
"title"
113-
]],
111+
["attr-name", ["title"]],
114112
["script", [
115113
["script-punctuation", "="],
116114
["punctuation", "{"],

‎tests/languages/jsx/issue1408.test

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
["punctuation", "<"],
99
"div"
1010
]],
11-
["attr-name", [
12-
"style"
13-
]],
11+
["attr-name", ["style"]],
1412
["script", [
1513
["script-punctuation", "="],
1614
["punctuation", "{"],
1715
["punctuation", "{"],
18-
" marginLeft",
16+
["literal-property", "marginLeft"],
1917
["operator", ":"],
2018
["template-string", [
2119
["template-punctuation", "`"],

‎tests/languages/mongodb/document_feature.test

+174-228
Large diffs are not rendered by default.

‎tests/languages/pug/tag_feature.test

+32-13
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ a: span
2929
["function", "attributes"],
3030
["punctuation", "("],
3131
["punctuation", "{"],
32-
["string", "'data-foo'"],
32+
["string-property", "'data-foo'"],
3333
["operator", ":"],
3434
["string", "'bar'"],
3535
["punctuation", "}"],
@@ -43,11 +43,15 @@ a: span
4343
["punctuation", "("],
4444
["attr-name", "data-bar"],
4545
["punctuation", "="],
46-
["attr-value", [["string", "\"foo\""]]],
46+
["attr-value", [
47+
["string", "\"foo\""]
48+
]],
4749
["punctuation", ","],
4850
["attr-name", "type"],
4951
["punctuation", "="],
50-
["attr-value", [["string", "'checkbox'"]]],
52+
["attr-value", [
53+
["string", "'checkbox'"]
54+
]],
5155
["punctuation", ","],
5256
["attr-name", "checked"],
5357
["punctuation", ")"]
@@ -62,11 +66,11 @@ a: span
6266
["punctuation", "="],
6367
["attr-value", [
6468
["punctuation", "{"],
65-
"color",
69+
["literal-property", "color"],
6670
["operator", ":"],
6771
["string", "'red'"],
6872
["punctuation", ","],
69-
" background",
73+
["literal-property", "background"],
7074
["operator", ":"],
7175
["string", "'green'"],
7276
["punctuation", "}"]
@@ -81,30 +85,45 @@ a: span
8185
["punctuation", "("],
8286
["attr-name", "unescaped"],
8387
["punctuation", "!="],
84-
["attr-value", [["string", "\"<code>\""]]],
88+
["attr-value", [
89+
["string", "\"<code>\""]
90+
]],
8591
["punctuation", ")"]
8692
]]
8793
]],
8894

8995
["tag", [
9096
"a",
91-
["attr-class", ".button"]]],
92-
["tag", [["attr-class", ".content"]]],
97+
["attr-class", ".button"]
98+
]],
99+
["tag", [
100+
["attr-class", ".content"]
101+
]],
102+
93103
["tag", [
94104
"a",
95-
["attr-id", "#main-link"]]],
96-
["tag", [["attr-id", "#content"]]],
105+
["attr-id", "#main-link"]
106+
]],
107+
["tag", [
108+
["attr-id", "#content"]
109+
]],
110+
97111
["tag", [
98112
"div",
99113
["attr-id", "#test-id"],
100114
["attr-class", ".test-class1"],
101-
["attr-class", ".test-class2"]]],
115+
["attr-class", ".test-class2"]
116+
]],
102117
["tag", [
103118
["attr-class", ".test-class1"],
104119
["attr-id", "#test-id"],
105-
["attr-class", ".test-class2"]]],
120+
["attr-class", ".test-class2"]
121+
]],
106122

107-
["tag", ["a", ["punctuation", ":"]]],
123+
["tag", [
124+
"a",
125+
["punctuation", ":"]
126+
]],
108127
["tag", ["span"]]
109128
]
110129

0 commit comments

Comments
 (0)
Please sign in to comment.