# HG changeset patch # Parent 56f9d2e06276a9072d7e22be97b8ac493c40f38e Generic Datatype Reorganization Part IV: Strings and URLs Also, create a cleaner split between this module and syntax. diff --git a/Overview.src.html b/Overview.src.html --- a/Overview.src.html +++ b/Overview.src.html @@ -270,41 +270,6 @@ Property value examples common syntactic building blocks and terms that are described in this section. -
A string is a sequence of characters enclosed by double quotes or single quotes. Double quotes cannot occur inside double quotes, unless escaped (as '\"' or as '\22'). Analogously for single quotes ("\'" or "\27"). - -
-content: "this is a 'string'."; -content: "this is a \"string\"."; -content: 'this is a "string".'; -content: 'this is a \'string\'.'; --
A string cannot directly contain a newline. To -include a newline in a string, use the escape "\A" (hexadecimal A is the line -feed character in Unicode (U+000A), but represents the generic notion of "newline" in -CSS). See the 'content' property for an -example.
- -It is possible to break strings over several lines, for aesthetic or -other reasons, but in such a case the newline itself has to be escaped -with a backslash (\). The newline is subsequently removed from the -string. For instance, the following two selectors are exactly the -same:
- --a[title="a not s\ -o very long title"] {/*...*/} -a[title="a not so very long title"] {/*...*/} --
Some values use a functional notation to type values and @@ -325,8 +290,8 @@ that is composed of several values with is called a compound value. A value that is not a compound value is a simple value. -
An identifier is a sequence of characters conforming to
the IDENT
token in the
@@ -392,6 +357,97 @@ User-defined Identifiers: the ''<iden
(e.g. ''example'' and ''EXAMPLE'' are two different, unrelated
user-defined identifiers).
+
Strings are denoted by <string>
+ and consist of a sequence of characters delimited by double quotes or
+ single quotes. They correspond to the STRING
token in the
+ grammar.
+ [[!CSS21]]
+
+
Double quotes cannot occur inside double quotes, unless escaped + (as '\"' or as '\22'). Analogously for single quotes ("\'" or "\27"). +
+content: "this is a 'string'."; +content: "this is a \"string\"."; +content: 'this is a "string".'; +content: 'this is a \'string\'.';+
It is possible to break strings over several lines, for aesthetic or + other reasons, but in such a case the newline itself has to be escaped + with a backslash (\). The newline is subsequently removed from the + string. For instance, the following two selectors are exactly the + same:
+ ++a[title="a not s\ +o very long title"] {/*...*/} +a[title="a not so very long title"] {/*...*/}+
Since a string cannot directly represent a newline, to include a + newline in a string, use the escape "\A". (Hexadecimal A is the line + feed character in Unicode (U+000A), but represents the generic notion + of "newline" in CSS.)
+ +A URL is a pointer to a resource and is a
+ specially-parsed
+ functional notation denoted by
+ <url>
. It corresponds to the
+ URI
token in the
+ grammar.
+ [[!CSS21]]
+
+
Below is an example of a URL being used as a background image: +
body { background: url("http://www.example.com/pinkish.gif") }+
The same example can be written without quotes: +
body { background: url(http://www.example.com/pinkish.gif) }+
Note that in some CSS syntactic contexts (as defined
+ by that context), a URL can be represented as a <string>
+ rather than by <URL>
. An example of this is the
+ ''@import'' rule.
+
+
Parentheses, whitespace characters, single quotes (') and
+ double quotes (") appearing in a URL must be escaped with a backslash
+ so that the resulting value is a valid URL
token,
+ e.g. 'url(open\(parens)', 'url(close\)parens)'.
+ Depending on the type of URL, it might also be possible to write these
+ characters as URI-escapes (where (
= %28
,
+ )
= %29
, etc.) as described in [[URI]].
+ Alternatively a URL containing such characters may be represented as
+ a quoted string within the ''url()'' notation.
+
+
In order to create modular style sheets that are not dependent on + the absolute location of a resource, authors should use relative URIs. + Relative URIs (as defined in [[RFC3986]]) are resolved to full URIs + using a base URI. RFC 3986, section 3, defines the normative + algorithm for this process. For CSS style sheets, the base URI is that + of the style sheet, not that of the source document. + +
For example, suppose the following rule: +
body { background: url("tile.png") }+
is located in a style sheet designated by the URL:
+http://www.example.org/style/basic.css+
The background of the source document's <body>
+ will be tiled with whatever image is described by the resource
+ designated by the URL:
+
http://www.example.org/style/tile.png+
The same image will be used regardless of the URL of the source
+ document containing the <body<
.
+
Strings are denoted by <string> in the value -definitions. - - -
This section is not normative. The CSS3 Color module [[!CSS3COLOR]] defines the CSS3 color values.
@@ -1089,75 +1138,6 @@ documents?: P[COLOR] { color: attr(C
-<url>
-
-
URLs (Uniform Resource Locators, see [[RFC1738]] and -[[RFC1808]]) provide the address of a resource on the Web. An -alternative and more general term is URIs (Uniform Resource -Identifiers, see [!URI]). This specification uses the term URI.
- -For historical reasons, the name of the URI function is "url". The -URI function takes one URI as the argument. The URI may be quoted with -single quote (') or double quote (") characters. If quoted, the two -quote characters must be the same. - -
-body { background: url("http://www.example.com/pinkish.gif") } --
An example without quotes:
- --li { list-style: url(http://www.example.com/redball.png) disc } -- -
Parentheses, commas, whitespace characters, single quotes (') and double -quotes (") appearing in a URI must be escaped with a backslash: '\(', '\)', -'\,'.
- -Depending on the type of URI, it might also be possible to write the above -characters as URI-escapes (where "(" = %28, ")" = %29, etc.) as described in -[!URI].
- -In order to create modular style sheets that are not dependent on the -absolute location of a resource, authors should use relative URIs. Relative URIs -(as defined in [[RFC1808]]) are resolved to full URIs using a base URI. -RFC 1808, section 3, defines the normative algorithm for this process. For -CSS style sheets, the base URI is that of the style sheet, not that of the -source document.
- -For example, suppose the following rule:
- --body { background: url("yellow") } -- -
is located in a style sheet designated by the URI:
- --http://www.example.org/style/basic.css -- -
The background of the source document's BODY will be tiled with whatever -image is described by the resource designated by the URI
--http://www.example.org/style/yellow --
User agents may vary in how they handle URIs that designate unavailable or -inapplicable resources.
-TBD.