Skip to content

Commit 05c4bfa

Browse files
committed
[css-syntax] Switch quoted urls to returning a <function-token>, so we can extend the grammar of the function later.
--HG-- extra : rebase_source : 9e9acad72c65189f44a418e85ef72633269fee56
1 parent adb9dac commit 05c4bfa

File tree

2 files changed

+52
-93
lines changed

2 files changed

+52
-93
lines changed

css-syntax/Overview.bs

+10-31
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,16 @@ Consume an ident-like token</h4>
12141214
If the returned string's value is an <a>ASCII case-insensitive</a> match for "url",
12151215
and the <a>next input code point</a> is U+0028 LEFT PARENTHESIS ((),
12161216
consume it.
1217-
<a>Consume a url token</a>,
1217+
While the <a>next input code point</a> is <a>whitespace</a>,
1218+
consume it.
1219+
If the <a>next input token</a> is U+0022 QUOTATION MARK (")
1220+
or U+0027 APOSTROPHE (&apos;),
1221+
<a>reconsume the current input code point</a>,
1222+
then create a <<function-token>>
1223+
with its value set to the returned string
1224+
and return it.
1225+
Otherwise,
1226+
<a>consume a url token</a>,
12181227
and return it.
12191228

12201229
Otherwise,
@@ -1298,36 +1307,6 @@ Consume a url token</h4>
12981307
If the <a>next input code point</a> is EOF,
12991308
return the <<url-token>>.
13001309

1301-
<li>
1302-
If the <a>next input code point</a> is a U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE (&apos;),
1303-
then:
1304-
1305-
<ol>
1306-
<li>
1307-
Consume the <a>next input code point</a>,
1308-
then <a>consume a string token</a>.
1309-
1310-
<li>
1311-
If a <<bad-string-token>> was returned,
1312-
<a>consume the remnants of a bad url</a>,
1313-
create a <<bad-url-token>>,
1314-
and return it.
1315-
1316-
<li>
1317-
Set the <<url-token>>’s value to the returned <<string-token>>’s value.
1318-
1319-
<li>
1320-
Consume as much <a>whitespace</a> as possible.
1321-
1322-
<li>
1323-
If the <a>next input code point</a> is U+0029 RIGHT PARENTHESIS ()) or EOF,
1324-
consume it and return the <<url-token>>;
1325-
otherwise,
1326-
<a>consume the remnants of a bad url</a>,
1327-
create a <<bad-url-token>>,
1328-
and return it.
1329-
</ol>
1330-
13311310
<li>
13321311
Repeatedly consume the <a>next input code point</a> from the stream:
13331312

css-syntax/Overview.html

+42-62
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</p>
5959
<h1 class="p-name no-ref" id=title>CSS Syntax Module Level 3</h1>
6060
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
61-
<span class=dt-updated><span class=value-title title=20140609>9 June 2014</span></span></span></h2>
61+
<span class=dt-updated><span class=value-title title=20140617>17 June 2014</span></span></span></h2>
6262
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-syntax-3/>http://www.w3.org/TR/css-syntax-3/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/ rel=previous>http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/</a>
6363
<dt>Feedback:</dt>
6464
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-syntax%5D%20feedback">www-style@w3.org</a>
@@ -72,7 +72,8 @@ <h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class
7272
</div>
7373

7474
<h2 class="no-num no-toc no-ref heading settled heading" id=abstract><span class=content>Abstract</span></h2>
75-
<p class=p-summary data-fill-with=abstract>This module describes, in general terms, the basic structure and syntax of CSS stylesheets. It defines, in detail, the syntax and parsing of CSS - how to turn a stream of bytes into a meaningful stylesheet.
75+
<p class=p-summary data-fill-with=abstract><p>This module describes, in general terms, the basic structure and syntax of CSS stylesheets. It defines, in detail, the syntax and parsing of CSS - how to turn a stream of bytes into a meaningful stylesheet.</p>
76+
7677
<a href=http://www.w3.org/TR/CSS/>CSS</a> is a language for describing the rendering of structured documents
7778
(such as HTML and XML)
7879
on screen, on paper, in speech, etc.</p>
@@ -250,10 +251,10 @@ <h2 class="heading settled heading" data-level=2 id=syntax-description><span cla
250251

251252
<p>A typical rule might look something like this:</p>
252253

253-
<pre> p &gt; a {
254-
color: blue;
255-
text-decoration: underline;
256-
}
254+
<pre>p &gt; a {
255+
color: blue;
256+
text-decoration: underline;
257+
}
257258
</pre>
258259

259260
<p>In the above rule, "<code>p &gt; a</code>" is the selector,
@@ -288,10 +289,10 @@ <h2 class="heading settled heading" data-level=2 id=syntax-description><span cla
288289
<p>The <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-cascade-3/#at-ruledef-import title=@import>@import</a> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> is a simple statement.
289290
After its name, it takes a single string or <span class=css data-link-type=maybe title=url()>url()</span> function to indicate the stylesheet that it should import.</p>
290291

291-
<pre> @page :left {
292-
margin-left: 4cm;
293-
margin-right: 3cm;
294-
}
292+
<pre>@page :left {
293+
margin-left: 4cm;
294+
margin-right: 3cm;
295+
}
295296
</pre>
296297

297298
<p>The <span class=css data-link-type=maybe title=@page>@page</span> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> consists of an optional page selector (the <span class=css data-link-type=maybe title=:left>:left</span> pseudoclass),
@@ -300,9 +301,9 @@ <h2 class="heading settled heading" data-level=2 id=syntax-description><span cla
300301
except that its properties don’t apply to any "element",
301302
but rather the page itself.</p>
302303

303-
<pre> @media print {
304-
body { font-size: 10pt }
305-
}
304+
<pre>@media print {
305+
body { font-size: 10pt }
306+
}
306307
</pre>
307308

308309
<p>The <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-conditional-3/#at-ruledef-media title=@media>@media</a> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> begins with a media type
@@ -2313,7 +2314,16 @@ <h4 class="heading settled heading" data-level=4.3.4 id=consume-an-ident-like-to
23132314
<p>If the returned string’s value is an <a data-link-type=dfn href=#ascii-case-insensitive title="ascii case-insensitive">ASCII case-insensitive</a> match for "url",
23142315
and the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a> is U+0028 LEFT PARENTHESIS ((),
23152316
consume it.
2316-
<a data-link-type=dfn href=#consume-a-url-token0 title="consume a url token">Consume a url token</a>,
2317+
While the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a> is <a data-link-type=dfn href=#whitespace title=whitespace>whitespace</a>,
2318+
consume it.
2319+
If the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is U+0022 QUOTATION MARK (")
2320+
or U+0027 APOSTROPHE ('),
2321+
<a data-link-type=dfn href=#reconsume-the-current-input-code-point title="reconsume the current input code point">reconsume the current input code point</a>,
2322+
then create a <a class="production css-code" data-link-type=type href=#typedef-function-token title="<function-token>">&lt;function-token&gt;</a>
2323+
with its value set to the returned string
2324+
and return it.
2325+
Otherwise,
2326+
<a data-link-type=dfn href=#consume-a-url-token0 title="consume a url token">consume a url token</a>,
23172327
and return it.</p>
23182328

23192329
<p>Otherwise,
@@ -2397,36 +2407,6 @@ <h4 class="heading settled heading" data-level=4.3.6 id=consume-a-url-token><spa
23972407
If the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a> is EOF,
23982408
return the <a class="production css-code" data-link-type=type href=#typedef-url-token title="<url-token>">&lt;url-token&gt;</a>.
23992409

2400-
<li>
2401-
If the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a> is a U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
2402-
then:
2403-
2404-
<ol>
2405-
<li>
2406-
Consume the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a>,
2407-
then <a data-link-type=dfn href=#consume-a-string-token0 title="consume a string token">consume a string token</a>.
2408-
2409-
<li>
2410-
If a <a class="production css-code" data-link-type=type href=#typedef-bad-string-token title="<bad-string-token>">&lt;bad-string-token&gt;</a> was returned,
2411-
<a data-link-type=dfn href=#consume-the-remnants-of-a-bad-url0 title="consume the remnants of a bad url">consume the remnants of a bad url</a>,
2412-
create a <a class="production css-code" data-link-type=type href=#typedef-bad-url-token title="<bad-url-token>">&lt;bad-url-token&gt;</a>,
2413-
and return it.
2414-
2415-
<li>
2416-
Set the <a class="production css-code" data-link-type=type href=#typedef-url-token title="<url-token>">&lt;url-token&gt;</a>’s value to the returned <a class="production css-code" data-link-type=type href=#typedef-string-token title="<string-token>">&lt;string-token&gt;</a>’s value.
2417-
2418-
<li>
2419-
Consume as much <a data-link-type=dfn href=#whitespace title=whitespace>whitespace</a> as possible.
2420-
2421-
<li>
2422-
If the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a> is U+0029 RIGHT PARENTHESIS ()) or EOF,
2423-
consume it and return the <a class="production css-code" data-link-type=type href=#typedef-url-token title="<url-token>">&lt;url-token&gt;</a>;
2424-
otherwise,
2425-
<a data-link-type=dfn href=#consume-the-remnants-of-a-bad-url0 title="consume the remnants of a bad url">consume the remnants of a bad url</a>,
2426-
create a <a class="production css-code" data-link-type=type href=#typedef-bad-url-token title="<bad-url-token>">&lt;bad-url-token&gt;</a>,
2427-
and return it.
2428-
</ol>
2429-
24302410
<li>
24312411
Repeatedly consume the <a data-link-type=dfn href=#next-input-code-point title="next input code point">next input code point</a> from the stream:
24322412

@@ -4303,29 +4283,29 @@ <h3 class="heading settled heading" data-level=6.2 id=the-anb-type><span class=s
43034283
(using the <a href=http://www.w3.org/TR/css3-values/#value-defs>Value Definition Syntax in the Values &amp; Units spec</a>)
43044284
as:</p>
43054285

4306-
<pre class=prod> <dfn class=css-code data-dfn-type=type data-export="" id=anb-production>&lt;an<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>b&gt;<a class=self-link href=#anb-production></a></dfn> =
4307-
odd <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> even <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4308-
<var>&lt;integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4286+
<pre class=prod><dfn class=css-code data-dfn-type=type data-export="" id=anb-production>&lt;an<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>b&gt;<a class=self-link href=#anb-production></a></dfn> =
4287+
odd <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> even <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4288+
<var>&lt;integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
43094289

4310-
<var>&lt;n-dimension&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4311-
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4312-
-n <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4290+
<var>&lt;n-dimension&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4291+
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4292+
-n <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
43134293

4314-
<var>&lt;ndashdigit-dimension&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4315-
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> <var>&lt;ndashdigit-ident&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4316-
<var>&lt;dashndashdigit-ident&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4294+
<var>&lt;ndashdigit-dimension&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4295+
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> <var>&lt;ndashdigit-ident&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4296+
<var>&lt;dashndashdigit-ident&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
43174297

4318-
<var>&lt;n-dimension&gt;</var> <var>&lt;signed-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4319-
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n <var>&lt;signed-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4320-
-n <var>&lt;signed-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4298+
<var>&lt;n-dimension&gt;</var> <var>&lt;signed-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4299+
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n <var>&lt;signed-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4300+
-n <var>&lt;signed-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
43214301

4322-
<var>&lt;ndash-dimension&gt;</var> <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4323-
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n- <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4324-
-n- <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4302+
<var>&lt;ndash-dimension&gt;</var> <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4303+
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n- <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4304+
-n- <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
43254305

4326-
<var>&lt;n-dimension&gt;</var> ['<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>' <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> '-'] <var>&lt;signless-integer&gt;</var>
4327-
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n ['<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>' <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> '-'] <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4328-
-n ['<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>' <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> '-'] <var>&lt;signless-integer&gt;</var>
4306+
<var>&lt;n-dimension&gt;</var> ['<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>' <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> '-'] <var>&lt;signless-integer&gt;</var>
4307+
'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>'<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-opt title=?>?</a><sup><a href=#anb-plus></a></sup> n ['<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>' <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> '-'] <var>&lt;signless-integer&gt;</var> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a>
4308+
-n ['<a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#mult-one-plus title=+>+</a>' <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> '-'] <var>&lt;signless-integer&gt;</var>
43294309
</pre>
43304310

43314311
<p>where:</p>

0 commit comments

Comments
 (0)