Skip to content

Commit f7f942e

Browse files
committed
[css-values] More normative definition of url(). Should hopefully fix #1014
1 parent 8b5d98d commit f7f942e

File tree

2 files changed

+73
-73
lines changed

2 files changed

+73
-73
lines changed

css-values-3/Overview.bs

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,11 @@ Quoted Strings: the <> type
501501

502502
Resource Locators: the <> type
503503

504-
A URL is a pointer to a resource
505-
506-
denoted by <>.
507-
The syntax of a <> is:
504+
505+
denoted by <>,
506+
represents a URL,
507+
which is a pointer to a resource.
508+
The typical syntax of a <> is:
508509

509510
<url> = url( <> <>* )
510511

@@ -514,44 +515,42 @@ Resource Locators: the <> type
514515
body { background: url("http://www.example.com/pinkish.gif") }
515516
516517

517-
In addition to the syntax defined above,
518-
a <> can sometimes be written in other ways:
519-
520-
* A <> can be written without quotation marks around the URL itself.
521-
(This syntax is specially-parsed
522-
as a <>. [[!CSS3SYN]])
523-
524-
525-
For example, the following declarations are identical:
526-
527-
background: url("http://www.example.com/pinkish.gif");
528-
background: url(http://www.example.com/pinkish.gif);
529-
530-
531-
532-
* Some CSS contexts (such as ''@import'') allow a <> to be represented by a bare <>,
533-
without the ''url()'' wrapper.
534-
In such cases the string behaves identically to a ''url()'' function containing that string.
535-
536-
537-
For example, the following statements are identical:
538-
539-
@import url("base-theme.css");
540-
@import "base-theme.css";
541-
542-
543-
544-
Note: The special parsing rules for the legacy quotation-mark–less <> syntax
545-
means that parentheses, whitespace characters,
518+
A <> may alternately be written without quotation marks around the URL itself,
519+
in which case it is specially-parsed
520+
as a <> [[!CSS3SYN]].
521+
522+
523+
For example, the following declarations are identical:
524+
525+
background: url("http://www.example.com/pinkish.gif");
526+
background: url(http://www.example.com/pinkish.gif);
527+
528+
529+
530+
Note: This unquoted syntax is cannot accept a <> argument
531+
and has extra escaping requirements:
532+
parentheses, whitespace characters,
546533
single quotes (') and double quotes (") appearing in a URL
547534
must be escaped with a backslash,
548535
e.g. ''url(open\(parens)'', ''url(close\)parens)''.
536+
(In quoted <> ''url()''s,
537+
only newlines and the character used to quote the string need to be escaped.)
549538
Depending on the type of URL,
550539
it might also be possible to write these characters as URL-escapes
551540
(e.g. ''url(open%28parens)'' or ''url(close%29parens)'')
552541
as described in [[URL]].
553-
Alternately, the URL can be quoted as a string,
554-
in which case only newlines and the character used to quote the string need to be escaped.
542+
543+
Some CSS contexts (such as ''@import'') also allow a <>
544+
to be represented by a bare <>, without the ''url()'' wrapper.
545+
In such cases the string behaves identically to a ''url()'' function containing that string.
546+
547+
548+
For example, the following statements are identical:
549+
550+
@import url("base-theme.css");
551+
@import "base-theme.css";
552+
553+
555554

556555

557556
Relative URLs
@@ -1393,7 +1392,7 @@ Images: the <> type
13931392

13941393
The <> value specifies the position of a object area (e.g. background image)
13951394
inside a positioning area (e.g. background positioning area).
1396-
It is interpreted as specified for 'background-position'. [[!CSS3-BACKGROUNDS]]
1395+
It is interpreted as specified for 'background-position'. [[!CSS3-BACKGROUND]]
13971396

13981397
13991398
<> = [
@@ -2089,8 +2088,10 @@ Changes
20892088
  • Inlined the <> definition and dropped the three-value syntaxes
  • 20902089
    to allow for unambiguous combination in complex grammars.
    20912090
    This effectively removes that syntax from 'object-position',
    2092-
    but allows <> to be re-used e.g. in [[CSS-TRANSFORMS]] for 3D positions.
    2091+
    but allows <> to be re-used e.g. in [[CSS-TRANSFORMS-1]] for 3D positions.
    20932092
    (See discussion.)
    2093+
  • Clarified handling of font-relative units outside the context of an element.
  • 2094+
  • Clarified definition of ''url()'' to normatively accept unquoted syntax.
  • 20942095
    20952096

    20962097
    Changes since the 11 June 2015 Candidate Recomendation are:

    css-values/Overview.bs

    Lines changed: 35 additions & 36 deletions
    Original file line numberDiff line numberDiff line change
    @@ -491,10 +491,11 @@ Quoted Strings: the <> type
    491491

    492492
    Resource Locators: the <> type
    493493

    494-
    A URL is a pointer to a resource
    495-
    496-
    denoted by <>.
    497-
    The syntax of a <> is:
    494+
    495+
    denoted by <>,
    496+
    represents a URL,
    497+
    which is a pointer to a resource.
    498+
    The typical syntax of a <> is:
    498499

    499500
    <url> = url( <> <>* )
    500501

    @@ -504,44 +505,42 @@ Resource Locators: the <> type
    504505
    body { background: url("http://www.example.com/pinkish.gif") }
    505506
    506507

    507-
    In addition to the syntax defined above,
    508-
    a <> can sometimes be written in other ways:
    509-
    510-
    * A <> can be written without quotation marks around the URL itself.
    511-
    (This syntax is specially-parsed
    512-
    as a <>. [[!CSS3SYN]])
    513-
    514-
    515-
    For example, the following declarations are identical:
    516-
    517-
    background: url("http://www.example.com/pinkish.gif");
    518-
    background: url(http://www.example.com/pinkish.gif);
    519-
    520-
    521-
    522-
    * Some CSS contexts (such as ''@import'') allow a <> to be represented by a bare <>,
    523-
    without the ''url()'' wrapper.
    524-
    In such cases the string behaves identically to a ''url()'' function containing that string.
    525-
    526-
    527-
    For example, the following statements are identical:
    528-
    529-
    @import url("base-theme.css");
    530-
    @import "base-theme.css";
    531-
    532-
    533-
    534-
    Note: The special parsing rules for the legacy quotation-mark–less <> syntax
    535-
    means that parentheses, whitespace characters,
    508+
    A <> may alternately be written without quotation marks around the URL itself,
    509+
    in which case it is specially-parsed
    510+
    as a <> [[!CSS3SYN]].
    511+
    512+
    513+
    For example, the following declarations are identical:
    514+
    515+
    background: url("http://www.example.com/pinkish.gif");
    516+
    background: url(http://www.example.com/pinkish.gif);
    517+
    518+
    519+
    520+
    Note: This unquoted syntax is cannot accept a <> argument
    521+
    and has extra escaping requirements:
    522+
    parentheses, whitespace characters,
    536523
    single quotes (') and double quotes (") appearing in a URL
    537524
    must be escaped with a backslash,
    538525
    e.g. ''url(open\(parens)'', ''url(close\)parens)''.
    526+
    (In quoted <> ''url()''s,
    527+
    only newlines and the character used to quote the string need to be escaped.)
    539528
    Depending on the type of URL,
    540529
    it might also be possible to write these characters as URL-escapes
    541530
    (e.g. ''url(open%28parens)'' or ''url(close%29parens)'')
    542531
    as described in [[URL]].
    543-
    Alternately, the URL can be quoted as a string,
    544-
    in which case only newlines and the character used to quote the string need to be escaped.
    532+
    533+
    Some CSS contexts (such as ''@import'') also allow a <>
    534+
    to be represented by a bare <>, without the ''url()'' wrapper.
    535+
    In such cases the string behaves identically to a ''url()'' function containing that string.
    536+
    537+
    538+
    For example, the following statements are identical:
    539+
    540+
    @import url("base-theme.css");
    541+
    @import "base-theme.css";
    542+
    543+
    545544

    546545

    547546
    Relative URLs
    @@ -2370,7 +2369,7 @@ Changes
    23702369
    Changes since Level 3:
    23712370

    23722371
      2373-
    • Added the ''vi'', ''vb'', ''ic'', ''lh'' and ''rlh'' units.
    • 2372+
    • Added the ''vi'', ''vb'', ''ic'', ''cap'', ''lh'' and ''rlh'' units.
    • 23742373
      23752374

      23762375

      0 commit comments

      Comments
       (0)