Skip to content

Commit 5960123

Browse files
committed
Merge css-parsing-tests commit '86d34b729978df74bc91a66ce0e2951187a1005c' into incremental
2 parents 14b5a4c + 86d34b7 commit 5960123

File tree

5 files changed

+81
-29
lines changed

5 files changed

+81
-29
lines changed

src/css-parsing-tests/An+B.json

+5
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@
5454
"- 14N-1 ", null,
5555
"3.1n-1", null,
5656
"3 n-1", null,
57+
"3n-1foo", null,
5758

5859
" n-1", [1, -1],
5960
" +n-1", [1, -1],
6061
" -n-1", [-1, -1],
6162
"+ n-1", null,
6263
"- n-1", null,
64+
" +n-1foo", null,
65+
" -n-1foo", null,
6366

6467

6568
"3N +1", [3, 1],
@@ -69,6 +72,8 @@
6972
"- 14n +1 ", null,
7073
"3.1N +1", null,
7174
"3 n +1", null,
75+
"3n foo", null,
76+
"3n + foo", null,
7277

7378
" n +1", [1, 1],
7479
" +N +1", [1, 1],

src/css-parsing-tests/component_value_list.json

+33-25
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
["ident", "red--"], ">"
2323
],
2424

25-
"red0 -red --red -\\-red\\ blue 0red -0red \u0000red _Red .red rêd r\\êd \u007F\u0080\u0081", [
25+
"\\- red0 -red --red -\\-red\\ blue 0red -0red \u0000red _Red .red rêd r\\êd \u007F\u0080\u0081", [
26+
["ident", "-"], " ",
2627
["ident", "red0"], " ",
2728
["ident", "-red"], " ",
28-
"-", ["ident", "-red"], " ",
29+
["ident", "--red"], " ",
2930
["ident", "--red blue"], " ",
3031
["dimension", "0", 0, "integer", "red"], " ",
3132
["dimension", "-0", 0, "integer", "red"], " ",
@@ -54,7 +55,7 @@
5455
"rgba0() -rgba() --rgba() -\\-rgba() 0rgba() -0rgba() _rgba() .rgba() rgbâ() \\30rgba() rgba () @rgba() #rgba()", [
5556
["function", "rgba0"], " ",
5657
["function", "-rgba"], " ",
57-
"-", ["function", "-rgba"], " ",
58+
["function", "--rgba"], " ",
5859
["function", "--rgba"], " ",
5960
["dimension", "0", 0, "integer", "rgba"], ["()"], " ",
6061
["dimension", "-0", 0, "integer", "rgba"], ["()"], " ",
@@ -70,7 +71,7 @@
7071
"@media0 @-Media @--media @-\\-media @0media @-0media @_media @.media @medİa @\\30 media\\", [
7172
["at-keyword", "media0"], " ",
7273
["at-keyword", "-Media"], " ",
73-
"@", "-", ["ident", "-media"], " ",
74+
["at-keyword", "--media"], " ",
7475
["at-keyword", "--media"], " ",
7576
"@", ["dimension", "0", 0, "integer", "media"], " ",
7677
"@", ["dimension", "-0", 0, "integer", "media"], " ",
@@ -80,16 +81,17 @@
8081
["at-keyword", "0media\uFFFD"]
8182
],
8283

83-
"#red0 #-Red #--red #-\\-red #0red #-0red #_Red #.red #rêd #\\.red\\", [
84+
"#red0 #-Red #--red #-\\-red #0red #-0red #_Red #.red #rêd #êrd #\\.red\\", [
8485
["hash", "red0", "id"], " ",
8586
["hash", "-Red", "id"], " ",
86-
["hash", "--red", "unrestricted"], " ",
87+
["hash", "--red", "id"], " ",
8788
["hash", "--red", "id"], " ",
8889
["hash", "0red", "unrestricted"], " ",
8990
["hash", "-0red", "unrestricted"], " ",
9091
["hash", "_Red", "id"], " ",
9192
"#", ".", ["ident", "red"], " ",
9293
["hash", "rêd", "id"], " ",
94+
["hash", "êrd", "id"], " ",
9395
["hash", ".red\uFFFD", "id"]
9496
],
9597

@@ -120,12 +122,12 @@
120122
["string", "Ͷ76Ͷ76"]
121123
],
122124

123-
"url( '') url('Lorem \"îpsum\"'\n) url('a\\\nb' ) url('a\nb' \\){ ) url('eof", [
124-
["url", ""], " ",
125-
["url", "Lorem \"îpsum\""], " ",
126-
["url", "ab"], " ",
127-
["error", "bad-url"], " ",
128-
["url", "eof"]
125+
"url( '') url('Lorem \"îpsum\"'\n) url('a\\\nb' ) url('a\nb) url('eof", [
126+
["function", "url", " ", ["string", ""]], " ",
127+
["function", "url", ["string", "Lorem \"îpsum\""], " "], " ",
128+
["function", "url", ["string", "ab"], " "], " ",
129+
["function", "url", ["error", "bad-string"], " ", ["ident", "b"]], " ",
130+
["function", "url", ["string", "eof"]]
129131
],
130132

131133
"url(", [
@@ -136,17 +138,17 @@
136138
["url", ""]
137139
],
138140

139-
"url(\"\") url(\"Lorem 'îpsum'\"\n) url(\"a\\\nb\" ) url(\"a\nb\" \\){ ) url(\"eof", [
140-
["url", ""], " ",
141-
["url", "Lorem 'îpsum'"], " ",
142-
["url", "ab"], " ",
143-
["error", "bad-url"], " ",
144-
["url", "eof"]
141+
"url(\"\") url(\"Lorem 'îpsum'\"\n) url(\"a\\\nb\" ) url(\"a\nb) url(\"eof", [
142+
["function", "url", ["string", ""]], " ",
143+
["function", "url", ["string", "Lorem 'îpsum'"], " "], " ",
144+
["function", "url", ["string", "ab"], " "], " ",
145+
["function", "url", ["error", "bad-string"], " ", ["ident", "b"]], " ",
146+
["function", "url", ["string", "eof"]]
145147
],
146148

147149
"url(\"Lo\\rem \\130 ps\\u m\") url('\\376\\37 6\\000376\\0000376\\", [
148-
["url", "Lorem İpsu m"], " ",
149-
["url", "Ͷ76Ͷ76"]
150+
["function", "url", ["string", "Lorem İpsu m"]], " ",
151+
["function", "url", ["string", "Ͷ76Ͷ76"]]
150152
],
151153

152154
"URL(foo) Url(foo) ûrl(foo) url (foo) url\\ (foo) url(\t 'foo' ", [
@@ -155,12 +157,18 @@
155157
["function", "ûrl", ["ident", "foo"]], " ",
156158
["ident", "url"], " ", ["()", ["ident", "foo"]], " ",
157159
["function", "url ", ["ident", "foo"]], " ",
158-
["url", "foo"]
160+
["function", "url", " ", ["string", "foo"], " "]
159161
],
160162

161-
"url('a' b) url('c' d)", [["error", "bad-url"], " ", ["error", "bad-url"]],
163+
"url('a' b) url('c' d)", [
164+
["function", "url", ["string", "a"], " ", ["ident", "b"]], " ",
165+
["function", "url", ["string", "c"], " ", ["ident", "d"]]
166+
],
162167

163-
"url('a\nb') url('c\n", [["error", "bad-url"], " ", ["error", "bad-url"]],
168+
"url('a\nb) url('c\n", [
169+
["function", "url", ["error", "bad-string"], " ", ["ident", "b"]], " ",
170+
["function", "url", ["error", "bad-string"], " "]
171+
],
164172

165173
"url() url( \t) url(\n Foô\\030\n!\n) url(\na\nb\n) url(a\\ b) url(a(b) url(a\\(b) url(a'b) url(a\\'b) url(a\"b) url(a\\\"b) url(a\nb) url(a\\\nb) url(a\\a b) url(a\\", [
166174
["url", ""], " ",
@@ -307,7 +315,7 @@
307315
"12red0 12.0-red 12--red 12-\\-red 120red 12-0red 12\u0000red 12_Red 12.red 12rêd", [
308316
["dimension", "12", 12, "integer", "red0"], " ",
309317
["dimension", "12.0", 12, "number", "-red"], " ",
310-
["number", "12", 12, "integer"], "-", ["ident", "-red"], " ",
318+
["dimension", "12", 12, "integer", "--red"], " ",
311319
["dimension", "12", 12, "integer", "--red"], " ",
312320
["dimension", "120", 120, "integer", "red"], " ",
313321
["number", "12", 12, "integer"], ["dimension", "-0", 0, "integer", "red"], " ",
@@ -391,7 +399,7 @@
391399
],
392400

393401
"~=|=^=$=*=||<!------> |/**/| ~/**/=", [
394-
"~=", "|=", "^=", "$=", "*=", "||", "<!--", "-", "-", "-->",
402+
"~=", "|=", "^=", "$=", "*=", "||", "<!--", ["ident", "----"], ">",
395403
" ", "|", "|", " ", "~", "="
396404
],
397405

src/css-parsing-tests/declaration_list.json

+15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
["declaration", "c", [["ident", "d"], " ", ["number", "42", 42, "integer"]], true]
88
],
99

10+
"z;a:b", [
11+
["error", "invalid"],
12+
["declaration", "a", [["ident", "b"]], false]
13+
],
14+
15+
"z:x!;a:b", [
16+
["declaration", "z", [["ident", "x"], "!"], false],
17+
["declaration", "a", [["ident", "b"]], false]
18+
],
19+
20+
"a:b; c+:d", [
21+
["declaration", "a", [["ident", "b"]], false],
22+
["error", "invalid"]
23+
],
24+
1025
"@import 'foo.css'; a:b; @import 'bar.css'", [
1126
["at-rule", "import", [" ", ["string", "foo.css"]], null],
1227
["declaration", "a", [["ident", "b"]], false],

src/css-parsing-tests/one_declaration.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"foo:", ["declaration", "foo", [], false],
1313
"foo :", ["declaration", "foo", [], false],
1414
"\n/**/ foo: ", ["declaration", "foo", [" "], false],
15-
"foo:;", ["declaration", "foo", [], false],
15+
"foo:;", ["declaration", "foo", [";"], false],
1616
" /**/ foo /**/ :", ["declaration", "foo", [], false],
17-
"foo:;bar:;", ["error", "extra-input"],
17+
"foo:;bar:;", ["declaration", "foo", [";", ["ident", "bar"], ":", ";"], false],
1818

1919
"foo: 9000 !Important", ["declaration", "foo", [
2020
" ", ["number", "9000", 9000, "integer"], " "
@@ -23,8 +23,12 @@
2323
" ", ["number", "9000", 9000, "integer"], " "
2424
], true],
2525

26-
"foo: 9000 /* Dotted capital I */!İmportant", ["error", "invalid"],
27-
"foo: 9000 !important!", ["error", "invalid"],
26+
"foo: 9000 /* Dotted capital I */!İmportant", ["declaration", "foo", [
27+
" ", ["number", "9000", 9000, "integer"], " ", "!", ["ident", "İmportant"]
28+
], false],
29+
"foo: 9000 !important!", ["declaration", "foo", [
30+
" ", ["number", "9000", 9000, "integer"], " ", "!", ["ident", "important"], "!"
31+
], false],
2832

2933
"foo: 9000 important", ["declaration", "foo", [
3034
" ", ["number", "9000", 9000, "integer"], " ", ["ident", "important"]

src/css-parsing-tests/stylesheet_bytes.json

+20
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
["at-rule", "", [], null]],
6464
"utf-8"],
6565

66+
{"css_bytes": "@charset \"ISO-8859-5\" ; @\u00E9",
67+
"comment": "@charset has to match an exact byte pattern"},
68+
[[["at-rule", "charset", [" ", ["string", "ISO-8859-5"], " "], null],
69+
["at-rule", "", [], null]],
70+
"utf-8"],
71+
6672

6773
{"css_bytes": "@\u0000c\u0000h\u0000a\u0000r\u0000s\u0000e\u0000t\u0000 \u0000\"\u0000U\u0000T\u0000F\u0000-\u00001\u00006\u0000L\u0000E\u0000\"\u0000;\u0000@\u0000\u00e9\u0000",
6874
"comment": "@charset has to be ASCII-compatible itself"},
@@ -97,6 +103,13 @@
97103
["at-rule", "é", [], null]],
98104
"iso-8859-2"],
99105

106+
{"css_bytes": "@charset \"ISO-8859-5\"; @\u00E9",
107+
"protocol_encoding": "kamoulox",
108+
"comment": "Unknow protocol encoding falls back to @charset"},
109+
[[["at-rule", "charset", [" ", ["string", "ISO-8859-5"]], null],
110+
["at-rule", "щ", [], null]],
111+
"iso-8859-5"],
112+
100113

101114
{"css_bytes": "@\u00E9", "environment_encoding": "ISO-8859-2"},
102115
[[["at-rule", "é", [], null]], "iso-8859-2"],
@@ -111,6 +124,13 @@
111124
["at-rule", "щ", [], null]],
112125
"iso-8859-5"],
113126

127+
{"css_bytes": "@charset \"kamoulox\"; @\u00E9",
128+
"environment_encoding": "ISO-8859-2",
129+
"comment": "@character with unknown encoding falls back to environment encoding"},
130+
[[["at-rule", "charset", [" ", ["string", "kamoulox"]], null],
131+
["at-rule", "é", [], null]],
132+
"iso-8859-2"],
133+
114134
{"css_bytes": "@\u00E9",
115135
"protocol_encoding": "ISO-8859-2",
116136
"environment_encoding": "ISO-8859-5",

0 commit comments

Comments
 (0)