Skip to content

Commit dde93f8

Browse files
committed
[css-syntax] Make url() be escapable. Actually return function tokens.
1 parent 34eab83 commit dde93f8

2 files changed

Lines changed: 125 additions & 79 deletions

File tree

css-syntax/Overview.html

Lines changed: 89 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -192,43 +192,46 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
192192
<li><a href="#consume-a-numeric-token"><span class=secno>4.3.2.
193193
</span> Consume a numeric token</a>
194194

195-
<li><a href="#consume-a-string-token"><span class=secno>4.3.3. </span>
195+
<li><a href="#consume-an-ident-like-token"><span class=secno>4.3.3.
196+
</span> Consume an ident-like token</a>
197+
198+
<li><a href="#consume-a-string-token"><span class=secno>4.3.4. </span>
196199
Consume a string token</a>
197200

198-
<li><a href="#consume-a-url-token-"><span class=secno>4.3.4. </span>
201+
<li><a href="#consume-a-url-token-"><span class=secno>4.3.5. </span>
199202
Consume a url token </a>
200203

201-
<li><a href="#consume-a-unicode-range-token"><span class=secno>4.3.5.
204+
<li><a href="#consume-a-unicode-range-token"><span class=secno>4.3.6.
202205
</span> Consume a unicode-range token</a>
203206

204-
<li><a href="#consume-an-escaped-character"><span class=secno>4.3.6.
207+
<li><a href="#consume-an-escaped-character"><span class=secno>4.3.7.
205208
</span> Consume an escaped character</a>
206209

207210
<li><a href="#check-if-two-characters-are-a-valid-esca"><span
208-
class=secno>4.3.7. </span> Check if two characters are a valid
211+
class=secno>4.3.8. </span> Check if two characters are a valid
209212
escape</a>
210213

211214
<li><a href="#check-if-three-characters-would-start-an"><span
212-
class=secno>4.3.8. </span> Check if three characters would start an
215+
class=secno>4.3.9. </span> Check if three characters would start an
213216
identifier</a>
214217

215218
<li><a href="#check-if-three-characters-would-start-a-"><span
216-
class=secno>4.3.9. </span> Check if three characters would start a
219+
class=secno>4.3.10. </span> Check if three characters would start a
217220
number</a>
218221

219-
<li><a href="#consume-a-name"><span class=secno>4.3.10. </span>
222+
<li><a href="#consume-a-name"><span class=secno>4.3.11. </span>
220223
Consume a name</a>
221224

222-
<li><a href="#consume-a-number"><span class=secno>4.3.11. </span>
225+
<li><a href="#consume-a-number"><span class=secno>4.3.12. </span>
223226
Consume a number</a>
224227

225-
<li><a href="#convert-a-string-to-a-number"><span class=secno>4.3.12.
228+
<li><a href="#convert-a-string-to-a-number"><span class=secno>4.3.13.
226229
</span> Convert a string to a number</a>
227230

228231
<li><a href="#consume-the-remnants-of-a-bad-url"><span
229-
class=secno>4.3.13. </span> Consume the remnants of a bad url</a>
232+
class=secno>4.3.14. </span> Consume the remnants of a bad url</a>
230233

231-
<li><a href="#set-the-unicode-ranges-range"><span class=secno>4.3.14.
234+
<li><a href="#set-the-unicode-ranges-range"><span class=secno>4.3.15.
232235
</span> Set the 〈unicode-range〉’s range</a>
233236
</ul>
234237

@@ -1575,9 +1578,9 @@ <h4 id=consume-a-token><span class=secno>4.3.1. </span> <dfn
15751578
href="#check-if-three-characters-would-start-an0"><i>starts with an
15761579
identifier</i></a>, <a
15771580
href="#reconsume-the-current-input-character"><i>reconsume the current
1578-
input character</i></a>, <a href="#consume-a-name0"><i>consume a
1579-
name</i></a>, create an ident〉 with its value set to the returned
1580-
value, and return it.
1581+
input character</i></a>, <a
1582+
href="#consume-an-ident-like-token0"><i>consume an ident-like
1583+
token</i></a>, and return it.
15811584

