Skip to content

Commit b4247a9

Browse files
committed
[css-values-4] Note-ify comment about url() vs src() parsing.
Also improve cross-referencing to css-syntax.
1 parent 42f0da4 commit b4247a9

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

css-values-4/Overview.bs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -932,13 +932,15 @@ Resource Locators: the <<url>> type</h3>
932932
</pre>
933933
</div>
934934

935-
For legacy reasons, a ''url()'' can be written without quotation marks around the URL itself,
935+
A ''url()'' can be written without quotation marks around the URL value,
936936
in which case it is <a lt="consume a url token" spec=css-syntax-3>specially-parsed</a>
937-
as a <<url-token>> [[!CSS-SYNTAX-3]].
938-
Because of this special parsing, ''url()'' is only able to specify its URL literally;
939-
''src()'' lacks this special parsing rule,
940-
and so its URL can be provided by functions,
941-
such as ''var()''.
937+
as a <<url-token>>; see [[css-syntax-3#consume-url-token]]. [[!CSS-SYNTAX-3]]
938+
939+
Note: Because of this special parsing,
940+
''url()'' can only express its value literally.
941+
To provide a URL by functions such as ''var()'',
942+
use the ''src()'' notation,
943+
which does not have this special parsing rule.
942944

943945
<div class="example">
944946
For example, the following declarations are identical:
@@ -967,23 +969,18 @@ Resource Locators: the <<url>> type</h3>
967969
so the entire declaration is thrown out as invalid.
968970
</div>
969971

970-
<div class=note>
971-
The unquoted ''url()'' syntax cannot accept a <<url-modifier>> argument
972-
and has extra escaping requirements:
973-
parentheses, <a href="https://www.w3.org/TR/css-syntax/#whitespace">whitespace</a> characters,
974-
single quotes (&#39;) and double quotes (") appearing in a URL
975-
must be escaped with a backslash,
976-
e.g. ''url(open\(parens)'', ''url(close\)parens)''.
977-
(In quoted <<string>> ''url()''s,
978-
only newlines and the character used to quote the string need to be escaped.)
979-
Depending on the type of URL,
980-
it might also be possible to write these characters as URL-escapes
981-
(e.g. ''url(open%28parens)'' or ''url(close%29parens)'')
982-
as described in [[URL]].
983-
984-
The precise requirements for parsing the unquoted ''url()'' syntax
985-
are normatively defined in [[!CSS-SYNTAX-3]].
986-
</div>
972+
Note: The unquoted ''url()'' syntax cannot accept a <<url-modifier>> argument
973+
and has extra escaping requirements:
974+
parentheses, <a href="https://www.w3.org/TR/css-syntax/#whitespace">whitespace</a> characters,
975+
single quotes (&#39;) and double quotes (") appearing in a URL
976+
must be escaped with a backslash,
977+
e.g. ''url(open\(parens)'', ''url(close\)parens)''.
978+
(In quoted <<string>> ''url()''s,
979+
only newlines and the character used to quote the string need to be escaped.)
980+
Depending on the type of URL,
981+
it might also be possible to write these characters as URL-escapes
982+
(e.g. ''url(open%28parens)'' or ''url(close%29parens)'')
983+
as described in [[URL]].
987984

988985
Some CSS contexts (such as ''@import'') also allow a <<url>>
989986
to be represented by a bare <<string>>, without the function wrapper.

0 commit comments

Comments
 (0)