15821585
<p> Otherwise, if the <a href="#next-input-character"><i
15831586
title="next input character">next 2 input characters</i></a> are U+002D
@@ -1646,9 +1649,9 @@ <h4 id=consume-a-token><span class=secno>4.3.1. </span> <dfn
16461649
href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
16471650
escape</i></a>, <a
16481651
href="#reconsume-the-current-input-character"><i>reconsume the current
1649-
input character</i></a>, <a href="#consume-a-name0"><i>consume a
1650-
name</i></a>, create an ident〉 with its value set to the returned
1651-
value, and return it.
1652+
input character</i></a>, <a
1653+
href="#consume-an-ident-like-token0"><i>consume an ident-like
1654+
token</i></a>, and return it.
16521655
<p> Otherwise, this is a <a href="#parse-errors"><i>parse error</i></a>.
16531656
Return a 〈delim〉 with its value set to the <a
16541657
href="#current-input-character"><i>current input character</i></a>.
@@ -1690,24 +1693,18 @@ <h4 id=consume-a-token><span class=secno>4.3.1. </span> <dfn
16901693
class=note>Note: don't consume both of them.</span> <a
16911694
href="#consume-a-unicode-range-token0"><i>Consume a unicode-range
16921695
token</i></a> and return it.
1693-
<p> Otherwise, if the <a href="#next-input-character"><i
1694-
title="next input character">next 3 input characters</i></a> are an
1695-
<i>ASCII case-insensitive match</i> for "url(", consume them, <a
1696-
href="#consume-a-url-token"><i>consume a url token</i></a>, and return
1697-
it.
1698-
16991696
<p> Otherwise, <a
17001697
href="#reconsume-the-current-input-character"><i>reconsume the current
1701-
input character</i></a>, <a href="#consume-a-name0"><i>consume a
1702-
name</i></a>, create an ident〉 with its value set to the returned
1703-
value, and return it.
1698+
input character</i></a>, <a
1699+
href="#consume-an-ident-like-token0"><i>consume an ident-like
1700+
token</i></a>, and return it.
17041701

17051702
<dt><a href="#name-start-character"><i>name-start character</i></a>
17061703

17071704
<dd> <a href="#reconsume-the-current-input-character"><i>Reconsume the
1708-
current input character</i></a>, <a href="#consume-a-name0"><i>consume a
1709-
name</i></a>, create an ident〉 with its value set to the returned
1710-
value, and return it.
1705+
current input character</i></a>, <a
1706+
href="#consume-an-ident-like-token0"><i>consume an ident-like
1707+
token</i></a>, and return it.
17111708

17121709
<dt>U+007C VERTICAL LINE (|)
17131710

@@ -1773,7 +1770,31 @@ <h4 id=consume-a-numeric-token><span class=secno>4.3.2. </span> <dfn
17731770
<p> Otherwise, create a 〈number〉 with the same representation, value,
17741771
and type flag as the returned number, and return it.
17751772

1776-
<h4 id=consume-a-string-token><span class=secno>4.3.3. </span> <dfn
1773+
<h4 id=consume-an-ident-like-token><span class=secno>4.3.3. </span> <dfn
1774+
id=consume-an-ident-like-token0>Consume an ident-like token</dfn></h4>
1775+
1776+
<p> This section describes how to <a
1777+
href="#consume-an-ident-like-token0"><i>consume an ident-like
1778+
token</i></a> from a stream of characters. It returns an 〈ident〉,
1779+
〈function〉, 〈url〉, or 〈bad-url〉.
1780+
1781+
<p> <a href="#consume-a-name0"><i>Consume a name</i></a>.
1782+
1783+
<p> If the returned string's value is an <a
1784+
href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match for
1785+
"url", and the <a href="#next-input-character"><i>next input
1786+
character</i></a> is U+0028 LEFT PARENTHESIS ((), consume it. <a
1787+
href="#consume-a-url-token"><i>Consume a url token</i></a>, and return it.
1788+
1789+
<p> Otherwise, if the <a href="#next-input-character"><i>next input
1790+
character</i></a> is U+0028 LEFT PARENTHESIS ((), consume it. Create a
1791+
〈function〉 token with its value set to the returned string and return
1792+
it.
1793+
1794+
<p> Otherwise, create an 〈ident〉 token with its value set to the
1795+
returned string and return it.
1796+
1797+
<h4 id=consume-a-string-token><span class=secno>4.3.4. </span> <dfn
17771798
id=consume-a-string-token0>Consume a string token</dfn></h4>
17781799

17791800
<p> This section describes how to <a
@@ -1820,7 +1841,7 @@ <h4 id=consume-a-string-token><span class=secno>4.3.3. </span> <dfn
18201841
character</i></a> to the 〈string〉’s value.
18211842
</dl>
18221843

1823-
<h4 id=consume-a-url-token-><span class=secno>4.3.4. </span> <dfn
1844+
<h4 id=consume-a-url-token-><span class=secno>4.3.5. </span> <dfn
18241845
id=consume-a-url-token>Consume a url token</dfn></h4>
18251846

18261847
<p> This section describes how to <a href="#consume-a-url-token"><i>consume
@@ -1915,7 +1936,7 @@ <h4 id=consume-a-url-token-><span class=secno>4.3.4. </span> <dfn
19151936
character</i></a> to the 〈url〉’s value.
19161937
</dl>
19171938

1918-
<h4 id=consume-a-unicode-range-token><span class=secno>4.3.5. </span>
1939+
<h4 id=consume-a-unicode-range-token><span class=secno>4.3.6. </span>
19191940
<dfn id=consume-a-unicode-range-token0>Consume a unicode-range
19201941
token</dfn></h4>
19211942

@@ -1975,7 +1996,7 @@ <h4 id=consume-a-unicode-range-token><span class=secno>4.3.5. </span>
19751996

19761997
<li> <a href="#set-the-unicode-ranges-range0"><i>Set the
19771998
〈unicode-range〉’s range</i></a> and return it.
1978-
<h4 id=consume-an-escaped-character><span class=secno>4.3.6. </span>
1999+
<h4 id=consume-an-escaped-character><span class=secno>4.3.7. </span>
19792000
<dfn id=consume-an-escaped-character0>Consume an escaped
19802001
character</dfn></h4>
19812002

@@ -2010,7 +2031,7 @@ <h4 id=consume-an-escaped-character><span class=secno>4.3.6. </span>
20102031
</dl>
20112032

20122033
<h4 id=check-if-two-characters-are-a-valid-esca><span
2013-
class=secno>4.3.7. </span> <dfn
2034+
class=secno>4.3.8. </span> <dfn
20142035
id=check-if-two-characters-are-a-valid-esca0
20152036
title="check if two characters are a valid escape|are a valid escape|starts with a valid escape">Check
20162037
if two characters are a valid escape</dfn></h4>
@@ -2036,7 +2057,7 @@ <h4 id=check-if-two-characters-are-a-valid-esca><span
20362057
<p> Otherwise, return true.
20372058

20382059
<h4 id=check-if-three-characters-would-start-an><span
2039-
class=secno>4.3.8. </span> <dfn
2060+
class=secno>4.3.9. </span> <dfn
20402061
id=check-if-three-characters-would-start-an0
20412062
title="check if three characters would start an identifier|starts with an identifier|start with an identifier|would start an identifier">Check
20422063
if three characters would start an identifier</dfn></h4>
@@ -2077,7 +2098,7 @@ <h4 id=check-if-three-characters-would-start-an><span
20772098
</dl>
20782099

20792100
<h4 id=check-if-three-characters-would-start-a-><span
2080-
class=secno>4.3.9. </span> <dfn
2101+
class=secno>4.3.10. </span> <dfn
20812102
id=check-if-three-characters-would-start-a-0
20822103
title="check if three characters would start a number|starts with a number|start with a number|would start a number">Check
20832104
if three characters would start a number</dfn></h4>
@@ -2124,7 +2145,7 @@ <h4 id=check-if-three-characters-would-start-a-><span
21242145
<dd> Return false.
21252146
</dl>
21262147

2127-
<h4 id=consume-a-name><span class=secno>4.3.10. </span> <dfn
2148+
<h4 id=consume-a-name><span class=secno>4.3.11. </span> <dfn
21282149
id=consume-a-name0>Consume a name</dfn></h4>
21292150

21302151
<p> This section describes how to <a href="#consume-a-name0"><i>consume
@@ -2162,7 +2183,7 @@ <h4 id=consume-a-name><span class=secno>4.3.10. </span> <dfn
21622183
<dd> Return <var>result</var>.
21632184
</dl>
21642185

2165-
<h4 id=consume-a-number><span class=secno>4.3.11. </span> <dfn
2186+
<h4 id=consume-a-number><span class=secno>4.3.12. </span> <dfn
21662187
id=consume-a-number0>Consume a number</dfn></h4>
21672188

21682189
<p> This section describes how to <a
@@ -2230,7 +2251,7 @@ <h4 id=consume-a-number><span class=secno>4.3.11. </span> <dfn
22302251
<var>type</var>.
22312252
</ol>
22322253

2233-
<h4 id=convert-a-string-to-a-number><span class=secno>4.3.12. </span>
2254+
<h4 id=convert-a-string-to-a-number><span class=secno>4.3.13. </span>
22342255
<dfn id=convert-a-string-to-a-number0>Convert a string to a
22352256
number</dfn></h4>
22362257

@@ -2282,7 +2303,7 @@ <h4 id=convert-a-string-to-a-number><span class=secno>4.3.12. </span>
22822303
<p> Return the number <code>s × (i + f·10<sup>-d</sup>) ×
22832304
10<sup>te</sup></code>.
22842305

2285-
<h4 id=consume-the-remnants-of-a-bad-url><span class=secno>4.3.13.
2306+
<h4 id=consume-the-remnants-of-a-bad-url><span class=secno>4.3.14.
22862307
</span> <dfn id=consume-the-remnants-of-a-bad-url0>Consume the
22872308
remnants of a bad url</dfn></h4>
22882309

@@ -2316,7 +2337,7 @@ <h4 id=consume-the-remnants-of-a-bad-url><span class=secno>4.3.13.
23162337
<dd> Do nothing.
23172338
</dl>
23182339

2319-
<h4 id=set-the-unicode-ranges-range><span class=secno>4.3.14. </span>
2340+
<h4 id=set-the-unicode-ranges-range><span class=secno>4.3.15. </span>
23202341
<dfn id=set-the-unicode-ranges-range0>Set the 〈unicode-range〉’s
23212342
range</dfn></h4>
23222343

@@ -4123,7 +4144,7 @@ <h2 class=no-num id=index> Index</h2>
41234144

41244145
<li>are a valid escape, <a
41254146
href="#check-if-two-characters-are-a-valid-esca0"
4126-
title="section 4.3.7."><strong>4.3.7.</strong></a>
4147+
title="section 4.3.8."><strong>4.3.8.</strong></a>
41274148

41284149
<li>ASCII case-insensitive, <a href="#ascii-case-insensitive"
41294150
title="section 5.2."><strong>5.2.</strong></a>
@@ -4139,15 +4160,15 @@ <h2 class=no-num id=index> Index</h2>
41394160

41404161
<li>check if three characters would start an identifier, <a
41414162
href="#check-if-three-characters-would-start-an0"
4142-
title="section 4.3.8."><strong>4.3.8.</strong></a>
4163+
title="section 4.3.9."><strong>4.3.9.</strong></a>
41434164

41444165
<li>check if three characters would start a number, <a
41454166
href="#check-if-three-characters-would-start-a-0"
4146-
title="section 4.3.9."><strong>4.3.9.</strong></a>
4167+
title="section 4.3.10."><strong>4.3.10.</strong></a>
41474168

41484169
<li>check if two characters are a valid escape, <a
41494170
href="#check-if-two-characters-are-a-valid-esca0"
4150-
title="section 4.3.7."><strong>4.3.7.</strong></a>
4171+
title="section 4.3.8."><strong>4.3.8.</strong></a>
41514172

41524173
<li>component value, <a href="#component-value"
41534174
title="section 5."><strong>5.</strong></a>
@@ -4169,17 +4190,21 @@ <h2 class=no-num id=index> Index</h2>
41694190
title="section 5.4.1."><strong>5.4.1.</strong></a>
41704191

41714192
<li>Consume a name, <a href="#consume-a-name0"
4172-
title="section 4.3.10."><strong>4.3.10.</strong></a>
4193+
title="section 4.3.11."><strong>4.3.11.</strong></a>
41734194

41744195
<li>Consume an at-rule, <a href="#consume-an-at-rule0"
41754196
title="section 5.4.2."><strong>5.4.2.</strong></a>
41764197

41774198
<li>Consume an escaped character, <a
41784199
href="#consume-an-escaped-character0"
4179-
title="section 4.3.6."><strong>4.3.6.</strong></a>
4200+
title="section 4.3.7."><strong>4.3.7.</strong></a>
4201+
4202+
<li>Consume an ident-like token, <a
4203+
href="#consume-an-ident-like-token0"
4204+
title="section 4.3.3."><strong>4.3.3.</strong></a>
41804205

41814206
<li>Consume a number, <a href="#consume-a-number0"
4182-
title="section 4.3.11."><strong>4.3.11.</strong></a>
4207+
title="section 4.3.12."><strong>4.3.12.</strong></a>
41834208

41844209
<li>Consume a numeric token, <a href="#consume-a-numeric-token0"
41854210
title="section 4.3.2."><strong>4.3.2.</strong></a>
@@ -4191,25 +4216,25 @@ <h2 class=no-num id=index> Index</h2>
41914216
title="section 5.4.7."><strong>5.4.7.</strong></a>
41924217

41934218
<li>Consume a string token, <a href="#consume-a-string-token0"
4194-
title="section 4.3.3."><strong>4.3.3.</strong></a>
4219+
title="section 4.3.4."><strong>4.3.4.</strong></a>
41954220

41964221
<li>Consume a token, <a href="#consume-a-token0"
41974222
title="section 4.3.1."><strong>4.3.1.</strong></a>
41984223

41994224
<li>Consume a unicode-range token, <a
42004225
href="#consume-a-unicode-range-token0"
4201-
title="section 4.3.5."><strong>4.3.5.</strong></a>
4226+
title="section 4.3.6."><strong>4.3.6.</strong></a>
42024227

42034228
<li>Consume a url token, <a href="#consume-a-url-token"
4204-
title="section 4.3.4."><strong>4.3.4.</strong></a>
4229+
title="section 4.3.5."><strong>4.3.5.</strong></a>
42054230

42064231
<li>Consume the remnants of a bad url, <a
42074232
href="#consume-the-remnants-of-a-bad-url0"
4208-
title="section 4.3.13."><strong>4.3.13.</strong></a>
4233+
title="section 4.3.14."><strong>4.3.14.</strong></a>
42094234

42104235
<li>Convert a string to a number, <a
42114236
href="#convert-a-string-to-a-number0"
4212-
title="section 4.3.12."><strong>4.3.12.</strong></a>
4237+
title="section 4.3.13."><strong>4.3.13.</strong></a>
42134238

42144239
<li>current input character, <a href="#current-input-character"
42154240
title="section 4.2."><strong>4.2.</strong></a>
@@ -4237,7 +4262,7 @@ <h2 class=no-num id=index> Index</h2>
42374262
title="section 5.4.7."><strong>5.4.7.</strong></a>
42384263

42394264
<li>end of the range, <a href="#end-of-the-range"
4240-
title="section 4.3.14."><strong>4.3.14.</strong></a>
4265+
title="section 4.3.15."><strong>4.3.15.</strong></a>
42414266

42424267
<li>〈EOF〉, <a href="#eof"
42434268
title="section 5.2."><strong>5.2.</strong></a>
@@ -4340,7 +4365,7 @@ <h2 class=no-num id=index> Index</h2>
43404365

43414366
<li>Set the 〈unicode-range〉’s range, <a
43424367
href="#set-the-unicode-ranges-range0"
4343-
title="section 4.3.14."><strong>4.3.14.</strong></a>
4368+
title="section 4.3.15."><strong>4.3.15.</strong></a>
43444369

43454370
<li><code>&lt;signed-integer></code>, <a href="#ltsigned-integer"
43464371
title="section 6.2."><strong>6.2.</strong></a>
@@ -4352,27 +4377,27 @@ <h2 class=no-num id=index> Index</h2>
43524377
title="section 5."><strong>5.</strong></a>
43534378

43544379
<li>start of the range, <a href="#start-of-the-range"
4355-
title="section 4.3.14."><strong>4.3.14.</strong></a>
4380+
title="section 4.3.15."><strong>4.3.15.</strong></a>
43564381

43574382
<li>starts with an identifier, <a
43584383
href="#check-if-three-characters-would-start-an0"
4359-
title="section 4.3.8."><strong>4.3.8.</strong></a>
4384+
title="section 4.3.9."><strong>4.3.9.</strong></a>
43604385

43614386
<li>starts with a number, <a
43624387
href="#check-if-three-characters-would-start-a-0"
4363-
title="section 4.3.9."><strong>4.3.9.</strong></a>
4388+
title="section 4.3.10."><strong>4.3.10.</strong></a>
43644389

43654390
<li>starts with a valid escape, <a
43664391
href="#check-if-two-characters-are-a-valid-esca0"
4367-
title="section 4.3.7."><strong>4.3.7.</strong></a>
4392+
title="section 4.3.8."><strong>4.3.8.</strong></a>
43684393

43694394
<li>start with an identifier, <a
43704395
href="#check-if-three-characters-would-start-an0"
4371-
title="section 4.3.8."><strong>4.3.8.</strong></a>
4396+
title="section 4.3.9."><strong>4.3.9.</strong></a>
43724397

43734398
<li>start with a number, <a
43744399
href="#check-if-three-characters-would-start-a-0"
4375-
title="section 4.3.9."><strong>4.3.9.</strong></a>
4400+
title="section 4.3.10."><strong>4.3.10.</strong></a>
43764401

43774402
<li><var>&lt;stylesheet></var>, <a href="#ltstylesheet"
43784403
title="section 7.1."><strong>7.1.</strong></a>
@@ -4391,11 +4416,11 @@ <h2 class=no-num id=index> Index</h2>
43914416

43924417
<li>would start an identifier, <a
43934418
href="#check-if-three-characters-would-start-an0"
4394-
title="section 4.3.8."><strong>4.3.8.</strong></a>
4419+
title="section 4.3.9."><strong>4.3.9.</strong></a>
43954420

43964421
<li>would start a number, <a
43974422
href="#check-if-three-characters-would-start-a-0"
4398-
title="section 4.3.9."><strong>4.3.9.</strong></a>
4423+
title="section 4.3.10."><strong>4.3.10.</strong></a>
43994424
</ul>
44004425
<!--end-index-->
44014426
<h2 class=no-num id=property-index> Property index</h2>

0 commit comments

Comments
 (0)