[css-syntax] Big commit - redefine the tokenizer as a recursive-descent parser.

Thu, 30 May 2013 17:11:17 -0700

author
Tab Atkins Jr. <jackalmage@gmail.com>
date
Thu, 30 May 2013 17:11:17 -0700
changeset 8308
6cadf0f90953
parent 8307
ceb57013f757
child 8309
3d6f072cba8e

[css-syntax] Big commit - redefine the tokenizer as a recursive-descent parser.

css-syntax/Overview.html file | annotate | diff | comparison | revisions
css-syntax/Overview.src.html file | annotate | diff | comparison | revisions
     1.1 --- a/css-syntax/Overview.html	Fri May 31 01:53:00 2013 +0200
     1.2 +++ b/css-syntax/Overview.html	Thu May 30 17:11:17 2013 -0700
     1.3 @@ -11,7 +11,7 @@
     1.4  
     1.5    <meta content="CSS Syntax Module Level 3 (CSS3 Syntax)" name=dcterms.title>
     1.6    <meta content=text name=dcterms.type>
     1.7 -  <meta content=2013-05-30 name=dcterms.date>
     1.8 +  <meta content=2013-05-31 name=dcterms.date>
     1.9    <meta content="Tab Atkins Jr." name=dcterms.creator>
    1.10    <meta content=W3C name=dcterms.publisher>
    1.11    <meta content="http://dev.w3.org/csswg/css3-syntax/"
    1.12 @@ -32,7 +32,7 @@
    1.13     <h1 class=p-name>CSS Syntax Module Level 3</h1>
    1.14  
    1.15     <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft <time
    1.16 -    class=dt-updated datetime=20130530>30 May 2013</time></h2>
    1.17 +    class=dt-updated datetime=20130531>31 May 2013</time></h2>
    1.18  
    1.19     <dl>
    1.20      <dt>This version:
    1.21 @@ -183,94 +183,56 @@
    1.22       <li><a href="#definitions"><span class=secno>4.2. </span>
    1.23        Definitions</a>
    1.24  
    1.25 -     <li><a href="#tokenizer-state-machine"><span class=secno>4.3. </span>
    1.26 -      Tokenizer State Machine</a>
    1.27 -      <ul class=toc>
    1.28 -       <li><a href="#data-state"><span class=secno>4.3.1. </span> Data
    1.29 -        state</a>
    1.30 -
    1.31 -       <li><a href="#double-quote-string-state"><span class=secno>4.3.2.
    1.32 -        </span> Double-quote-string state</a>
    1.33 -
    1.34 -       <li><a href="#single-quote-string-state"><span class=secno>4.3.3.
    1.35 -        </span> Single-quote-string state</a>
    1.36 -
    1.37 -       <li><a href="#hash-state"><span class=secno>4.3.4. </span> Hash
    1.38 -        state</a>
    1.39 -
    1.40 -       <li><a href="#comment-state"><span class=secno>4.3.5. </span> Comment
    1.41 -        state</a>
    1.42 -
    1.43 -       <li><a href="#at-keyword-state"><span class=secno>4.3.6. </span>
    1.44 -        At-keyword state</a>
    1.45 -
    1.46 -       <li><a href="#ident-state"><span class=secno>4.3.7. </span> Ident
    1.47 -        state</a>
    1.48 -
    1.49 -       <li><a href="#number-state"><span class=secno>4.3.8. </span> Number
    1.50 -        state</a>
    1.51 -
    1.52 -       <li><a href="#number-rest-state"><span class=secno>4.3.9. </span>
    1.53 -        Number-rest state</a>
    1.54 -
    1.55 -       <li><a href="#sci-notation-state"><span class=secno>4.3.10. </span>
    1.56 -        Sci-notation state</a>
    1.57 -
    1.58 -       <li><a href="#number-end-state"><span class=secno>4.3.11. </span>
    1.59 -        Number-end state</a>
    1.60 -
    1.61 -       <li><a href="#dimension-state"><span class=secno>4.3.12. </span>
    1.62 -        Dimension state</a>
    1.63 -
    1.64 -       <li><a href="#url-state"><span class=secno>4.3.13. </span> URL
    1.65 -        state</a>
    1.66 -
    1.67 -       <li><a href="#url-double-quote-state"><span class=secno>4.3.14.
    1.68 -        </span> URL-double-quote state</a>
    1.69 -
    1.70 -       <li><a href="#url-single-quote-state"><span class=secno>4.3.15.
    1.71 -        </span> URL-single-quote state</a>
    1.72 -
    1.73 -       <li><a href="#url-unquoted-state"><span class=secno>4.3.16. </span>
    1.74 -        URL-unquoted state</a>
    1.75 -
    1.76 -       <li><a href="#url-end-state"><span class=secno>4.3.17. </span> URL-end
    1.77 -        state</a>
    1.78 -
    1.79 -       <li><a href="#bad-url-state"><span class=secno>4.3.18. </span> Bad-URL
    1.80 -        state</a>
    1.81 -
    1.82 -       <li><a href="#unicode-range-state"><span class=secno>4.3.19. </span>
    1.83 -        Unicode-range state</a>
    1.84 -      </ul>
    1.85 -
    1.86 -     <li><a href="#tokenizer-algorithms"><span class=secno>4.4. </span>
    1.87 +     <li><a href="#tokenizer-algorithms"><span class=secno>4.3. </span>
    1.88        Tokenizer Algorithms</a>
    1.89        <ul class=toc>
    1.90 -       <li><a href="#consume-an-escaped-character"><span class=secno>4.4.1.
    1.91 +       <li><a href="#consume-a-token"><span class=secno>4.3.1. </span>
    1.92 +        Consume a token</a>
    1.93 +
    1.94 +       <li><a href="#consume-a-numeric-token"><span class=secno>4.3.2.
    1.95 +        </span> Consume a numeric token</a>
    1.96 +
    1.97 +       <li><a href="#consume-a-string-token"><span class=secno>4.3.3. </span>
    1.98 +        Consume a string token</a>
    1.99 +
   1.100 +       <li><a href="#consume-a-url-token-"><span class=secno>4.3.4. </span>
   1.101 +        Consume a url token </a>
   1.102 +
   1.103 +       <li><a href="#consume-a-unicode-range-token"><span class=secno>4.3.5.
   1.104 +        </span> Consume a unicode-range token</a>
   1.105 +
   1.106 +       <li><a href="#consume-an-escaped-character"><span class=secno>4.3.6.
   1.107          </span> Consume an escaped character</a>
   1.108  
   1.109 -       <li><a href="#set-the-unicode-ranges-range"><span class=secno>4.4.2.
   1.110 +       <li><a href="#check-if-two-characters-are-a-valid-esca"><span
   1.111 +        class=secno>4.3.7. </span> Check if two characters are a valid
   1.112 +        escape</a>
   1.113 +
   1.114 +       <li><a href="#check-if-three-characters-would-start-an"><span
   1.115 +        class=secno>4.3.8. </span> Check if three characters would start an
   1.116 +        identifier</a>
   1.117 +
   1.118 +       <li><a href="#check-if-three-characters-would-start-a-"><span
   1.119 +        class=secno>4.3.9. </span> Check if three characters would start a
   1.120 +        number</a>
   1.121 +
   1.122 +       <li><a href="#consume-a-name"><span class=secno>4.3.10. </span>
   1.123 +        Consume a name</a>
   1.124 +
   1.125 +       <li><a href="#consume-a-number"><span class=secno>4.3.11. </span>
   1.126 +        Consume a number</a>
   1.127 +
   1.128 +       <li><a href="#convert-a-string-to-a-number"><span class=secno>4.3.12.
   1.129 +        </span> Convert a string to a number</a>
   1.130 +
   1.131 +       <li><a href="#consume-the-remnants-of-a-bad-url"><span
   1.132 +        class=secno>4.3.13. </span> Consume the remnants of a bad url</a>
   1.133 +
   1.134 +       <li><a href="#set-the-unicode-ranges-range"><span class=secno>4.3.14.
   1.135          </span> Set the 〈unicode-range〉’s range</a>
   1.136 -
   1.137 -       <li><a href="#convert-a-sci-notation-representation-in"><span
   1.138 -        class=secno>4.4.3. </span> Convert a sci-notation representation into
   1.139 -        a value</a>
   1.140 -
   1.141 -       <li><a href="#check-if-two-characters-are-a-valid-esca"><span
   1.142 -        class=secno>4.4.4. </span> Check if two characters are a valid
   1.143 -        escape</a>
   1.144 -
   1.145 -       <li><a href="#check-if-three-characters-would-start-an"><span
   1.146 -        class=secno>4.4.5. </span> Check if three characters would start an
   1.147 -        identifier</a>
   1.148 -
   1.149 -       <li><a href="#check-if-three-characters-would-start-a-"><span
   1.150 -        class=secno>4.4.6. </span> Check if three characters would start a
   1.151 -        number</a>
   1.152        </ul>
   1.153  
   1.154 -     <li><a href="#changes-from-css-2.1-tokenizer"><span class=secno>4.5.
   1.155 +     <li><a href="#changes-from-css-2.1-tokenizer"><span class=secno>4.4.
   1.156        </span> Changes from CSS 2.1 Tokenizer</a>
   1.157      </ul>
   1.158  
   1.159 @@ -678,17 +640,15 @@
   1.160  
   1.161    <h2 id=tokenization><span class=secno>4. </span> Tokenization</h2>
   1.162  
   1.163 -  <p> Implementations must act as if they used the following state machine to
   1.164 -   tokenize CSS. The state machine must start in the <a
   1.165 -   href="#data-state0"><i>data state</i></a>. Most states consume a single
   1.166 -   character, which may have various side-effects, and either switches the
   1.167 -   state machine to a new state to reconsume the same character, or switches
   1.168 -   it to a new state to consume the next character, or stays in the same
   1.169 -   state to consume the next character. Some states have more complicated
   1.170 -   behavior and can consume several characters before switching to another
   1.171 -   state.
   1.172 -
   1.173 -  <p> The output of the tokenization step is a series of zero or more of the
   1.174 +  <p> Implementations must act as if they used the following algorithms to
   1.175 +   tokenize CSS. To transform a stream of characters into a stream of tokens,
   1.176 +   repeatedly <a href="#consume-a-token0"><i>consume a token</i></a> until an
   1.177 +   〈EOF〉 is encountered, collecting the returned tokens into a stream.
   1.178 +   Each call to the <a href="#consume-a-token0"><i>consume a token</i></a>
   1.179 +   algorithm returns a single token, so it can also be used "on-demand" to
   1.180 +   tokenize a stream of characters <em>during</em> parsing, if so desired.
   1.181 +
   1.182 +  <p> The output of the tokenization step is a stream of zero or more of the
   1.183     following tokens: 〈ident〉, 〈function〉, 〈at-keyword〉,
   1.184     〈hash〉, 〈string〉, 〈bad-string〉, 〈url〉, 〈bad-url〉,
   1.185     〈delim〉, 〈number〉, 〈percentage〉, 〈dimension〉,
   1.186 @@ -698,35 +658,38 @@
   1.187     〈semicolon〉, 〈comma〉, 〈[〉, 〈]〉, 〈(〉, 〈)〉, 〈{〉,
   1.188     and 〈}〉.
   1.189  
   1.190 -  <p> 〈ident〉, 〈function〉, 〈at-keyword〉, 〈hash〉,
   1.191 -   〈string〉, and 〈url〉 tokens have a value composed of zero or more
   1.192 -   characters. Additionally, hash tokens have a type flag set to either "id"
   1.193 -   or "unrestricted". The type flag defaults to "unrestricted" if not
   1.194 -   otherwise set. 〈delim〉 tokens have a value composed of a single
   1.195 -   character. 〈number〉, 〈percentage〉, and 〈dimension〉 tokens have
   1.196 -   a representation composed of one or more character, and a numeric value.
   1.197 -   〈number〉 and 〈dimension〉 tokens additionally have a type flag set
   1.198 -   to either "integer" or "number". The type flag defaults to "integer" if
   1.199 -   not otherwise set. 〈dimension〉 tokens additionally have a unit
   1.200 -   composed of one or more characters. 〈unicode-range〉 tokens have a
   1.201 -   range of characters.
   1.202 +  <ul>
   1.203 +   <li> 〈ident〉, 〈function〉, 〈at-keyword〉, 〈hash〉,
   1.204 +    〈string〉, and 〈url〉 tokens have a value composed of zero or more
   1.205 +    characters. Additionally, hash tokens have a type flag set to either "id"
   1.206 +    or "unrestricted". The type flag defaults to "unrestricted" if not
   1.207 +    otherwise set.
   1.208 +
   1.209 +   <li> 〈delim〉 tokens have a value composed of a single character.
   1.210 +
   1.211 +   <li> 〈number〉, 〈percentage〉, and 〈dimension〉 tokens have a
   1.212 +    representation composed of one or more character, and a numeric value.
   1.213 +    〈number〉 and 〈dimension〉 tokens additionally have a type flag set
   1.214 +    to either "integer" or "number". The type flag defaults to "integer" if
   1.215 +    not otherwise set. 〈dimension〉 tokens additionally have a unit
   1.216 +    composed of one or more characters.
   1.217 +
   1.218 +   <li> 〈unicode-range〉 tokens have a range of characters.
   1.219 +  </ul>
   1.220  
   1.221    <p class=note> The type flag of hash tokens is used in the Selectors syntax
   1.222     <a href="#SELECT" rel=biblioentry>[SELECT]<!--{{SELECT}}--></a>. Only hash
   1.223     tokens with the "id" type are valid <a
   1.224     href="http://www.w3.org/TR/selectors/#id-selectors">ID selectors</a>.
   1.225  
   1.226 -  <p> The tokenizer state machine consists of the states defined in the
   1.227 -   following subsections.
   1.228 -
   1.229    <h3 id=token-diagrams><span class=secno>4.1. </span> Token Railroad
   1.230     Diagrams</h3>
   1.231  
   1.232    <p> <em>This section is non-normative.</em>
   1.233  
   1.234    <p> This section presents an informative view of the tokenizer, in the form
   1.235 -   of railroad diagrams. Railroad diagrams are more compact than a
   1.236 -   state-machine, but often easier to read than an explicit parser.
   1.237 +   of railroad diagrams. Railroad diagrams are more compact than an explicit
   1.238 +   parser, but often easier to read than an regular expression.
   1.239  
   1.240    <p> These diagrams are <em>informative</em> and <em>incomplete</em>; they
   1.241     describe the grammar of "correct" tokens, but do not describe
   1.242 @@ -1499,11 +1462,18 @@
   1.243     <dd>The greatest codepoint defined by Unicode. This is currently U+10FFFF.
   1.244    </dl>
   1.245  
   1.246 -  <h3 id=tokenizer-state-machine><span class=secno>4.3. </span> Tokenizer
   1.247 -   State Machine</h3>
   1.248 -
   1.249 -  <h4 id=data-state><span class=secno>4.3.1. </span> <dfn id=data-state0>Data
   1.250 -   state</dfn></h4>
   1.251 +  <h3 id=tokenizer-algorithms><span class=secno>4.3. </span> Tokenizer
   1.252 +   Algorithms</h3>
   1.253 +
   1.254 +  <p> The algorithms defined in this section transform a stream of characters
   1.255 +   into a stream of tokens.
   1.256 +
   1.257 +  <h4 id=consume-a-token><span class=secno>4.3.1. </span> <dfn
   1.258 +   id=consume-a-token0>Consume a token</dfn></h4>
   1.259 +
   1.260 +  <p> This section describes how to <a href="#consume-a-token0"><i>consume a
   1.261 +   token</i></a> from a stream of characters. It will return a single token
   1.262 +   of any type.
   1.263  
   1.264    <p> Consume the <a href="#next-input-character"><i>next input
   1.265     character</i></a>.
   1.266 @@ -1512,12 +1482,12 @@
   1.267     <dt><a href="#whitespace"><i>whitespace</i></a>
   1.268  
   1.269     <dd> Consume as much <a href="#whitespace"><i>whitespace</i></a> as
   1.270 -    possible. Emit a 〈whitespace〉. Remain in this state.
   1.271 +    possible. Return a 〈whitespace〉.
   1.272  
   1.273     <dt>U+0022 QUOTATION MARK (")
   1.274  
   1.275 -   <dd> Switch to the <a
   1.276 -    href="#double-quote-string-state0"><i>double-quote-string state</i></a>.
   1.277 +   <dd> <a href="#consume-a-string-token0"><i>Consume a string token</i></a>
   1.278 +    with the ending character U+0022 QUOTATION MARK (") and return it.
   1.279  
   1.280     <dt>U+0023 NUMBER SIGN (#)
   1.281  
   1.282 @@ -1526,46 +1496,43 @@
   1.283      character</i></a> or the <a href="#next-input-character"><i
   1.284      title="next input character">next two input characters</i></a> <a
   1.285      href="#check-if-two-characters-are-a-valid-esca0"><i>are a valid
   1.286 -    escape</i></a>, If the <a href="#next-input-character"><i
   1.287 -    title="next input character">next three input characters</i></a> <a
   1.288 +    escape</i></a>, <a href="#consume-a-name0"><i>consume a name</i></a>.
   1.289 +    Create a 〈hash〉 with its value set to the returned string. If the
   1.290 +    first three characters of the 〈hash〉’s value <a
   1.291      href="#check-if-three-characters-would-start-an0"><i>would start an
   1.292 -    identifier</i></a>, set the 〈hash〉‘<code class=css>s type flag to
   1.293 -    "id". Switch to the <a href="#hash-state0"><i>hash state</i></a>. </code>
   1.294 -
   1.295 +    identifier</i></a>, set the 〈hash〉’s type flag to "id". Return the
   1.296 +    〈hash〉.
   1.297 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.298 +     href="#current-input-character"><i>current input character</i></a>.
   1.299 +
   1.300 +   <dt>U+0024 DOLLAR SIGN ($)
   1.301 +
   1.302 +   <dd> If the <a href="#next-input-character"><i>next input
   1.303 +    character</i></a> is U+003D EQUALS SIGN (=), consume it and return a
   1.304 +    〈suffix-match〉.
   1.305      <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.306       href="#current-input-character"><i>current input character</i></a>.
   1.307 -     Remain in this state.
   1.308 -
   1.309 -   <dt>U+0024 DOLLAR SIGN ($)
   1.310 +
   1.311 +   <dt>U+0027 APOSTROPHE (&apos;)
   1.312 +
   1.313 +   <dd> <a href="#consume-a-string-token0"><i>Consume a string token</i></a>
   1.314 +    with the ending character U+0027 APOSTROPHE (&apos;) and return it.
   1.315 +
   1.316 +   <dt>U+0028 LEFT PARENTHESIS (()
   1.317 +
   1.318 +   <dd> Return a 〈(〉.
   1.319 +
   1.320 +   <dt>U+0029 RIGHT PARENTHESIS ())
   1.321 +
   1.322 +   <dd> Return a 〈)〉.
   1.323 +
   1.324 +   <dt>U+002A ASTERISK (*)
   1.325  
   1.326     <dd> If the <a href="#next-input-character"><i>next input
   1.327 -    character</i></a> is U+003D EQUALS SIGN (=), consume it and emit a
   1.328 -    〈suffix-match〉. Remain in this state.
   1.329 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.330 +    character</i></a> is U+003D EQUALS SIGN (=), consume it and return a
   1.331 +    〈substring-match〉.
   1.332 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.333       href="#current-input-character"><i>current input character</i></a>.
   1.334 -     Remain in this state.
   1.335 -
   1.336 -   <dt>U+0027 APOSTROPHE (&apos;)
   1.337 -
   1.338 -   <dd> Switch to the <a
   1.339 -    href="#single-quote-string-state0"><i>single-quote-string state</i></a>.
   1.340 -
   1.341 -   <dt>U+0028 LEFT PARENTHESIS (()
   1.342 -
   1.343 -   <dd> Emit a 〈(〉. Remain in this state.
   1.344 -
   1.345 -   <dt>U+0029 RIGHT PARENTHESIS ())
   1.346 -
   1.347 -   <dd> Emit a 〈)〉. Remain in this state.
   1.348 -
   1.349 -   <dt>U+002A ASTERISK (*)
   1.350 -
   1.351 -   <dd> If the <a href="#next-input-character"><i>next input
   1.352 -    character</i></a> is U+003D EQUALS SIGN (=), consume it and emit a
   1.353 -    〈substring-match〉. Remain in this state.
   1.354 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.355 -     href="#current-input-character"><i>current input character</i></a>.
   1.356 -     Remain in this state.
   1.357  
   1.358     <dt>U+002B PLUS SIGN (+)
   1.359  
   1.360 @@ -1573,15 +1540,14 @@
   1.361      href="#check-if-three-characters-would-start-a-0"><i>starts with a
   1.362      number</i></a>, <a
   1.363      href="#reconsume-the-current-input-character"><i>reconsume the current
   1.364 -    input character</i></a> and switch to the <a
   1.365 -    href="#number-state0"><i>number state</i></a>.
   1.366 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.367 +    input character</i></a>, <a href="#consume-a-numeric-token0"><i>consume a
   1.368 +    numeric token</i></a> and return it.
   1.369 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.370       href="#current-input-character"><i>current input character</i></a>.
   1.371 -     Remain in this state.
   1.372  
   1.373     <dt>U+002C COMMA (,)
   1.374  
   1.375 -   <dd> Emit a 〈comma〉. Remain in this state.
   1.376 +   <dd> Return a 〈comma〉.
   1.377  
   1.378     <dt>U+002D HYPHEN-MINUS (-)
   1.379  
   1.380 @@ -1589,23 +1555,23 @@
   1.381      href="#check-if-three-characters-would-start-a-0"><i>starts with a
   1.382      number</i></a>, <a
   1.383      href="#reconsume-the-current-input-character"><i>reconsume the current
   1.384 -    input character</i></a> and switch to the <a
   1.385 -    href="#number-state0"><i>number state</i></a>.
   1.386 +    input character</i></a>, <a href="#consume-a-numeric-token0"><i>consume a
   1.387 +    numeric token</i></a>, and return it.
   1.388      <p> Otherwise, if the input stream <a
   1.389       href="#check-if-three-characters-would-start-an0"><i>starts with an
   1.390 -     identifier</i></a>, switch to the <a href="#ident-state0"><i>ident
   1.391 -     state</i></a>. <a
   1.392 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.393 -     input character</i></a>.
   1.394 +     identifier</i></a>, <a
   1.395 +     href="#reconsume-the-current-input-character"><i>reconsume the current
   1.396 +     input character</i></a>, <a href="#consume-a-name0"><i>consume a
   1.397 +     name</i></a>, create an 〈ident〉 with its value set to the returned
   1.398 +     value, and return it.
   1.399  
   1.400      <p> Otherwise, if the <a href="#next-input-character"><i
   1.401       title="next input character">next 2 input characters</i></a> are U+002D
   1.402 -     HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them, emit a
   1.403 -     〈CDC〉, and remain in this state.
   1.404 -
   1.405 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.406 +     HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a
   1.407 +     〈CDC〉.
   1.408 +
   1.409 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.410       href="#current-input-character"><i>current input character</i></a>.
   1.411 -     Remain in this state.
   1.412  
   1.413     <dt>U+002E FULL STOP (.)
   1.414  
   1.415 @@ -1613,91 +1579,90 @@
   1.416      href="#check-if-three-characters-would-start-a-0"><i>starts with a
   1.417      number</i></a>, <a
   1.418      href="#reconsume-the-current-input-character"><i>reconsume the current
   1.419 -    input character</i></a> and switch to the <a
   1.420 -    href="#number-state0"><i>number state</i></a>.
   1.421 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.422 +    input character</i></a>, <a href="#consume-a-numeric-token0"><i>consume a
   1.423 +    numeric token</i></a>, and return it.
   1.424 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.425       href="#current-input-character"><i>current input character</i></a>.
   1.426 -     Remain in this state.
   1.427  
   1.428     <dt>U+002F SOLIDUS (/)
   1.429  
   1.430     <dd> If the <a href="#next-input-character"><i>next input
   1.431 -    character</i></a> is U+002A ASTERISK (*), consume it and switch to the <a
   1.432 -    href="#comment-state0"><i>comment state</i></a>.
   1.433 -    <p> Otherwise, emit a 〈delim〉 with its value set to U+002F SOLIDUS
   1.434 -     (/). Remain in this state.
   1.435 +    character</i></a> is U+002A ASTERISK (*), consume it and all following
   1.436 +    characters up to and including the first U+002A ASTERISK (*) followed by
   1.437 +    a U+002F SOLIDUS (/), or up to an EOF character. Then <a
   1.438 +    href="#consume-a-token0"><i>consume a token</i></a> and return it.
   1.439 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.440 +     href="#current-input-character"><i>current input character</i></a>.
   1.441  
   1.442     <dt>U+003A COLON (:)
   1.443  
   1.444 -   <dd> Emit a 〈colon〉. Remain in this state.
   1.445 +   <dd> Return a 〈colon〉.
   1.446  
   1.447     <dt>U+003B SEMICOLON (;)
   1.448  
   1.449 -   <dd> Emit a 〈semicolon〉. Remain in this state.
   1.450 +   <dd> Return a 〈semicolon〉.
   1.451  
   1.452     <dt>U+003C LESS-THAN SIGN (&lt;)
   1.453  
   1.454     <dd> If the <a href="#next-input-character"><i
   1.455      title="next input character">next 3 input characters</i></a> are U+0021
   1.456      EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), consume
   1.457 -    them and emit a 〈CDO〉. Remain in this state.
   1.458 -    <p> Otherwise, emit a 〈delim〉 with its value set to U+003C LESS-THAN
   1.459 -     SIGN (&lt;). Remain in this state.
   1.460 +    them and return a 〈CDO〉.
   1.461 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.462 +     href="#current-input-character"><i>current input character</i></a>.
   1.463  
   1.464     <dt>U+0040 COMMERCIAL AT (@)
   1.465  
   1.466     <dd> If the <a href="#next-input-character"><i
   1.467      title="next input character">next 3 input characters</i></a> <a
   1.468      href="#check-if-three-characters-would-start-an0"><i>would start an
   1.469 -    identifier</i></a>, switch to the <a
   1.470 -    href="#at-keyword-state0"><i>at-keyword state</i></a>.
   1.471 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.472 +    identifier</i></a>, <a href="#consume-a-name0"><i>consume a name</i></a>,
   1.473 +    create an 〈at-keyword〉 with its value set to the returned value, and
   1.474 +    return it.
   1.475 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.476       href="#current-input-character"><i>current input character</i></a>.
   1.477 -     Remain in this state.
   1.478  
   1.479     <dt>U+005B LEFT SQUARE BRACKET ([)
   1.480  
   1.481 -   <dd> Emit a 〈[〉. Remain in this state.
   1.482 +   <dd> Return a 〈[〉.
   1.483  
   1.484     <dt>U+005C REVERSE SOLIDUS (\)
   1.485  
   1.486     <dd> If the input stream <a
   1.487      href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
   1.488 -    escape</i></a>, switch to the <a href="#ident-state0"><i>ident
   1.489 -    state</i></a>. <a
   1.490 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.491 -    input character</i></a>.
   1.492 +    escape</i></a>, <a
   1.493 +    href="#reconsume-the-current-input-character"><i>reconsume the current
   1.494 +    input character</i></a>, <a href="#consume-a-name0"><i>consume a
   1.495 +    name</i></a>, create an 〈ident〉 with its value set to the returned
   1.496 +    value, and return it.
   1.497      <p> Otherwise, this is a <a href="#parse-errors"><i>parse error</i></a>.
   1.498 -     Emit a 〈delim〉 with its value set to the <a
   1.499 +     Return a 〈delim〉 with its value set to the <a
   1.500       href="#current-input-character"><i>current input character</i></a>.
   1.501 -     Remain in this state.
   1.502  
   1.503     <dt>U+005D RIGHT SQUARE BRACKET (])
   1.504  
   1.505 -   <dd> Emit a 〈]〉. Remain in this state.
   1.506 +   <dd> Return a 〈]〉.
   1.507  
   1.508     <dt>U+005E CIRCUMFLEX ACCENT (^)
   1.509  
   1.510     <dd> If the <a href="#next-input-character"><i>next input
   1.511 -    character</i></a> is U+003D EQUALS SIGN (=), consume it and emit a
   1.512 -    〈prefix-match〉. Remain in this state.
   1.513 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.514 +    character</i></a> is U+003D EQUALS SIGN (=), consume it and return a
   1.515 +    〈prefix-match〉.
   1.516 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.517       href="#current-input-character"><i>current input character</i></a>.
   1.518 -     Remain in this state.
   1.519  
   1.520     <dt>U+007B LEFT CURLY BRACKET ({)
   1.521  
   1.522 -   <dd> Emit a 〈{〉. Remain in this state.
   1.523 +   <dd> Return a 〈{〉.
   1.524  
   1.525     <dt>U+007D RIGHT CURLY BRACKET (})
   1.526  
   1.527 -   <dd> Emit a 〈}〉. Remain in this state.
   1.528 +   <dd> Return a 〈}〉.
   1.529  
   1.530     <dt><a href="#digit"><i>digit</i></a>
   1.531  
   1.532 -   <dd> Switch to the <a href="#number-state0"><i>number state</i></a>. <a
   1.533 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.534 -    input character</i></a>.
   1.535 +   <dd> <a href="#consume-a-numeric-token0"><i>Consume a numeric
   1.536 +    token</i></a>, and return it.
   1.537  
   1.538     <dt>U+0055 LATIN CAPITAL LETTER U (U)
   1.539  
   1.540 @@ -1708,1024 +1673,711 @@
   1.541      PLUS SIGN (+) followed by a <a href="#hex-digit"><i>hex digit</i></a> or
   1.542      U+003F QUESTION MARK (?), consume the <a
   1.543      href="#next-input-character"><i>next input character</i></a>. <span
   1.544 -    class=note>Note: don’t consume both of them.</span> Switch to the <a
   1.545 -    href="#unicode-range-state0"><i>unicode-range state</i></a>.
   1.546 -    <p> Otherwise, switch to the <a href="#ident-state0"><i>ident
   1.547 -     state</i></a>. <a
   1.548 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.549 -     input character</i></a>.
   1.550 +    class=note>Note: don't consume both of them.</span> <a
   1.551 +    href="#consume-a-unicode-range-token0"><i>Consume a unicode-range
   1.552 +    token</i></a> and return it.
   1.553 +    <p> Otherwise, if the <a href="#next-input-character"><i
   1.554 +     title="next input character">next 3 input characters</i></a> are an
   1.555 +     <i>ASCII case-insensitive match</i> for "url(", consume them, <a
   1.556 +     href="#consume-a-url-token"><i>consume a url token</i></a>, and return
   1.557 +     it.
   1.558 +
   1.559 +    <p> Otherwise, <a
   1.560 +     href="#reconsume-the-current-input-character"><i>reconsume the current
   1.561 +     input character</i></a>, <a href="#consume-a-name0"><i>consume a
   1.562 +     name</i></a>, create an 〈ident〉 with its value set to the returned
   1.563 +     value, and return it.
   1.564  
   1.565     <dt><a href="#name-start-character"><i>name-start character</i></a>
   1.566  
   1.567 -   <dd> Switch to the <a href="#ident-state0"><i>ident state</i></a>. <a
   1.568 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.569 -    input character</i></a>.
   1.570 +   <dd> <a href="#reconsume-the-current-input-character"><i>Reconsume the
   1.571 +    current input character</i></a>, <a href="#consume-a-name0"><i>consume a
   1.572 +    name</i></a>, create an 〈ident〉 with its value set to the returned
   1.573 +    value, and return it.
   1.574  
   1.575     <dt>U+007C VERTICAL LINE (|)
   1.576  
   1.577     <dd> If the <a href="#next-input-character"><i>next input
   1.578 -    character</i></a> is U+003D EQUALS SIGN (=), consume it and emit a
   1.579 -    〈dash-match〉. Remain in this state.
   1.580 +    character</i></a> is U+003D EQUALS SIGN (=), consume it and return a
   1.581 +    〈dash-match〉.
   1.582      <p> Otherwise, if the <a href="#next-input-character"><i>next input
   1.583 -     character</i></a> is U+0073 VERTICAL LINE (|), consume it and emit a
   1.584 -     〈column〉. Remain in this state.
   1.585 -
   1.586 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.587 +     character</i></a> is U+0073 VERTICAL LINE (|), consume it and return a
   1.588 +     〈column〉.
   1.589 +
   1.590 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.591       href="#current-input-character"><i>current input character</i></a>.
   1.592 -     Remain in this state.
   1.593  
   1.594     <dt>U+007E TILDE (~)
   1.595  
   1.596     <dd> If the <a href="#next-input-character"><i>next input
   1.597 -    character</i></a> is U+003D EQUALS SIGN (=), consume it and emit an
   1.598 -    〈include-match〉. Remain in this state.
   1.599 -    <p> Otherwise, emit a 〈delim〉 with its value set to the <a
   1.600 +    character</i></a> is U+003D EQUALS SIGN (=), consume it and return an
   1.601 +    〈include-match〉.
   1.602 +    <p> Otherwise, return a 〈delim〉 with its value set to the <a
   1.603       href="#current-input-character"><i>current input character</i></a>.
   1.604 -     Remain in this state.
   1.605  
   1.606     <dt>EOF
   1.607  
   1.608 -   <dd> End this algorithm.
   1.609 +   <dd> Return an 〈EOF〉 token.
   1.610  
   1.611     <dt>anything else
   1.612  
   1.613 -   <dd> Emit a 〈delim〉 with its value set to the <a
   1.614 +   <dd> Return a 〈delim〉 with its value set to the <a
   1.615      href="#current-input-character"><i>current input character</i></a>.
   1.616 -    Remain in this state.
   1.617    </dl>
   1.618  
   1.619 -  <h4 id=double-quote-string-state><span class=secno>4.3.2. </span> <dfn
   1.620 -   id=double-quote-string-state0>Double-quote-string state</dfn></h4>
   1.621 -
   1.622 -  <p> When this state is first entered, create a 〈string〉 with its value
   1.623 -   initially set to the empty string.
   1.624 -
   1.625 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.626 -   character</i></a>.
   1.627 +  <h4 id=consume-a-numeric-token><span class=secno>4.3.2. </span> <dfn
   1.628 +   id=consume-a-numeric-token0>Consume a numeric token</dfn></h4>
   1.629 +
   1.630 +  <p> This section describes how to <a
   1.631 +   href="#consume-a-numeric-token0"><i>consume a numeric token</i></a> from a
   1.632 +   stream of characters. It returns either a 〈number〉, 〈percentage〉,
   1.633 +   or 〈dimension〉.
   1.634 +
   1.635 +  <p> <a href="#consume-a-number0"><i>Consume a number</i></a>.
   1.636 +
   1.637 +  <p> If the <a href="#next-input-character"><i
   1.638 +   title="next input character">next 3 input characters</i></a> <a
   1.639 +   href="#check-if-three-characters-would-start-an0"><i>would start an
   1.640 +   identifier</i></a>, then:
   1.641 +
   1.642 +  <ol>
   1.643 +   <li>Create a 〈dimension〉 with the same representation, value, and type
   1.644 +    flag as the returned number, and a unit set initially to the empty
   1.645 +    string.
   1.646 +
   1.647 +   <li><a href="#consume-a-name0"><i>Consume a name</i></a>. Set the
   1.648 +    〈dimension〉’s unit to the returned value.
   1.649 +
   1.650 +   <li>Return the 〈dimension〉.
   1.651 +  </ol>
   1.652 +
   1.653 +  <p> Otherwise, if the <a href="#next-input-character"><i>next input
   1.654 +   character</i></a> is U+0025 PERCENTAGE SIGN (%), consume it. Create a
   1.655 +   〈percentage〉 with the same representation and value as the returned
   1.656 +   number, and return it.
   1.657 +
   1.658 +  <p> Otherwise, create a 〈number〉 with the same representation, value,
   1.659 +   and type flag as the returned number, and return it.
   1.660 +
   1.661 +  <h4 id=consume-a-string-token><span class=secno>4.3.3. </span> <dfn
   1.662 +   id=consume-a-string-token0>Consume a string token</dfn></h4>
   1.663 +
   1.664 +  <p> This section describes how to <a
   1.665 +   href="#consume-a-string-token0"><i>consume a string token</i></a> from a
   1.666 +   stream of characters. It returns either a 〈string〉 or
   1.667 +   〈bad-string〉.
   1.668 +
   1.669 +  <p> This algorithm must be called with an <var>ending character</var>,
   1.670 +   which denotes the character that ends the string.
   1.671 +
   1.672 +  <p> Initially create a 〈string〉 with its value set to the empty string.
   1.673 +
   1.674 +  <p> Repeatedly consume the <a href="#next-input-character"><i>next input
   1.675 +   character</i></a> from the stream:
   1.676  
   1.677    <dl>
   1.678 -   <dt>U+0022 QUOTATION MARK (")
   1.679 +   <dt><var>ending character</var>
   1.680  
   1.681     <dt>EOF
   1.682  
   1.683 -   <dd> Emit the 〈string〉. Switch to the <a href="#data-state0"><i>data
   1.684 -    state</i></a>.
   1.685 +   <dd> Return the 〈string〉.
   1.686  
   1.687     <dt><a href="#newline"><i>newline</i></a>
   1.688  
   1.689 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Emit a
   1.690 -    〈bad-string〉. Switch to the <a href="#data-state0"><i>data
   1.691 -    state</i></a>. <a
   1.692 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.693 -    input character</i></a>.
   1.694 +   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Create a
   1.695 +    〈bad-string〉 and return it.
   1.696  
   1.697     <dt>U+005C REVERSE SOLIDUS (\)
   1.698  
   1.699 -   <dd> If the current input stream <a
   1.700 -    href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
   1.701 -    escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
   1.702 -    escaped character</i></a> and append the return value to the
   1.703 -    〈string〉’s value. Remain in this state.
   1.704 -    <p> Otherwise, if the <a href="#next-input-character"><i>next input
   1.705 -     character</i></a> is a <a href="#newline"><i>newline</i></a>, consume
   1.706 -     it. Remain in this state.
   1.707 -
   1.708 -    <p> Otherwise, this is a <a href="#parse-errors"><i>parse error</i></a>.
   1.709 -     Emit a 〈bad-string〉, then switch to the <a
   1.710 -     href="#data-state0"><i>data state</i></a>.
   1.711 -
   1.712 -   <dt>anything else
   1.713 -
   1.714 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.715 -    character</i></a> to the 〈string〉’s value. Remain in this state.
   1.716 -  </dl>
   1.717 -
   1.718 -  <h4 id=single-quote-string-state><span class=secno>4.3.3. </span> <dfn
   1.719 -   id=single-quote-string-state0>Single-quote-string state</dfn></h4>
   1.720 -
   1.721 -  <p> When this state is first entered, create a 〈string〉 with its value
   1.722 -   initially set to the empty string.
   1.723 -
   1.724 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.725 -   character</i></a>.
   1.726 -
   1.727 -  <dl>
   1.728 -   <dt>U+0027 APOSTROPHE (&apos;)
   1.729 -
   1.730 -   <dt>EOF
   1.731 -
   1.732 -   <dd> Emit the 〈string〉. Switch to the <a href="#data-state0"><i>data
   1.733 -    state</i></a>.
   1.734 -
   1.735 -   <dt><a href="#newline"><i>newline</i></a>
   1.736 -
   1.737 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Emit a
   1.738 -    〈bad-string〉. Switch to the <a href="#data-state0"><i>data
   1.739 -    state</i></a>. <a
   1.740 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.741 -    input character</i></a>.
   1.742 -
   1.743 -   <dt>U+005C REVERSE SOLIDUS (\)
   1.744 -
   1.745 -   <dd> If the current input stream <a
   1.746 -    href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
   1.747 -    escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
   1.748 -    escaped character</i></a> and append the return value to the
   1.749 -    〈string〉’s value. Remain in this state.
   1.750 -    <p> Otherwise, if the <a href="#next-input-character"><i>next input
   1.751 -     character</i></a> is a <a href="#newline"><i>newline</i></a>, consume
   1.752 -     it. Remain in this state.
   1.753 -
   1.754 -    <p> Otherwise, this is a <a href="#parse-errors"><i>parse error</i></a>.
   1.755 -     Emit a 〈bad-string〉, then switch to the <a
   1.756 -     href="#data-state0"><i>data state</i></a>.
   1.757 -
   1.758 -   <dt>anything else
   1.759 -
   1.760 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.761 -    character</i></a> to the 〈string〉’s value. Remain in this state.
   1.762 -  </dl>
   1.763 -
   1.764 -  <h4 id=hash-state><span class=secno>4.3.4. </span> <dfn id=hash-state0>Hash
   1.765 -   state</dfn></h4>
   1.766 -
   1.767 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.768 -   character</i></a>.
   1.769 -
   1.770 -  <dl>
   1.771 -   <dt><a href="#name-character"><i>name character</i></a>
   1.772 -
   1.773 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.774 -    character</i></a> to the 〈hash〉’s value. Remain in this state.
   1.775 -
   1.776 -   <dt>U+005C REVERSE SOLIDUS (\)
   1.777 -
   1.778 -   <dd> If the input stream <a
   1.779 +   <dd> If the stream <a
   1.780      href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
   1.781      escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
   1.782      escaped character</i></a> and append the returned character to the
   1.783 -    〈hash〉’s value. Remain in this state.
   1.784 +    〈string〉’s value.
   1.785 +    <p> Otherwise, if the <a href="#next-input-character"><i>next input
   1.786 +     character</i></a> is a newline, consume it.
   1.787 +
   1.788      <p> Otherwise, this is a <a href="#parse-errors"><i>parse error</i></a>.
   1.789 -     Emit the 〈hash〉. Switch to the <a href="#data-state0"><i>data
   1.790 -     state</i></a>. <a
   1.791 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.792 -     input character</i></a>.
   1.793 +     Create a 〈bad-string〉 and return it.
   1.794  
   1.795     <dt>anything else
   1.796  
   1.797 -   <dd> Emit the 〈hash〉. Switch to the <a href="#data-state0"><i>data
   1.798 -    state</i></a>. <a
   1.799 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.800 -    input character</i></a>.
   1.801 +   <dd> Append the <a href="#current-input-character"><i>current input
   1.802 +    character</i></a> to the 〈string〉’s value.
   1.803    </dl>
   1.804  
   1.805 -  <p class=note> If this state emits a 〈hash〉 whose value is the empty
   1.806 -   string, it's a spec or implementation error. The data validation performed
   1.807 -   in the <a href="#data-state0"><i>data state</i></a> should have guaranteed
   1.808 -   a non-empty value.
   1.809 -
   1.810 -  <h4 id=comment-state><span class=secno>4.3.5. </span> <dfn
   1.811 -   id=comment-state0>Comment state</dfn></h4>
   1.812 -
   1.813 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.814 -   character</i></a>.
   1.815 -
   1.816 -  <dl>
   1.817 -   <dt>U+002A ASTERISK (*)
   1.818 -
   1.819 -   <dd> If the <a href="#next-input-character"><i>next input
   1.820 -    character</i></a> is U+002F SOLIDUS (/), consume it, and switch to the <a
   1.821 -    href="#data-state0"><i>data state</i></a>.
   1.822 -    <p> Otherwise, do nothing and remain in this state.
   1.823 -
   1.824 -   <dt>EOF
   1.825 -
   1.826 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Switch to
   1.827 -    the <a href="#data-state0"><i>data state</i></a>. <a
   1.828 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.829 -    input character</i></a>.
   1.830 -
   1.831 -   <dt>anything else
   1.832 -
   1.833 -   <dd> Do nothing and remain in this state.
   1.834 -  </dl>
   1.835 -
   1.836 -  <h4 id=at-keyword-state><span class=secno>4.3.6. </span> <dfn
   1.837 -   id=at-keyword-state0>At-keyword state</dfn></h4>
   1.838 -
   1.839 -  <p> When this state is first entered, create an 〈at-keyword〉 with its
   1.840 -   value initially set to the empty string.
   1.841 -
   1.842 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.843 -   character</i></a>.
   1.844 -
   1.845 -  <dl>
   1.846 -   <dt><a href="#name-character"><i>name character</i></a>
   1.847 -
   1.848 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.849 -    character</i></a> to the 〈at-keyword〉’s value. Remain in this
   1.850 -    state.
   1.851 -
   1.852 -   <dt>U+005C REVERSE SOLIDUS (\)
   1.853 -
   1.854 -   <dd> If the input stream <a
   1.855 -    href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
   1.856 -    escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
   1.857 -    escaped character</i></a>. Append the returned character to the
   1.858 -    〈at-keyword〉’s value. Remain in this state.
   1.859 -    <p> Otherwise, emit the 〈at-keyword〉. Switch to the <a
   1.860 -     href="#data-state0"><i>data state</i></a>. <a
   1.861 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.862 -     input character</i></a>.
   1.863 -
   1.864 -   <dt>anything else
   1.865 -
   1.866 -   <dd> Emit the 〈at-keyword〉. Switch to the <a
   1.867 -    href="#data-state0"><i>data state</i></a>. <a
   1.868 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.869 -    input character</i></a>.
   1.870 -  </dl>
   1.871 -
   1.872 -  <p class=note> If this state emits an 〈at-keyword〉 whose value is the
   1.873 -   empty string, it's a spec or implementation error. The data validation
   1.874 -   performed in the <a href="#data-state0"><i>data state</i></a> should have
   1.875 -   guaranteed a non-empty value.
   1.876 -
   1.877 -  <h4 id=ident-state><span class=secno>4.3.7. </span> <dfn
   1.878 -   id=ident-state0>Ident state</dfn></h4>
   1.879 -
   1.880 -  <p> When this state is first entered, create an 〈ident〉 with its value
   1.881 -   initially set to the empty string.
   1.882 -
   1.883 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.884 -   character</i></a>.
   1.885 -
   1.886 -  <dl>
   1.887 -   <dt><a href="#name-character"><i>name character</i></a>
   1.888 -
   1.889 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.890 -    character</i></a> to the 〈ident〉’s value. Remain in this state.
   1.891 -
   1.892 -   <dt>U+005C REVERSE SOLIDUS (\)
   1.893 -
   1.894 -   <dd> If the input stream <a
   1.895 -    href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
   1.896 -    escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
   1.897 -    escaped character</i></a>. Append the returned character to the
   1.898 -    〈ident〉’s value. Remain in this state.
   1.899 -    <p> Otherwise, emit the 〈ident〉. Switch to the <a
   1.900 -     href="#data-state0"><i>data state</i></a>. <a
   1.901 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.902 -     input character</i></a>.
   1.903 -
   1.904 -   <dt>U+0028 LEFT PARENTHESIS (()
   1.905 -
   1.906 -   <dd> If the 〈ident〉’s value is an <a
   1.907 -    href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match
   1.908 -    for "url", switch to the <a href="#url-state0"><i>url state</i></a>.
   1.909 -    <p> Otherwise, emit a 〈function〉 with its value set to the
   1.910 -     〈ident〉’s value. Switch to the <a href="#data-state0"><i>data
   1.911 -     state</i></a>.
   1.912 -
   1.913 -   <dt>anything else
   1.914 -
   1.915 -   <dd> Emit the 〈ident〉. Switch to the <a href="#data-state0"><i>data
   1.916 -    state</i></a>. <a
   1.917 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.918 -    input character</i></a>.
   1.919 -  </dl>
   1.920 -
   1.921 -  <h4 id=number-state><span class=secno>4.3.8. </span> <dfn
   1.922 -   id=number-state0>Number state</dfn></h4>
   1.923 -
   1.924 -  <p> Create a 〈number〉 with its representation initially set to the
   1.925 -   empty string.
   1.926 -
   1.927 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.928 -   character</i></a>.
   1.929 -
   1.930 -  <dl>
   1.931 -   <dt>U+002B PLUS SIGN (+)
   1.932 -
   1.933 -   <dt>U+002D HYPHEN-MINUS (-)
   1.934 -
   1.935 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.936 -    character</i></a> to the 〈number〉’s representation.
   1.937 -    <p> If the <a href="#next-input-character"><i>next input
   1.938 -     character</i></a> is U+002E FULL STOP (.), consume the <a
   1.939 -     href="#next-input-character"><i title="next input character">next two
   1.940 -     input characters</i></a> and append them to the 〈number〉’s
   1.941 -     representation. Set the 〈number〉’s type flag to "number". Switch
   1.942 -     to the <a href="#number-rest-state0"><i>number-rest state</i></a>.
   1.943 -
   1.944 -    <p> Otherwise, consume the <a href="#next-input-character"><i>next input
   1.945 -     character</i></a> and append it to the 〈number〉’s representation.
   1.946 -     Switch to the <a href="#number-rest-state0"><i>number-rest
   1.947 -     state</i></a>.
   1.948 -
   1.949 -   <dt>U+002E FULL STOP (.)
   1.950 -
   1.951 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.952 -    character</i></a> to the 〈number〉’s representation. Consume the <a
   1.953 -    href="#next-input-character"><i>next input character</i></a> and append
   1.954 -    it to the 〈number〉’s representation. Set the 〈number〉’s type
   1.955 -    flag to "number". Switch to the <a
   1.956 -    href="#number-rest-state0"><i>number-rest state</i></a>.
   1.957 -
   1.958 -   <dt><a href="#digit"><i>digit</i></a>
   1.959 -
   1.960 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.961 -    character</i></a> to the 〈number〉’s representation. Switch to the
   1.962 -    <a href="#number-rest-state0"><i>number-rest state</i></a>.
   1.963 -
   1.964 -   <dt>anything else
   1.965 -
   1.966 -   <dd>
   1.967 -    <p class=note> Reaching this state indicates an error either in the spec
   1.968 -     or the implementation.
   1.969 -  </dl>
   1.970 -
   1.971 -  <h4 id=number-rest-state><span class=secno>4.3.9. </span> <dfn
   1.972 -   id=number-rest-state0>Number-rest state</dfn></h4>
   1.973 -
   1.974 -  <p> Consume the <a href="#next-input-character"><i>next input
   1.975 -   character</i></a>.
   1.976 -
   1.977 -  <dl>
   1.978 -   <dt><a href="#digit"><i>digit</i></a>
   1.979 -
   1.980 -   <dd> Append the <a href="#current-input-character"><i>current input
   1.981 -    character</i></a> to the 〈number〉’s representation. Remain in this
   1.982 -    state.
   1.983 -
   1.984 -   <dt>U+002E FULL STOP (.)
   1.985 -
   1.986 -   <dd> If the 〈number〉’s type flag is currently "integer" and the <a
   1.987 -    href="#next-input-character"><i>next input character</i></a> is a <a
   1.988 -    href="#digit"><i>digit</i></a>, consume it. Append U+002E FULL STOP (.)
   1.989 -    followed by the <a href="#digit"><i>digit</i></a> to the 〈number〉’s
   1.990 -    representation. Set the 〈number〉’s type flag to "number". Remain in
   1.991 -    this state.
   1.992 -    <p> Otherwise, set the 〈number〉’s value to the number produced by
   1.993 -     interpreting the 〈number〉’s representation as a base-10 number and
   1.994 -     emit it. Switch to the <a href="#data-state0"><i>data state</i></a>. <a
   1.995 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
   1.996 -     input character</i></a>.
   1.997 -
   1.998 -   <dt>U+0045 LATIN CAPITAL LETTER E (E)
   1.999 -
  1.1000 -   <dt>U+0065 LATIN SMALL LETTER E (e)
  1.1001 -
  1.1002 -   <dd> If the <a href="#next-input-character"><i>next input
  1.1003 -    character</i></a> is a <a href="#digit"><i>digit</i></a>, or the <a
  1.1004 -    href="#next-input-character"><i title="next input character">next 2 input
  1.1005 -    characters</i></a> are U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-)
  1.1006 -    followed by a <a href="#digit"><i>digit</i></a>, consume them. Append
  1.1007 -    U+0065 LATIN SMALL LETTER E (e) and the consumed characters to the
  1.1008 -    〈number〉’s representation. Switch to the <a
  1.1009 -    href="#sci-notation-state0"><i>sci-notation state</i></a>.
  1.1010 -    <p> Otherwise, switch to the <a href="#number-end-state0"><i>number-end
  1.1011 -     state</i></a>. <a
  1.1012 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1013 -     input character</i></a>.
  1.1014 -
  1.1015 -   <dt>anything else
  1.1016 -
  1.1017 -   <dd> Set the 〈number〉’s value to the number produced by interpreting
  1.1018 -    the 〈number〉’s representation as a base-10 number. Switch to the <a
  1.1019 -    href="#number-end-state0"><i>number-end state</i></a>. <a
  1.1020 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1021 -    input character</i></a>.
  1.1022 -  </dl>
  1.1023 -
  1.1024 -  <h4 id=sci-notation-state><span class=secno>4.3.10. </span> <dfn
  1.1025 -   id=sci-notation-state0>Sci-notation state</dfn></h4>
  1.1026 -
  1.1027 -  <p> Set the 〈number〉’s type flag to "number".
  1.1028 -
  1.1029 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1030 -   character</i></a>.
  1.1031 -
  1.1032 -  <dl>
  1.1033 -   <dt><a href="#digit"><i>digit</i></a>
  1.1034 -
  1.1035 -   <dd> Append the <a href="#current-input-character"><i>current input
  1.1036 -    character</i></a> to the 〈number〉’s representation. Remain in this
  1.1037 -    state.
  1.1038 -
  1.1039 -   <dt>anything else
  1.1040 -
  1.1041 -   <dd> Set the 〈number〉’s value to the number produced by <a
  1.1042 -    href="#convert-a-sci-notation-representation-in0"><i
  1.1043 -    title=sci-not-to-value>converting the 〈number〉’s representation to
  1.1044 -    a value</i></a>. Switch to the <a href="#number-end-state0"><i>number-end
  1.1045 -    state</i></a>. <a
  1.1046 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1047 -    input character</i></a>.
  1.1048 -  </dl>
  1.1049 -
  1.1050 -  <h4 id=number-end-state><span class=secno>4.3.11. </span> <dfn
  1.1051 -   id=number-end-state0>Number-end state</dfn></h4>
  1.1052 -
  1.1053 -  <p class=note> This state is only ever entered with a 〈number〉 having
  1.1054 -   been created by the previous state, with its value already set up
  1.1055 -   appropriately.
  1.1056 -
  1.1057 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1058 -   character</i></a>.
  1.1059 -
  1.1060 -  <p> If the input stream <a
  1.1061 -   href="#check-if-three-characters-would-start-an0"><i>starts with an
  1.1062 -   identifier</i></a>,
  1.1063 -
  1.1064 -  <dl>
  1.1065 -   <dt>U+0025 PERCENT SIGN (%)
  1.1066 -
  1.1067 -   <dd> Emit a percentage token with its value set to the 〈number〉’s
  1.1068 -    value. Switch to the <a href="#data-state0"><i>data state</i></a>.
  1.1069 -
  1.1070 -   <dt>the input stream <a
  1.1071 -    href="#check-if-three-characters-would-start-an0"><i>starts with an
  1.1072 -    identifier</i></a>
  1.1073 -
  1.1074 -   <dd> Create a 〈dimension〉 with its representation set to the
  1.1075 -    〈number〉’s representation, its value set to the 〈number〉’s
  1.1076 -    value, its type flag set to the 〈number〉’s type flag, and a unit
  1.1077 -    initially set to the empty string. Switch to the <a
  1.1078 -    href="#dimension-state0"><i>dimension state</i></a>. <a
  1.1079 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1080 -    input character</i></a>.
  1.1081 -
  1.1082 -   <dt>anything else
  1.1083 -
  1.1084 -   <dd> Emit the 〈number〉. Switch to the <a href="#data-state0"><i>data
  1.1085 -    state</i></a>. <a
  1.1086 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1087 -    input character</i></a>.
  1.1088 -  </dl>
  1.1089 -
  1.1090 -  <h4 id=dimension-state><span class=secno>4.3.12. </span> <dfn
  1.1091 -   id=dimension-state0>Dimension state</dfn></h4>
  1.1092 -  <!--
  1.1093 -		This state is currently always entered with a 〈dimension〉
  1.1094 -		having already been created and gotten over the "first valid character" hump,
  1.1095 -		so the 〈dimension〉 is already ready to emit.
  1.1096 -
  1.1097 -		If this ever becomes not true, make the necessary additions here
  1.1098 -		or things will break.
  1.1099 -	-->
  1.1100 -
  1.1101 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1102 -   character</i></a>.
  1.1103 -
  1.1104 -  <dl>
  1.1105 -   <dt><a href="#name-character"><i>name character</i></a>
  1.1106 -
  1.1107 -   <dd> Append the <a href="#current-input-character"><i>current input
  1.1108 -    character</i></a> to the 〈dimension〉’s unit. Remain in this state.
  1.1109 -
  1.1110 -   <dt>U+005C REVERSE SOLIDUS (\)
  1.1111 -
  1.1112 -   <dd> If the input stream <a
  1.1113 -    href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a valid
  1.1114 -    escape</i></a>, <a href="#consume-an-escaped-character0"><i>consume an
  1.1115 -    escaped character</i></a>. Append the returned character to the
  1.1116 -    〈dimension〉’s unit.
  1.1117 -    <p> Otherwise, emit the 〈dimension〉. Switch to the <a
  1.1118 -     href="#data-state0"><i>data state</i></a>. <a
  1.1119 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1120 -     input character</i></a>.
  1.1121 -
  1.1122 -   <dt>anything else
  1.1123 -
  1.1124 -   <dd> Emit the 〈dimension〉. Switch to the <a
  1.1125 -    href="#data-state0"><i>data state</i></a>. <a
  1.1126 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1127 -    input character</i></a>.
  1.1128 -  </dl>
  1.1129 -
  1.1130 -  <h4 id=url-state><span class=secno>4.3.13. </span> <dfn id=url-state0>URL
  1.1131 -   state</dfn></h4>
  1.1132 -
  1.1133 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1134 -   character</i></a>.
  1.1135 -
  1.1136 -  <dl>
  1.1137 -   <dt>EOF
  1.1138 -
  1.1139 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Emit a
  1.1140 -    〈bad-url〉. Switch to the <a href="#data-state0"><i>data
  1.1141 -    state</i></a>.
  1.1142 -
  1.1143 -   <dt>U+0022 QUOTATION MARK (")
  1.1144 -
  1.1145 -   <dd> Create a 〈url〉 with its value initially set to the empty string.
  1.1146 -    Switch to the <a href="#url-double-quote-state0"><i>url-double-quote
  1.1147 -    state</i></a>.
  1.1148 -
  1.1149 -   <dt>U+0027 APOSTROPHE (&apos;)
  1.1150 -
  1.1151 -   <dd> Create a 〈url〉 with its value initially set to the empty string.
  1.1152 -    Switch to the <a href="#url-single-quote-state0"><i>url-single-quote
  1.1153 -    state</i></a>.
  1.1154 -
  1.1155 -   <dt>U+0029 RIGHT PARENTHESIS ())
  1.1156 -
  1.1157 -   <dd> Emit a 〈url〉 with its value set to the empty string. Switch to
  1.1158 -    the <a href="#data-state0"><i>data state</i></a>.
  1.1159 -
  1.1160 -   <dt><a href="#whitespace"><i>whitespace</i></a>
  1.1161 -
  1.1162 -   <dd> Remain in this state.
  1.1163 -
  1.1164 -   <dt>anything else
  1.1165 -
  1.1166 -   <dd> Create a 〈url〉 with its value initially set to the empty string.
  1.1167 -    Switch to the <a href="#url-unquoted-state0"><i>url-unquoted
  1.1168 -    state</i></a>. <a
  1.1169 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1170 -    input character</i></a>.
  1.1171 -  </dl>
  1.1172 -
  1.1173 -  <h4 id=url-double-quote-state><span class=secno>4.3.14. </span> <dfn
  1.1174 -   id=url-double-quote-state0>URL-double-quote state</dfn></h4>
  1.1175 -
  1.1176 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1177 -   character</i></a>.
  1.1178 -
  1.1179 -  <dl>
  1.1180 -   <dt>EOF
  1.1181 -
  1.1182 -   <dd> Emit the 〈url〉. Switch to the <a href="#data-state0"><i>data
  1.1183 -    state</i></a>.
  1.1184 -
  1.1185 -   <dt>U+0022 QUOTATION MARK (")
  1.1186 -
  1.1187 -   <dd> Switch to the <a href="#url-end-state0"><i>url-end state</i></a>.
  1.1188 -
  1.1189 -   <dt><a href="#newline"><i>newline</i></a>
  1.1190 -
  1.1191 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Switch to
  1.1192 -    the <a href="#bad-url-state0"><i>bad-url state</i></a>.
  1.1193 -
  1.1194 -   <dt>U+005C REVERSE SOLIDUS (\)
  1.1195 -
  1.1196 -   <dd> If the <a href="#next-input-character"><i>next input
  1.1197 -    character</i></a> is EOF, this is a <a href="#parse-errors"><i>parse
  1.1198 -    error</i></a>. Emit a 〈bad-url〉. Switch to the <a
  1.1199 -    href="#data-state0"><i>data state</i></a>. <a
  1.1200 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1201 -    input character</i></a>.
  1.1202 -    <p> Otherwise, if the <a href="#next-input-character"><i>next input
  1.1203 -     character</i></a> is a <a href="#newline"><i>newline</i></a>, consume it
  1.1204 -     and remain in this state.
  1.1205 -
  1.1206 -    <p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
  1.1207 -     escaped character</i></a>. Append the returned character to the
  1.1208 -     〈url〉’s value. Remain in this state.
  1.1209 -
  1.1210 -   <dt>anything else
  1.1211 -
  1.1212 -   <dd> Append the <a href="#current-input-character"><i>current input
  1.1213 -    character</i></a> to the 〈url〉’s value. Remain in this state.
  1.1214 -  </dl>
  1.1215 -
  1.1216 -  <h4 id=url-single-quote-state><span class=secno>4.3.15. </span> <dfn
  1.1217 -   id=url-single-quote-state0>URL-single-quote state</dfn></h4>
  1.1218 -
  1.1219 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1220 -   character</i></a>.
  1.1221 -
  1.1222 -  <dl>
  1.1223 -   <dt>EOF
  1.1224 -
  1.1225 -   <dd> Emit the 〈url〉. Switch to the <a href="#data-state0"><i>data
  1.1226 -    state</i></a>.
  1.1227 -
  1.1228 -   <dt>U+0027 APOSTROPHE (&apos;)
  1.1229 -
  1.1230 -   <dd> Switch to the <a href="#url-end-state0"><i>url-end state</i></a>.
  1.1231 -
  1.1232 -   <dt><a href="#newline"><i>newline</i></a>
  1.1233 -
  1.1234 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Switch to
  1.1235 -    the <a href="#bad-url-state0"><i>bad-url state</i></a>.
  1.1236 -
  1.1237 -   <dt>U+005C REVERSE SOLIDUS (\)
  1.1238 -
  1.1239 -   <dd> If the <a href="#next-input-character"><i>next input
  1.1240 -    character</i></a> is EOF, this is a <a href="#parse-errors"><i>parse
  1.1241 -    error</i></a>. Emit a 〈bad-url〉. Switch to the <a
  1.1242 -    href="#data-state0"><i>data state</i></a>. <a
  1.1243 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1244 -    input character</i></a>.
  1.1245 -    <p> Otherwise, if the <a href="#next-input-character"><i>next input
  1.1246 -     character</i></a> is a <a href="#newline"><i>newline</i></a>, consume it
  1.1247 -     and remain in this state.
  1.1248 -
  1.1249 -    <p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
  1.1250 -     escaped character</i></a>. Append the returned character to the
  1.1251 -     〈url〉’s value. Remain in this state.
  1.1252 -
  1.1253 -   <dt>anything else
  1.1254 -
  1.1255 -   <dd> Append the <a href="#current-input-character"><i>current input
  1.1256 -    character</i></a> to the 〈url〉’s value. Remain in this state.
  1.1257 -  </dl>
  1.1258 -
  1.1259 -  <h4 id=url-unquoted-state><span class=secno>4.3.16. </span> <dfn
  1.1260 -   id=url-unquoted-state0>URL-unquoted state</dfn></h4>
  1.1261 -
  1.1262 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1263 -   character</i></a>.
  1.1264 -
  1.1265 -  <dl>
  1.1266 -   <dt>U+0029 RIGHT PARENTHESIS ())
  1.1267 -
  1.1268 -   <dt>EOF
  1.1269 -
  1.1270 -   <dd> Emit the 〈url〉. Switch to the <a href="#data-state0"><i>data
  1.1271 -    state</i></a>.
  1.1272 -
  1.1273 -   <dt><a href="#whitespace"><i>whitespace</i></a>
  1.1274 -
  1.1275 -   <dd> Switch to the <a href="#url-end-state0"><i>url-end state</i></a>.
  1.1276 -
  1.1277 -   <dt>U+0022 QUOTATION MARK (")
  1.1278 -
  1.1279 -   <dt>U+0027 APOSTROPHE (&apos;)
  1.1280 -
  1.1281 -   <dt>U+0028 LEFT PARENTHESIS (()
  1.1282 -
  1.1283 -   <dt><a href="#non-printable-character"><i>non-printable character</i></a>
  1.1284 -
  1.1285 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Switch to
  1.1286 -    the <a href="#bad-url-state0"><i>bad-url state</i></a>.
  1.1287 -
  1.1288 -   <dt>U+005C REVERSE SOLIDUS
  1.1289 -
  1.1290 -   <dd> If the <a href="#next-input-character"><i>next input
  1.1291 -    character</i></a> is a <a href="#newline"><i>newline</i></a> or EOF, this
  1.1292 -    is a <a href="#parse-errors"><i>parse error</i></a>. Switch to the <a
  1.1293 -    href="#bad-url-state0"><i>bad-url state</i></a>.
  1.1294 -    <p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
  1.1295 -     escaped character</i></a>. Append the returned character to the
  1.1296 -     〈url〉’s value. Remain in this state.
  1.1297 -
  1.1298 -   <dt>anything else
  1.1299 -
  1.1300 -   <dd> Append the <a href="#current-input-character"><i>current input
  1.1301 -    character</i></a> to the 〈url〉’s value. Remain in this state.
  1.1302 -  </dl>
  1.1303 -
  1.1304 -  <h4 id=url-end-state><span class=secno>4.3.17. </span> <dfn
  1.1305 -   id=url-end-state0>URL-end state</dfn></h4>
  1.1306 -
  1.1307 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1308 -   character</i></a>.
  1.1309 -
  1.1310 -  <dl>
  1.1311 -   <dt>U+0029 RIGHT PARENTHESIS ())
  1.1312 -
  1.1313 -   <dt>EOF
  1.1314 -
  1.1315 -   <dd> Emit the 〈url〉. Switch to the <a href="#data-state0"><i>data
  1.1316 -    state</i></a>.
  1.1317 -
  1.1318 -   <dt><a href="#whitespace"><i>whitespace</i></a>
  1.1319 -
  1.1320 -   <dd> Remain in this state.
  1.1321 -
  1.1322 -   <dt>anything else
  1.1323 -
  1.1324 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Switch to
  1.1325 -    the <a href="#bad-url-state0"><i>bad-url state</i></a>. <a
  1.1326 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1327 -    input character</i></a>.
  1.1328 -  </dl>
  1.1329 -
  1.1330 -  <h4 id=bad-url-state><span class=secno>4.3.18. </span> <dfn
  1.1331 -   id=bad-url-state0>Bad-URL state</dfn></h4>
  1.1332 -
  1.1333 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1334 -   character</i></a>.
  1.1335 -
  1.1336 -  <dl>
  1.1337 -   <dt>EOF
  1.1338 -
  1.1339 -   <dd> Emit a 〈bad-url〉. Switch to the <a href="#data-state0"><i>data
  1.1340 -    state</i></a>.
  1.1341 -
  1.1342 -   <dt>U+0029 RIGHT PARENTHESIS ())
  1.1343 -
  1.1344 -   <dd> Emit a 〈bad-url〉. Switch to the <a href="#data-state0"><i>data
  1.1345 -    state</i></a>.
  1.1346 -
  1.1347 -   <dt>U+005C REVERSE SOLIDUS
  1.1348 -
  1.1349 -   <dd> If the <a href="#next-input-character"><i>next input
  1.1350 -    character</i></a> is a <a href="#newline"><i>newline</i></a> or EOF, do
  1.1351 -    nothing and remain in this state.
  1.1352 -    <p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
  1.1353 -     escaped character</i></a>. Remain in this state.
  1.1354 -
  1.1355 -   <dt>anything else
  1.1356 -
  1.1357 -   <dd> Do nothing. Remain in this state.
  1.1358 -  </dl>
  1.1359 -
  1.1360 -  <h4 id=unicode-range-state><span class=secno>4.3.19. </span> <dfn
  1.1361 -   id=unicode-range-state0>Unicode-range state</dfn></h4>
  1.1362 -
  1.1363 -  <p> Create a new 〈unicode-range〉 with an empty range.
  1.1364 -
  1.1365 -  <p> Consume as many <a href="#hex-digit"><i>hex digits</i></a> as possible,
  1.1366 -   but no more than 6. If less than 6 <a href="#hex-digit"><i>hex
  1.1367 -   digits</i></a> were consumed, consume as many U+003F QUESTION MARK (?)
  1.1368 -   characters as possible, but no more than enough to make the total of <a
  1.1369 -   href="#hex-digit"><i>hex digits</i></a> and U+003F QUESTION MARK (?)
  1.1370 -   characters equal to 6.
  1.1371 -
  1.1372 -  <p> If any U+003F QUESTION MARK (?) characters were consumed, first
  1.1373 -   interpret the consumed characters as a hexadecimal number, with the U+003F
  1.1374 -   QUESTION MARK (?) characters replaced by U+0030 DIGIT ZERO (0) characters.
  1.1375 -   This is the <a href="#start-of-the-range"><i>start of the range</i></a>.
  1.1376 -   Then interpret the consumed characters as a hexadecimal number again, with
  1.1377 -   the U+003F QUESTION MARK (?) character replaced by U+0046 LATIN CAPITAL
  1.1378 -   LETTER F (F) characters. This is the <a href="#end-of-the-range"><i>end of
  1.1379 -   the range</i></a>. <a href="#set-the-unicode-ranges-range0"><i>Set the
  1.1380 -   〈unicode-range〉’s range</i></a>, then emit it. Switch to the <a
  1.1381 -   href="#data-state0"><i>data state</i></a>.
  1.1382 -
  1.1383 -  <p> Otherwise, interpret the digits as a hexadecimal number. This is the <a
  1.1384 -   href="#start-of-the-range"><i>start of the range</i></a>.
  1.1385 -
  1.1386 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1387 -   character</i></a>.
  1.1388 -
  1.1389 -  <dl>
  1.1390 -   <dt>U+002D HYPHEN-MINUS (-)
  1.1391 -
  1.1392 -   <dd> If the <a href="#next-input-character"><i>next input
  1.1393 -    character</i></a> is a <a href="#hex-digit"><i>hex digit</i></a>, consume
  1.1394 -    as many <a href="#hex-digit"><i>hex digits</i></a> as possible, but no
  1.1395 -    more than 6. Interpret the digits as a hexadecimal number. This is the <a
  1.1396 -    href="#end-of-the-range"><i>end of the range</i></a>. <a
  1.1397 -    href="#set-the-unicode-ranges-range0"><i>Set the 〈unicode-range〉’s
  1.1398 -    range</i></a>, then emit it. Switch to the <a href="#data-state0"><i>data
  1.1399 -    state</i></a>.
  1.1400 -    <p> Otherwise, <a href="#set-the-unicode-ranges-range0"><i>set the
  1.1401 -     〈unicode-range〉’s range</i></a> and emit it. Switch to the <a
  1.1402 -     href="#data-state0"><i>data state</i></a>. <a
  1.1403 -     href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1404 -     input character</i></a>.
  1.1405 -
  1.1406 -   <dt>anything else
  1.1407 -
  1.1408 -   <dd> <a href="#set-the-unicode-ranges-range0"><i>Set the
  1.1409 -    〈unicode-range〉’s range</i></a> and emit it. Switch to the <a
  1.1410 -    href="#data-state0"><i>data state</i></a>. <a
  1.1411 -    href="#reconsume-the-current-input-character"><i>Reconsume the current
  1.1412 -    input character</i></a>.
  1.1413 -  </dl>
  1.1414 -
  1.1415 -  <h3 id=tokenizer-algorithms><span class=secno>4.4. </span> Tokenizer
  1.1416 -   Algorithms</h3>
  1.1417 -
  1.1418 -  <p> This section defines a number of specialized spec algorithms used by
  1.1419 -   the tokenizer.
  1.1420 -
  1.1421 -  <h4 id=consume-an-escaped-character><span class=secno>4.4.1. </span> <dfn
  1.1422 -   id=consume-an-escaped-character0>Consume an escaped character</dfn></h4>
  1.1423 -
  1.1424 -  <p> This section describes how to <a
  1.1425 -   href="#consume-an-escaped-character0"><i>consume an escaped
  1.1426 -   character</i></a>. It assumes that the U+005C REVERSE SOLIDUS (\) has
  1.1427 -   already been consumed and that the next input character has already been
  1.1428 -   verified to not be a <a href="#newline"><i>newline</i></a> or EOF. It will
  1.1429 -   return a character.
  1.1430 -
  1.1431 -  <p> Consume the <a href="#next-input-character"><i>next input
  1.1432 -   character</i></a>.
  1.1433 -
  1.1434 -  <dl>
  1.1435 -   <dt><a href="#hex-digit"><i>hex digit</i></a>
  1.1436 -
  1.1437 -   <dd> Consume as many <a href="#hex-digit"><i>hex digits</i></a> as
  1.1438 -    possible, but no more than 5. <span class=note>Note that this means 1-6
  1.1439 -    hex digits have been consumed in total.</span> If the <a
  1.1440 -    href="#next-input-character"><i>next input character</i></a> is <a
  1.1441 -    href="#whitespace"><i>whitespace</i></a>, consume it as well. Interpret
  1.1442 -    the <a href="#hex-digit"><i>hex digits</i></a> as a hexadecimal number.
  1.1443 -    If this number is zero, or is greater than the <a
  1.1444 -    href="#maximum-allowed-codepoint"><i>maximum allowed codepoint</i></a>,
  1.1445 -    return U+FFFD REPLACEMENT CHARACTER (�). Otherwise, return the
  1.1446 -    character with that codepoint.
  1.1447 -
  1.1448 -   <dt>anything else
  1.1449 -
  1.1450 -   <dd> Return the <a href="#current-input-character"><i>current input
  1.1451 -    character</i></a>.
  1.1452 -  </dl>
  1.1453 -
  1.1454 -  <h4 id=set-the-unicode-ranges-range><span class=secno>4.4.2. </span> <dfn
  1.1455 -   id=set-the-unicode-ranges-range0>Set the 〈unicode-range〉’s
  1.1456 -   range</dfn></h4>
  1.1457 -
  1.1458 -  <p> This section describes how to set a 〈unicode-range〉’s range so
  1.1459 -   that the range it describes is within the supported range of unicode
  1.1460 -   characters.
  1.1461 -
  1.1462 -  <p> It assumes that the <dfn id=start-of-the-range>start of the range</dfn>
  1.1463 -   has been defined, the <dfn id=end-of-the-range>end of the range</dfn>
  1.1464 -   might be defined, and both are non-negative integers.
  1.1465 -
  1.1466 -  <p> If the <a href="#start-of-the-range"><i>start of the range</i></a> is
  1.1467 -   greater than the <a href="#maximum-allowed-codepoint"><i>maximum allowed
  1.1468 -   codepoint</i></a>, the 〈unicode-range〉’s range is empty.
  1.1469 -
  1.1470 -  <p> If the <a href="#end-of-the-range"><i>end of the range</i></a> is
  1.1471 -   defined, and it is less than the <a href="#start-of-the-range"><i>start of
  1.1472 -   the range</i></a>, the 〈unicode-range〉’s range is empty.
  1.1473 -
  1.1474 -  <p> If the <a href="#end-of-the-range"><i>end of the range</i></a> is not
  1.1475 -   defined, the 〈unicode-range〉’s range is the single character whose
  1.1476 -   codepoint is the <a href="#start-of-the-range"><i>start of the
  1.1477 -   range</i></a>.
  1.1478 -
  1.1479 -  <p> Otherwise, if the <a href="#end-of-the-range"><i>end of the
  1.1480 -   range</i></a> is greater than the <a
  1.1481 -   href="#maximum-allowed-codepoint"><i>maximum allowed codepoint</i></a>,
  1.1482 -   change it to the <a href="#maximum-allowed-codepoint"><i>maximum allowed
  1.1483 -   codepoint</i></a>. The 〈unicode-range〉’s range is all characters
  1.1484 -   between the character whose codepoint is the <a
  1.1485 -   href="#start-of-the-range"><i>start of the range</i></a> and the character
  1.1486 -   whose codepoint is the <a href="#end-of-the-range"><i>end of the
  1.1487 -   range</i></a>.
  1.1488 -
  1.1489 -  <h4 id=convert-a-sci-notation-representation-in><span class=secno>4.4.3.
  1.1490 -   </span> <dfn id=convert-a-sci-notation-representation-in0
  1.1491 -   title="convert a sci-notation representation into a value|sci-not-to-value">Convert
  1.1492 -   a sci-notation representation into a value</dfn></h4>
  1.1493 -
  1.1494 -  <p> This section describes how to turn a sci-notation representation into a
  1.1495 -   numeric value.
  1.1496 -
  1.1497 -  <p> Let <var>base</var> be the result of interpreting the portion of the
  1.1498 -   representation preceding the U+0045 LATIN CAPITAL LETTER E (E) or U+0065
  1.1499 -   LATIN SMALL LETTER E (e) as a base-10 number.
  1.1500 -
  1.1501 -  <p> Let <var>power</var> be the result of interpreting the portion of the
  1.1502 -   representation following the U+0045 LATIN CAPITAL LETTER E (E) or U+0065
  1.1503 -   LATIN SMALL LETTER E (e) as a base-10 number.
  1.1504 -
  1.1505 -  <p> Return <code><var>base</var> * 10<sup><var>power</var></sup></code>.
  1.1506 -
  1.1507 -  <h4 id=check-if-two-characters-are-a-valid-esca><span class=secno>4.4.4.
  1.1508 -   </span> <dfn id=check-if-two-characters-are-a-valid-esca0
  1.1509 -   title="check if two characters are a valid escape|are a valid escape|starts with a valid escape">Check
  1.1510 -   if two characters are a valid escape</dfn></h4>
  1.1511 -
  1.1512 -  <p> This section describes how to <a
  1.1513 -   href="#check-if-two-characters-are-a-valid-esca0"><i>check if two
  1.1514 -   characters are a valid escape</i></a>. The algorithm described here can be
  1.1515 -   called explicitly with two characters, or can be called with the input
  1.1516 -   stream itself. In the latter case, the two characters in question are the
  1.1517 -   <a href="#current-input-character"><i>current input character</i></a> and
  1.1518 -   the <a href="#next-input-character"><i>next input character</i></a>, in
  1.1519 -   that order.
  1.1520 -
  1.1521 -  <p class=note> This algorithm will not consume any additional characters.
  1.1522 -
  1.1523 -  <p> If the first character is not U+005D REVERSE SOLIDUS (\), return false.
  1.1524 -
  1.1525 -  <p> Otherwise, if the second character is a <a
  1.1526 -   href="#newline"><i>newline</i></a> or EOF character, return false.
  1.1527 -
  1.1528 -  <p> Otherwise, return true.
  1.1529 -
  1.1530 -  <h4 id=check-if-three-characters-would-start-an><span class=secno>4.4.5.
  1.1531 -   </span> <dfn id=check-if-three-characters-would-start-an0
  1.1532 -   title="check if three characters would start an identifier|starts with an identifier|start with an identifier|would start an identifier">Check
  1.1533 -   if three characters would start an identifier</dfn></h4>
  1.1534 -
  1.1535 -  <p> This section describes how to <a
  1.1536 -   href="#check-if-three-characters-would-start-an0"><i>check if three
  1.1537 -   characters would start an identifier</i></a>. The algorithm described here
  1.1538 -   can be called explicitly with three characters, or can be called with the
  1.1539 -   input stream itself. In the latter case, the three characters in question
  1.1540 -   are the <a href="#current-input-character"><i>current input
  1.1541 -   character</i></a> and the <a href="#next-input-character"><i
  1.1542 -   title="next input character">next two input characters</i></a>, in that
  1.1543 -   order.
  1.1544 -
  1.1545 -  <p class=note> This algorithm will not consume any additional characters.
  1.1546 -
  1.1547 -  <p> Look at the first character:
  1.1548 -
  1.1549 -  <dl>
  1.1550 -   <dt>U+002D HYPHEN-MINUS
  1.1551 -
  1.1552 -   <dd> If the second character is a <a
  1.1553 -    href="#name-start-character"><i>name-start character</i></a> or the
  1.1554 -    second and third characters <a
  1.1555 -    href="#check-if-two-characters-are-a-valid-esca0"><i>are a valid
  1.1556 -    escape</i></a>, return true. Otherwise, return false.
  1.1557 -
  1.1558 -   <dt><a href="#name-start-character"><i>name-start character</i></a>
  1.1559 -
  1.1560 -   <dd> Return true.
  1.1561 -
  1.1562 -   <dt>U+005C REVERSE SOLIDUS (\)
  1.1563 -
  1.1564 -   <dd> If the first and second characters <a
  1.1565 -    href="#check-if-two-characters-are-a-valid-esca0"><i>are a valid
  1.1566 -    escape</i></a>, return true. Otherwise, return false.
  1.1567 -  </dl>
  1.1568 -
  1.1569 -  <h4 id=check-if-three-characters-would-start-a-><span class=secno>4.4.6.
  1.1570 -   </span> <dfn id=check-if-three-characters-would-start-a-0
  1.1571 -   title="check if three characters would start a number|starts with a number|start with a number|would start a number">Check
  1.1572 -   if three characters would start a number</dfn></h4>
  1.1573 -
  1.1574 -  <p> This section describes how to <a
  1.1575 -   href="#check-if-three-characters-would-start-a-0"><i>check if three
  1.1576 -   characters would start a number</i></a>. The algorithm described here can
  1.1577 -   be called explicitly with three characters, or can be called with the
  1.1578 -   input stream itself. In the latter case, the three characters in question
  1.1579 -   are the <a href="#current-input-character"><i>current input
  1.1580 -   character</i></a> and the <a href="#next-input-character"><i
  1.1581 -   title="next input character">next two input characters</i></a>, in that
  1.1582 -   order.
  1.1583 -
  1.1584 -  <p class=note> This algorithm will not consume any additional characters.
  1.1585 -
  1.1586 -  <p> Look at the first character:
  1.1587 -
  1.1588 -  <dl>
  1.1589 -   <dt>U+002B PLUS SIGN (+)
  1.1590 -
  1.1591 -   <dt>U+002D HYPHEN-MINUS (-)
  1.1592 -
  1.1593 -   <dd> If the second character is a <a href="#digit"><i>digit</i></a>,
  1.1594 -    return true.
  1.1595 -    <p> Otherwise, if the second character is a U+002E FULL STOP (.) and the
  1.1596 -     third character is a <a href="#digit"><i>digit</i></a>, return true.
  1.1597 -
  1.1598 -    <p> Otherwise, return false.
  1.1599 -
  1.1600 -   <dt>U+002E FULL STOP (.)
  1.1601 -
  1.1602 -   <dd> If the second character is a <a href="#digit"><i>digit</i></a>,
  1.1603 -    return true. Otherwise, return false.
  1.1604 -
  1.1605 -   <dt><a href="#digit"><i>digit</i></a>
  1.1606 -
  1.1607 -   <dd> Return true.
  1.1608 -
  1.1609 -   <dt>anything else
  1.1610 -
  1.1611 -   <dd> Return false.
  1.1612 -  </dl>
  1.1613 -
  1.1614 -  <h3 id=changes-from-css-2.1-tokenizer><span class=secno>4.5. </span>
  1.1615 -   Changes from CSS 2.1 Tokenizer</h3>
  1.1616 -
  1.1617 -  <p> <em>This section is non-normative.</em>
  1.1618 -
  1.1619 -  <p class=note> Note that the point of this spec is to match reality;
  1.1620 -   changes from CSS2.1&apos;s tokenizer are nearly always because the
  1.1621 -   tokenizer specified something that doesn't match actual browser behavior,
  1.1622 -   or left something unspecified. If some detail doesn't match browsers,
  1.1623 -   please let me know as it's almost certainly unintentional.
  1.1624 +  <h4 id=consume-a-url-token-><span class=secno>4.3.4. </span> <dfn
  1.1625 +   id=consume-a-url-token>Consume a url token</dfn></h4>
  1.1626 +
  1.1627 +  <p> This section describes how to <a href="#consume-a-url-token"><i>consume
  1.1628 +   a url token</i></a> from a stream of characters. It returns either a
  1.1629 +   〈url〉 or a 〈bad-url〉.
  1.1630 +
  1.1631 +  <p class=note> This algorithm assumes that the initial "url(" has already
  1.1632 +   been consumed.
  1.1633 +
  1.1634 +  <p> Execute the following steps in order:
  1.1635  
  1.1636    <ol>
  1.1637 -   <li> The 〈prefix-match〉, 〈suffix-match〉, and 〈substring-match〉
  1.1638 -    tokens have been imported from Selectors 3.
  1.1639 -
  1.1640 -   <li> The BAD-URI token (now 〈bad-url〉) is "self-contained". In other
  1.1641 -    words, once the tokenizer realizes it's in a 〈bad-url〉 rather than a
  1.1642 -    〈url〉, it just seeks forward to look for the closing ), ignoring
  1.1643 -    everything else. This behavior is simpler than treating it like a
  1.1644 -    〈function〉 and paying attention to opened blocks and such. Only
  1.1645 -    WebKit exhibits this behavior, but it doesn't appear that we've gotten
  1.1646 -    any compat bugs from it.
  1.1647 -
  1.1648 -   <li> The 〈comma〉 has been added.
  1.1649 -
  1.1650 -   <li> The number, percentage, and 〈dimension〉s have been changed to
  1.1651 -    include the preceding +/- sign as part of their value (rather than as a
  1.1652 -    separate 〈delim〉 that needs to be manually handled every time the
  1.1653 -    token is mentioned in other specs). The only consequence of this is that
  1.1654 -    comments can no longer be inserted between the sign and the number.
  1.1655 -
  1.1656 -   <li> Scientific notation is supported for numbers/percentages/dimensions
  1.1657 -    to match SVG, per WG resolution.
  1.1658 -
  1.1659 -   <li> 〈column〉 has been added, to keep Selectors parsing in
  1.1660 -    single-token lookahead.
  1.1661 -  </ol>
  1.1662 -  <!--
  1.1663 +   <li> Initially create a 〈url〉 with its value set to the empty string.
  1.1664 +
  1.1665 +   <li> Consume as much <a href="#whitespace"><i>whitespace</i></a> as
  1.1666 +    possible.
  1.1667 +
  1.1668 +   <li> If the <a href="#next-input-character"><i>next input
  1.1669 +    character</i></a> is EOF, create a 〈bad-url〉 and return it.
  1.1670 +
  1.1671 +   <li> If the <a href="#next-input-character"><i>next input
  1.1672 +    character</i></a> is a U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE
  1.1673 +    (&apos;), then:
  1.1674 +    <ol>
  1.1675 +     <li> <a href="#consume-a-string-token0"><i>Consume a string
  1.1676 +      token</i></a> with the <a href="#current-input-character"><i>current
  1.1677 +      input character</i></a> as the ending character.
  1.1678 +
  1.1679 +     <li> If a 〈bad-string〉 was returned, <a
  1.1680 +      href="#consume-the-remnants-of-a-bad-url0"><i>consume the remnants of a
  1.1681 +      bad url</i></a>, create a 〈bad-url〉, and return it.
  1.1682 +
  1.1683 +     <li> Set the 〈url〉’s value to the returned 〈string〉’s value.
  1.1684 +
  1.1685 +     <li> Consume as much <a href="#whitespace"><i>whitespace</i></a> as
  1.1686 +      possible.
  1.1687 +
  1.1688 +     <li> If the <a href="#next-input-character"><i>next input
  1.1689 +      character</i></a> is U+0029 RIGHT PARENTHESIS ()) or EOF, consume it
  1.1690 +      and return the 〈url〉; otherwise, <a
  1.1691 +      href="#consume-the-remnants-of-a-bad-url0"><i>consume the remnants of a
  1.1692 +      bad url</i></a>, create a 〈bad-url〉, and return it.
  1.1693 +    </ol>
  1.1694 +
  1.1695 +   <li> Repeatedly consume the <a href="#next-input-character"><i>next input
  1.1696 +    character</i></a> from the stream:
  1.1697 +    <dl>
  1.1698 +     <dt>U+0029 RIGHT PARENTHESIS ())
  1.1699 +
  1.1700 +     <dt>EOF
  1.1701 +
  1.1702 +     <dd> Return the 〈url〉.
  1.1703 +
  1.1704 +     <dt><a href="#whitespace"><i>whitespace</i></a>
  1.1705 +
  1.1706 +     <dd> Consume as much <a href="#whitespace"><i>whitespace</i></a> as
  1.1707 +      possible. If the <a href="#next-input-character"><i>next input
  1.1708 +      character</i></a> is U+0029 RIGHT PARENTHESIS ()) or EOF, consume it
  1.1709 +      and return the 〈url〉; otherwise, <a
  1.1710 +      href="#consume-the-remnants-of-a-bad-url0"><i>consume the remnants of a
  1.1711 +      bad url</i></a>, create a 〈bad-url〉, and return it.
  1.1712 +
  1.1713 +     <dt>U+0022 QUOTATION MARK (")
  1.1714 +
  1.1715 +     <dt>U+0027 APOSTROPHE (&apos;)
  1.1716 +
  1.1717 +     <dt>U+0028 LEFT PARENTHESIS (()
  1.1718 +
  1.1719 +     <dt><a href="#non-printable-character"><i>non-printable
  1.1720 +      character</i></a>
  1.1721 +
  1.1722 +     <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. <a
  1.1723 +      href="#consume-the-remnants-of-a-bad-url0"><i>Consume the remnants of a
  1.1724 +      bad url</i></a>, create a 〈bad-url〉, and return it.
  1.1725 +
  1.1726 +     <dt>U+005C REVERSE SOLIDUS
  1.1727 +
  1.1728 +     <dd> If the stream <a
  1.1729 +      href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a
  1.1730 +      valid escape</i></a>, <a
  1.1731 +      href="#consume-an-escaped-character0"><i>consume an escaped
  1.1732 +      character</i></a> and append the returned character to the
  1.1733 +      〈url〉’s value.
  1.1734 +      <p> Otherwise, this is a <a href="#parse-errors"><i>parse
  1.1735 +       error</i></a>. <a
  1.1736 +       href="#consume-the-remnants-of-a-bad-url0"><i>Consume the remnants of
  1.1737 +       a bad url</i></a>, create a 〈bad-url〉, and return it.
  1.1738 +
  1.1739 +     <dt>anything else
  1.1740 +
  1.1741 +     <dd> Append the <a href="#current-input-character"><i>current input
  1.1742 +      character</i></a> to the 〈url〉’s value.
  1.1743 +    </dl>
  1.1744 +
  1.1745 +    <h4 id=consume-a-unicode-range-token><span class=secno>4.3.5. </span>
  1.1746 +     <dfn id=consume-a-unicode-range-token0>Consume a unicode-range
  1.1747 +     token</dfn></h4>
  1.1748 +
  1.1749 +    <p> This section describes how to <a
  1.1750 +     href="#consume-a-unicode-range-token0"><i>consume a unicode-range
  1.1751 +     token</i></a>. It returns a 〈unicode-range〉 token.
  1.1752 +
  1.1753 +    <p class=note> This algorithm assumes that the initial "u+" has been
  1.1754 +     consumed, and the next character verified to be a <a
  1.1755 +     href="#hex-digit"><i>hex digit</i></a> or a "?".
  1.1756 +
  1.1757 +    <p> Execute the following steps in order:
  1.1758 +
  1.1759 +    <ol>
  1.1760 +     <li> Create a new 〈unicode-range〉 with an empty range.
  1.1761 +
  1.1762 +     <li> Consume as many <a href="#hex-digit"><i>hex digits</i></a> as
  1.1763 +      possible, but no more than 6. If less than 6 <a
  1.1764 +      href="#hex-digit"><i>hex digits</i></a> were consumed, consume as many
  1.1765 +      U+003F QUESTION MARK (?) characters as possible, but no more than
  1.1766 +      enough to make the total of <a href="#hex-digit"><i>hex digits</i></a>
  1.1767 +      and U+003F QUESTION MARK (?) characters equal to 6.
  1.1768 +      <p> If any U+003F QUESTION MARK (?) characters were consumed, then:
  1.1769 +
  1.1770 +      <ol>
  1.1771 +       <li> Interpret the consumed characters as a hexadecimal number, with
  1.1772 +        the U+003F QUESTION MARK (?) characters replaced by U+0030 DIGIT ZERO
  1.1773 +        (0) characters. This is the <a href="#start-of-the-range"><i>start of
  1.1774 +        the range</i></a>.
  1.1775 +
  1.1776 +       <li> Interpret the consumed characters as a hexadecimal number again,
  1.1777 +        with the U+003F QUESTION MARK (?) character replaced by U+0046 LATIN
  1.1778 +        CAPITAL LETTER F (F) characters. This is the <a
  1.1779 +        href="#end-of-the-range"><i>end of the range</i></a>.
  1.1780 +
  1.1781 +       <li> <a href="#set-the-unicode-ranges-range0"><i>Set the
  1.1782 +        〈unicode-range〉’s range</i></a>, then return it.
  1.1783 +      </ol>
  1.1784 +
  1.1785 +      <p> Otherwise, interpret the digits as a hexadecimal number. This is
  1.1786 +       the <a href="#start-of-the-range"><i>start of the range</i></a>.
  1.1787 +
  1.1788 +     <li> If the <a href="#next-input-character"><i
  1.1789 +      title="next input character">next 2 input character</i></a> are U+002D
  1.1790 +      HYPHEN-MINUS (-) followed by a <a href="#hex-digit"><i>hex
  1.1791 +      digit</i></a>, then:
  1.1792 +      <ol>
  1.1793 +       <li>Consume the <a href="#next-input-character"><i>next input
  1.1794 +        character</i></a>.
  1.1795 +
  1.1796 +       <li> Consume as many <a href="#hex-digit"><i>hex digits</i></a> as
  1.1797 +        possible, but no more than 6. Interpret the digits as a hexadecimal
  1.1798 +        number. This is the <a href="#end-of-the-range"><i>end of the
  1.1799 +        range</i></a>. <a href="#set-the-unicode-ranges-range0"><i>Set the
  1.1800 +        〈unicode-range〉’s range</i></a>, then return it.
  1.1801 +      </ol>
  1.1802 +
  1.1803 +     <li> <a href="#set-the-unicode-ranges-range0"><i>Set the
  1.1804 +      〈unicode-range〉’s range</i></a> and return it.
  1.1805 +      <h4 id=consume-an-escaped-character><span class=secno>4.3.6. </span>
  1.1806 +       <dfn id=consume-an-escaped-character0>Consume an escaped
  1.1807 +       character</dfn></h4>
  1.1808 +
  1.1809 +      <p> This section describes how to <a
  1.1810 +       href="#consume-an-escaped-character0"><i>consume an escaped
  1.1811 +       character</i></a>. It assumes that the U+005C REVERSE SOLIDUS (\) has
  1.1812 +       already been consumed and that the next input character has already
  1.1813 +       been verified to not be a <a href="#newline"><i>newline</i></a> or
  1.1814 +       EOF. It will return a character.
  1.1815 +
  1.1816 +      <p> Consume the <a href="#next-input-character"><i>next input
  1.1817 +       character</i></a>.
  1.1818 +
  1.1819 +      <dl>
  1.1820 +       <dt><a href="#hex-digit"><i>hex digit</i></a>
  1.1821 +
  1.1822 +       <dd> Consume as many <a href="#hex-digit"><i>hex digits</i></a> as
  1.1823 +        possible, but no more than 5. <span class=note>Note that this means
  1.1824 +        1-6 hex digits have been consumed in total.</span> If the <a
  1.1825 +        href="#next-input-character"><i>next input character</i></a> is <a
  1.1826 +        href="#whitespace"><i>whitespace</i></a>, consume it as well.
  1.1827 +        Interpret the <a href="#hex-digit"><i>hex digits</i></a> as a
  1.1828 +        hexadecimal number. If this number is zero, or is greater than the <a
  1.1829 +        href="#maximum-allowed-codepoint"><i>maximum allowed
  1.1830 +        codepoint</i></a>, return U+FFFD REPLACEMENT CHARACTER (�).
  1.1831 +        Otherwise, return the character with that codepoint.
  1.1832 +
  1.1833 +       <dt>anything else
  1.1834 +
  1.1835 +       <dd> Return the <a href="#current-input-character"><i>current input
  1.1836 +        character</i></a>.
  1.1837 +      </dl>
  1.1838 +
  1.1839 +      <h4 id=check-if-two-characters-are-a-valid-esca><span
  1.1840 +       class=secno>4.3.7. </span> <dfn
  1.1841 +       id=check-if-two-characters-are-a-valid-esca0
  1.1842 +       title="check if two characters are a valid escape|are a valid escape|starts with a valid escape">Check
  1.1843 +       if two characters are a valid escape</dfn></h4>
  1.1844 +
  1.1845 +      <p> This section describes how to <a
  1.1846 +       href="#check-if-two-characters-are-a-valid-esca0"><i>check if two
  1.1847 +       characters are a valid escape</i></a>. The algorithm described here
  1.1848 +       can be called explicitly with two characters, or can be called with
  1.1849 +       the input stream itself. In the latter case, the two characters in
  1.1850 +       question are the <a href="#current-input-character"><i>current input
  1.1851 +       character</i></a> and the <a href="#next-input-character"><i>next
  1.1852 +       input character</i></a>, in that order.
  1.1853 +
  1.1854 +      <p class=note> This algorithm will not consume any additional
  1.1855 +       characters.
  1.1856 +
  1.1857 +      <p> If the first character is not U+005D REVERSE SOLIDUS (\), return
  1.1858 +       false.
  1.1859 +
  1.1860 +      <p> Otherwise, if the second character is a <a
  1.1861 +       href="#newline"><i>newline</i></a> or EOF character, return false.
  1.1862 +
  1.1863 +      <p> Otherwise, return true.
  1.1864 +
  1.1865 +      <h4 id=check-if-three-characters-would-start-an><span
  1.1866 +       class=secno>4.3.8. </span> <dfn
  1.1867 +       id=check-if-three-characters-would-start-an0
  1.1868 +       title="check if three characters would start an identifier|starts with an identifier|start with an identifier|would start an identifier">Check
  1.1869 +       if three characters would start an identifier</dfn></h4>
  1.1870 +
  1.1871 +      <p> This section describes how to <a
  1.1872 +       href="#check-if-three-characters-would-start-an0"><i>check if three
  1.1873 +       characters would start an identifier</i></a>. The algorithm described
  1.1874 +       here can be called explicitly with three characters, or can be called
  1.1875 +       with the input stream itself. In the latter case, the three characters
  1.1876 +       in question are the <a href="#current-input-character"><i>current
  1.1877 +       input character</i></a> and the <a href="#next-input-character"><i
  1.1878 +       title="next input character">next two input characters</i></a>, in
  1.1879 +       that order.
  1.1880 +
  1.1881 +      <p class=note> This algorithm will not consume any additional
  1.1882 +       characters.
  1.1883 +
  1.1884 +      <p> Look at the first character:
  1.1885 +
  1.1886 +      <dl>
  1.1887 +       <dt>U+002D HYPHEN-MINUS
  1.1888 +
  1.1889 +       <dd> If the second character is a <a
  1.1890 +        href="#name-start-character"><i>name-start character</i></a> or the
  1.1891 +        second and third characters <a
  1.1892 +        href="#check-if-two-characters-are-a-valid-esca0"><i>are a valid
  1.1893 +        escape</i></a>, return true. Otherwise, return false.
  1.1894 +
  1.1895 +       <dt><a href="#name-start-character"><i>name-start character</i></a>
  1.1896 +
  1.1897 +       <dd> Return true.
  1.1898 +
  1.1899 +       <dt>U+005C REVERSE SOLIDUS (\)
  1.1900 +
  1.1901 +       <dd> If the first and second characters <a
  1.1902 +        href="#check-if-two-characters-are-a-valid-esca0"><i>are a valid
  1.1903 +        escape</i></a>, return true. Otherwise, return false.
  1.1904 +      </dl>
  1.1905 +
  1.1906 +      <h4 id=check-if-three-characters-would-start-a-><span
  1.1907 +       class=secno>4.3.9. </span> <dfn
  1.1908 +       id=check-if-three-characters-would-start-a-0
  1.1909 +       title="check if three characters would start a number|starts with a number|start with a number|would start a number">Check
  1.1910 +       if three characters would start a number</dfn></h4>
  1.1911 +
  1.1912 +      <p> This section describes how to <a
  1.1913 +       href="#check-if-three-characters-would-start-a-0"><i>check if three
  1.1914 +       characters would start a number</i></a>. The algorithm described here
  1.1915 +       can be called explicitly with three characters, or can be called with
  1.1916 +       the input stream itself. In the latter case, the three characters in
  1.1917 +       question are the <a href="#current-input-character"><i>current input
  1.1918 +       character</i></a> and the <a href="#next-input-character"><i
  1.1919 +       title="next input character">next two input characters</i></a>, in
  1.1920 +       that order.
  1.1921 +
  1.1922 +      <p class=note> This algorithm will not consume any additional
  1.1923 +       characters.
  1.1924 +
  1.1925 +      <p> Look at the first character:
  1.1926 +
  1.1927 +      <dl>
  1.1928 +       <dt>U+002B PLUS SIGN (+)
  1.1929 +
  1.1930 +       <dt>U+002D HYPHEN-MINUS (-)
  1.1931 +
  1.1932 +       <dd> If the second character is a <a href="#digit"><i>digit</i></a>,
  1.1933 +        return true.
  1.1934 +        <p> Otherwise, if the second character is a U+002E FULL STOP (.) and
  1.1935 +         the third character is a <a href="#digit"><i>digit</i></a>, return
  1.1936 +         true.
  1.1937 +
  1.1938 +        <p> Otherwise, return false.
  1.1939 +
  1.1940 +       <dt>U+002E FULL STOP (.)
  1.1941 +
  1.1942 +       <dd> If the second character is a <a href="#digit"><i>digit</i></a>,
  1.1943 +        return true. Otherwise, return false.
  1.1944 +
  1.1945 +       <dt><a href="#digit"><i>digit</i></a>
  1.1946 +
  1.1947 +       <dd> Return true.
  1.1948 +
  1.1949 +       <dt>anything else
  1.1950 +
  1.1951 +       <dd> Return false.
  1.1952 +      </dl>
  1.1953 +
  1.1954 +      <h4 id=consume-a-name><span class=secno>4.3.10. </span> <dfn
  1.1955 +       id=consume-a-name0>Consume a name</dfn></h4>
  1.1956 +
  1.1957 +      <p> This section describes how to <a href="#consume-a-name0"><i>consume
  1.1958 +       a name</i></a> from a stream of characters. It returns a string
  1.1959 +       containing the largest name that can be formed from adjacent
  1.1960 +       characters in the stream, starting from the first.
  1.1961 +
  1.1962 +      <p class=note> This algorithm does not do the verification of the first
  1.1963 +       few characters that are necessary to ensure the returned characters
  1.1964 +       would constitute an 〈ident〉. If that is the intended use, ensure
  1.1965 +       that the stream <a
  1.1966 +       href="#check-if-three-characters-would-start-an0"><i>starts with an
  1.1967 +       identifier</i></a> before calling this algorithm.
  1.1968 +
  1.1969 +      <p> Let <var>result</var> initially be an empty string.
  1.1970 +
  1.1971 +      <p> Repeatedly consume the <a href="#next-input-character"><i>next
  1.1972 +       input character</i></a> from the stream:
  1.1973 +
  1.1974 +      <dl>
  1.1975 +       <dt><a href="#name-character"><i>name character</i></a>
  1.1976 +
  1.1977 +       <dd> Append the character to <var>result</var>.
  1.1978 +
  1.1979 +       <dt>the stream <a
  1.1980 +        href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a
  1.1981 +        valid escape</i></a>
  1.1982 +
  1.1983 +       <dd> <a href="#consume-an-escaped-character0"><i>Consume an escaped
  1.1984 +        character</i></a>. Append the returned character to
  1.1985 +        <var>result</var>.
  1.1986 +
  1.1987 +       <dt>anything else
  1.1988 +
  1.1989 +       <dd> Return <var>result</var>.
  1.1990 +      </dl>
  1.1991 +
  1.1992 +      <h4 id=consume-a-number><span class=secno>4.3.11. </span> <dfn
  1.1993 +       id=consume-a-number0>Consume a number</dfn></h4>
  1.1994 +
  1.1995 +      <p> This section describes how to <a
  1.1996 +       href="#consume-a-number0"><i>consume a number</i></a> from a stream of
  1.1997 +       characters. It returns a 3-tuple of a string representation, a numeric
  1.1998 +       value, and a type flag which is either "integer" or "number".
  1.1999 +
  1.2000 +      <p class=note> This algorithm does not do the verification of the first
  1.2001 +       few characters that are necessary to ensure a number can be obtained
  1.2002 +       from the stream. Ensure that the stream <a
  1.2003 +       href="#check-if-three-characters-would-start-a-0"><i>starts with a
  1.2004 +       number</i></a> before calling this algorithm.
  1.2005 +
  1.2006 +      <p> Execute the following steps in order:
  1.2007 +
  1.2008 +      <ol>
  1.2009 +       <li> Initially set <var>repr</var> to the empty string and
  1.2010 +        <var>type</var> to "integer".
  1.2011 +
  1.2012 +       <li> If the <a href="#next-input-character"><i>next input
  1.2013 +        character</i></a> is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  1.2014 +        consume it and append it to <var>repr</var>.
  1.2015 +
  1.2016 +       <li> While the <a href="#next-input-character"><i>next input
  1.2017 +        character</i></a> is a <a href="#digit"><i>digit</i></a>, consume it
  1.2018 +        and append it to <var>repr</var>.
  1.2019 +
  1.2020 +       <li> If the <a href="#next-input-character"><i
  1.2021 +        title="next input character">next 2 input characters</i></a> are
  1.2022 +        U+002E FULL STOP (.) followed by a <a href="#digit"><i>digit</i></a>,
  1.2023 +        then:
  1.2024 +        <ol>
  1.2025 +         <li>Consume them.
  1.2026 +
  1.2027 +         <li>Append them to <var>repr</var>.
  1.2028 +
  1.2029 +         <li>Set <var>type</var> to "number".
  1.2030 +
  1.2031 +         <li>While the <a href="#next-input-character"><i>next input
  1.2032 +          character</i></a> is a <a href="#digit"><i>digit</i></a>, consume
  1.2033 +          it and append it to <var>repr</var>.
  1.2034 +        </ol>
  1.2035 +
  1.2036 +       <li> If the <a href="#next-input-character"><i
  1.2037 +        title="next input character">next 2 input characters</i></a> are
  1.2038 +        U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e)
  1.2039 +        followed by a <a href="#digit"><i>digit</i></a>, then:
  1.2040 +        <ol>
  1.2041 +         <li>Consume them.
  1.2042 +
  1.2043 +         <li>Append them to <var>repr</var>.
  1.2044 +
  1.2045 +         <li>Set <var>type</var> to "number".
  1.2046 +
  1.2047 +         <li>While the <a href="#next-input-character"><i>next input
  1.2048 +          character</i></a> is a <a href="#digit"><i>digit</i></a>, consume
  1.2049 +          it and append it to <var>repr</var>.
  1.2050 +        </ol>
  1.2051 +
  1.2052 +       <li> <a href="#convert-a-string-to-a-number0"><i
  1.2053 +        title="convert a string to a number">Convert <var>repr</var> to a
  1.2054 +        number</i></a>, and set the <var>value</var> to the returned value.
  1.2055 +
  1.2056 +       <li> Return a 3-tuple of <var>repr</var>, <var>value</var>, and
  1.2057 +        <var>type</var>.
  1.2058 +      </ol>
  1.2059 +
  1.2060 +      <h4 id=convert-a-string-to-a-number><span class=secno>4.3.12. </span>
  1.2061 +       <dfn id=convert-a-string-to-a-number0>Convert a string to a
  1.2062 +       number</dfn></h4>
  1.2063 +
  1.2064 +      <p> This section describes how to <a
  1.2065 +       href="#convert-a-string-to-a-number0"><i>convert a string to a
  1.2066 +       number</i></a>. It returns a number.
  1.2067 +
  1.2068 +      <p class=note> This algorithm does not do any verification to ensure
  1.2069 +       that the string contains only a number. Ensure that the string
  1.2070 +       contains only a valid CSS number before calling this algorithm.
  1.2071 +
  1.2072 +      <p> Divide the string into seven components, in order from left to
  1.2073 +       right:
  1.2074 +
  1.2075 +      <ol>
  1.2076 +       <li>A <b>sign</b>: a single U+002B PLUS SIGN (+) or U+002D
  1.2077 +        HYPHEN-MINUS (-), or the empty string. Let <var>s</var> be the number
  1.2078 +        -1 if the sign is U+002D HYPHEN-MINUS (-); otherwise, let
  1.2079 +        <var>s</var> be the number 1.
  1.2080 +
  1.2081 +       <li>An <b>integer part</b>: zero or more <a
  1.2082 +        href="#digit"><i>digits</i></a>. If there is at least one digit, let
  1.2083 +        <var>i</var> be the number formed by interpreting the digits as a
  1.2084 +        base-10 integer; otherwise, let <var>i</var> be the number 0.
  1.2085 +
  1.2086 +       <li>A <b>decimal point</b>: a single U+002E FULL STOP (.), or the
  1.2087 +        empty string.
  1.2088 +
  1.2089 +       <li>A <b>fractional part</b>: zero or more <a
  1.2090 +        href="#digit"><i>digits</i></a>. If there is at least one digit, let
  1.2091 +        <var>f</var> be the number formed by interpreting the digits as a
  1.2092 +        base-10 integer and <var>d</var> be the number of digits; otherwise,
  1.2093 +        let <var>f</var> and <var>d</var> be the number 0.
  1.2094 +
  1.2095 +       <li>An <b>exponent indicator</b>: a single U+0045 LATIN CAPITAL LETTER
  1.2096 +        E (E) or U+0065 LATIN SMALL LETTER E (e), or the empty string.
  1.2097 +
  1.2098 +       <li>An <b>exponent sign</b>: a single U+002B PLUS SIGN (+) or U+002D
  1.2099 +        HYPHEN-MINUS (-), or the empty string. Let <var>t</var> be the number
  1.2100 +        -1 if the sign is U+002D HYPHEN-MINUS (-); otherwise, let
  1.2101 +        <var>t</var> be the number 1.
  1.2102 +
  1.2103 +       <li>An <b>exponent</b>: zero or more <a
  1.2104 +        href="#digit"><i>digits</i></a>. If there is at least one digit, let
  1.2105 +        <var>i</var> be the number formed by interpreting the digits as a
  1.2106 +        base-10 integer; otherwise, let <var>i</var> be the number 0.
  1.2107 +      </ol>
  1.2108 +
  1.2109 +      <p> Return the number <code>s × (i + f·10<sup>-d</sup>) ×
  1.2110 +       10<sup>te</sup></code>.
  1.2111 +
  1.2112 +      <h4 id=consume-the-remnants-of-a-bad-url><span class=secno>4.3.13.
  1.2113 +       </span> <dfn id=consume-the-remnants-of-a-bad-url0>Consume the
  1.2114 +       remnants of a bad url</dfn></h4>
  1.2115 +
  1.2116 +      <p> This section describes how to <a
  1.2117 +       href="#consume-the-remnants-of-a-bad-url0"><i>consume the remnants of
  1.2118 +       a bad url</i></a> from a stream of characters, "cleaning up" after the
  1.2119 +       tokenizer realizes that it's in the middle of a 〈bad-url〉 rather
  1.2120 +       than a 〈url〉. It returns nothing; its sole use is to consume
  1.2121 +       enough of the input stream to reach a recovery point where normal
  1.2122 +       tokenizing can resume.
  1.2123 +
  1.2124 +      <p> Repeatedly consume the <a href="#next-input-character"><i>next
  1.2125 +       input character</i></a> from the stream:
  1.2126 +
  1.2127 +      <dl>
  1.2128 +       <dt>U+0029 RIGHT PARENTHESIS ())
  1.2129 +
  1.2130 +       <dt>EOF
  1.2131 +
  1.2132 +       <dd> Return.
  1.2133 +
  1.2134 +       <dt>the input stream <a
  1.2135 +        href="#check-if-two-characters-are-a-valid-esca0"><i>starts with a
  1.2136 +        valid escape</i></a>
  1.2137 +
  1.2138 +       <dd> <a href="#consume-an-escaped-character0"><i>Consume an escaped
  1.2139 +        character</i></a>.
  1.2140 +
  1.2141 +       <dt>anything else
  1.2142 +
  1.2143 +       <dd> Do nothing.
  1.2144 +      </dl>
  1.2145 +
  1.2146 +      <h4 id=set-the-unicode-ranges-range><span class=secno>4.3.14. </span>
  1.2147 +       <dfn id=set-the-unicode-ranges-range0>Set the 〈unicode-range〉’s
  1.2148 +       range</dfn></h4>
  1.2149 +
  1.2150 +      <p> This section describes how to set a 〈unicode-range〉’s range
  1.2151 +       so that the range it describes is within the supported range of
  1.2152 +       unicode characters.
  1.2153 +
  1.2154 +      <p> It assumes that the <dfn id=start-of-the-range>start of the
  1.2155 +       range</dfn> has been defined, the <dfn id=end-of-the-range>end of the
  1.2156 +       range</dfn> might be defined, and both are non-negative integers.
  1.2157 +
  1.2158 +      <p> If the <a href="#start-of-the-range"><i>start of the range</i></a>
  1.2159 +       is greater than the <a href="#maximum-allowed-codepoint"><i>maximum
  1.2160 +       allowed codepoint</i></a>, the 〈unicode-range〉’s range is empty.
  1.2161 +
  1.2162 +      <p> If the <a href="#end-of-the-range"><i>end of the range</i></a> is
  1.2163 +       defined, and it is less than the <a
  1.2164 +       href="#start-of-the-range"><i>start of the range</i></a>, the
  1.2165 +       〈unicode-range〉’s range is empty.
  1.2166 +
  1.2167 +      <p> If the <a href="#end-of-the-range"><i>end of the range</i></a> is
  1.2168 +       not defined, the 〈unicode-range〉’s range is the single character
  1.2169 +       whose codepoint is the <a href="#start-of-the-range"><i>start of the
  1.2170 +       range</i></a>.
  1.2171 +
  1.2172 +      <p> Otherwise, if the <a href="#end-of-the-range"><i>end of the
  1.2173 +       range</i></a> is greater than the <a
  1.2174 +       href="#maximum-allowed-codepoint"><i>maximum allowed
  1.2175 +       codepoint</i></a>, change it to the <a
  1.2176 +       href="#maximum-allowed-codepoint"><i>maximum allowed
  1.2177 +       codepoint</i></a>. The 〈unicode-range〉’s range is all characters
  1.2178 +       between the character whose codepoint is the <a
  1.2179 +       href="#start-of-the-range"><i>start of the range</i></a> and the
  1.2180 +       character whose codepoint is the <a href="#end-of-the-range"><i>end of
  1.2181 +       the range</i></a>.
  1.2182 +
  1.2183 +      <h3 id=changes-from-css-2.1-tokenizer><span class=secno>4.4. </span>
  1.2184 +       Changes from CSS 2.1 Tokenizer</h3>
  1.2185 +
  1.2186 +      <p> <em>This section is non-normative.</em>
  1.2187 +
  1.2188 +      <p class=note> Note that the point of this spec is to match reality;
  1.2189 +       changes from CSS2.1’s tokenizer are nearly always because the
  1.2190 +       tokenizer specified something that doesn't match actual browser
  1.2191 +       behavior, or left something unspecified. If some detail doesn't match
  1.2192 +       browsers, please let me know as it's almost certainly unintentional.
  1.2193 +
  1.2194 +      <ol>
  1.2195 +       <li> The 〈prefix-match〉, 〈suffix-match〉, and
  1.2196 +        〈substring-match〉 tokens have been imported from Selectors 3.
  1.2197 +
  1.2198 +       <li> The BAD-URI token (now 〈bad-url〉) is "self-contained". In
  1.2199 +        other words, once the tokenizer realizes it's in a 〈bad-url〉
  1.2200 +        rather than a 〈url〉, it just seeks forward to look for the
  1.2201 +        closing ), ignoring everything else. This behavior is simpler than
  1.2202 +        treating it like a 〈function〉 and paying attention to opened
  1.2203 +        blocks and such. Only WebKit exhibits this behavior, but it doesn't
  1.2204 +        appear that we've gotten any compat bugs from it.
  1.2205 +
  1.2206 +       <li> The 〈comma〉 has been added.
  1.2207 +
  1.2208 +       <li> The 〈number〉, 〈number〉, and 〈dimension〉 tokens have
  1.2209 +        been changed to include the preceding +/- sign as part of their value
  1.2210 +        (rather than as a separate 〈delim〉 that needs to be manually
  1.2211 +        handled every time the token is mentioned in other specs). The only
  1.2212 +        consequence of this is that comments can no longer be inserted
  1.2213 +        between the sign and the number.
  1.2214 +
  1.2215 +       <li> Scientific notation is supported for
  1.2216 +        numbers/percentages/dimensions to match SVG, per WG resolution.
  1.2217 +
  1.2218 +       <li> 〈column〉 has been added, to keep Selectors parsing in
  1.2219 +        single-token lookahead.
  1.2220 +      </ol>
  1.2221 +      <!--
  1.2222  PPPPPPPPPPPPPPPPP        AAA               RRRRRRRRRRRRRRRRR      SSSSSSSSSSSSSSS EEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRR
  1.2223  P::::::::::::::::P      A:::A              R::::::::::::::::R   SS:::::::::::::::SE::::::::::::::::::::ER::::::::::::::::R
  1.2224  P::::::PPPPPP:::::P    A:::::A             R::::::RRRRRR:::::R S:::::SSSSSS::::::SE::::::::::::::::::::ER::::::RRRRRR:::::R
  1.2225 @@ -2744,1088 +2396,1127 @@
  1.2226  PPPPPPPPPPAAAAAAA                   AAAAAAARRRRRRRR     RRRRRRR SSSSSSSSSSSSSSS   EEEEEEEEEEEEEEEEEEEEEERRRRRRRR     RRRRRRR
  1.2227  -->
  1.2228  
  1.2229 -  <h2 id=parsing><span class=secno>5. </span> Parsing</h2>
  1.2230 -
  1.2231 -  <p> The input to the parsing stage is a stream or list of tokens from the
  1.2232 -   tokenization stage. The output depends on how the parser is invoked, as
  1.2233 -   defined by the entry points listed later in this section. The parser
  1.2234 -   output can consist of at-rules, qualified rules, and/or declarations.
  1.2235 -
  1.2236 -  <p> The parser's output is constructed according to the fundamental syntax
  1.2237 -   of CSS, without regards for the validity of any specific item.
  1.2238 -   Implementations may check the validity of items as they are returned by
  1.2239 -   the various parser algorithms and treat the algorithm as returning nothing
  1.2240 -   if the item was invalid according to the implementation's own grammar
  1.2241 -   knowledge, or may construct a full tree as specified and "clean up"
  1.2242 -   afterwards by removing any invalid items.
  1.2243 -
  1.2244 -  <p> The items that can appear in the tree are:
  1.2245 -
  1.2246 -  <dl>
  1.2247 -   <dt><dfn id=at-rule>at-rule</dfn>
  1.2248 -
  1.2249 -   <dd> An at-rule has a name, a prelude consisting of a list of component
  1.2250 -    values, and an optional block consisting of a simple {} block.
  1.2251 -    <p class=note> This specification places no limits on what an at-rule's
  1.2252 -     block may contain. Individual at-rules must define whether they accept a
  1.2253 -     block, and if so, how to parse it (preferably using one of the parser
  1.2254 -     algorithms or entry points defined in this specification).
  1.2255 -
  1.2256 -   <dt><dfn id=qualified-rule0>qualified rule</dfn>
  1.2257 -
  1.2258 -   <dd> A qualified rule has a prelude consisting of a list of component
  1.2259 -    values, and a value consisting of a list of at-rules or declarations.
  1.2260 -    <p class=note> Most qualified rules will be style rules, where the
  1.2261 -     prelude is a selector.
  1.2262 -
  1.2263 -   <dt><dfn id=declaration>declaration</dfn>
  1.2264 -
  1.2265 -   <dd> A declaration has a name, a value consisting of a list of component
  1.2266 -    values, and an <var>important</var> flag which is initially unset.
  1.2267 -    <p class=issue> Should we go ahead and generalize the important flag to
  1.2268 -     be a list of bang values? Suggested by Zack Weinburg.
  1.2269 -
  1.2270 -    <p> Declarations are further categorized as "properties" or
  1.2271 -     "descriptors", with the former typically appearing in <a
  1.2272 -     href="#qualified-rule0"><i>qualified rules</i></a> and the latter
  1.2273 -     appearing in <a href="#at-rule"><i>at-rules</i></a>. (This
  1.2274 -     categorization does not occur at the Syntax level; instead, it is a
  1.2275 -     product of where the declaration appears, and is defined by the
  1.2276 -     respective specifications defining the given rule.)
  1.2277 -
  1.2278 -   <dt><dfn id=component-value>component value</dfn>
  1.2279 -
  1.2280 -   <dd> A component value is one of the preserved tokens, a function, or a
  1.2281 -    simple block.
  1.2282 -
  1.2283 -   <dt><dfn id=preserved-tokens>preserved tokens</dfn>
  1.2284 -
  1.2285 -   <dd> Any token produced by the tokenizer except for 〈function〉s,
  1.2286 -    〈{〉s, 〈(〉s, and 〈[〉s.
  1.2287 -    <p class=note> The non-preserved tokens listed above are always consumed
  1.2288 -     into higher-level objects, either functions or simple blocks, and so
  1.2289 -     never appear in any parser output themselves.
  1.2290 -
  1.2291 -    <p class=note> The tokens 〈}〉s, 〈)〉s, 〈]〉, 〈bad-string〉,
  1.2292 -     and 〈bad-url〉 are always parse errors, but they are preserved in the
  1.2293 -     token stream by this specification to allow other specs, such as Media
  1.2294 -     Queries, to define more fine-grainted error-handling than just dropping
  1.2295 -     an entire declaration or block.
  1.2296 -
  1.2297 -   <dt><dfn id=function>function</dfn>
  1.2298 -
  1.2299 -   <dd> A function has a name and a value consisting of a list of component
  1.2300 -    values.
  1.2301 -
  1.2302 -   <dt><dfn id=simple-block>simple block</dfn>
  1.2303 -
  1.2304 -   <dd> A simple block has an associated token (either a 〈[〉, 〈(〉, or
  1.2305 -    〈{〉) and a value consisting of a list of component values.
  1.2306 -  </dl>
  1.2307 -
  1.2308 -  <h3 id=parser-diagrams><span class=secno>5.1. </span> Parser Railroad
  1.2309 -   Diagrams</h3>
  1.2310 -
  1.2311 -  <p> <em>This section is non-normative.</em>
  1.2312 -
  1.2313 -  <p> This section presents an informative view of the parser, in the form of
  1.2314 -   railroad diagrams. Railroad diagrams are more compact than a
  1.2315 -   state-machine, but often easier to read than a regular expression.
  1.2316 -
  1.2317 -  <p> These diagrams are <em>informative</em> and <em>incomplete</em>; they
  1.2318 -   describe the grammar of "correct" stylesheets, but do not describe
  1.2319 -   error-handling at all. They are provided solely to make it easier to get
  1.2320 -   an intuitive grasp of the syntax. <!--
  1.2321 +      <h2 id=parsing><span class=secno>5. </span> Parsing</h2>
  1.2322 +
  1.2323 +      <p> The input to the parsing stage is a stream or list of tokens from
  1.2324 +       the tokenization stage. The output depends on how the parser is
  1.2325 +       invoked, as defined by the entry points listed later in this section.
  1.2326 +       The parser output can consist of at-rules, qualified rules, and/or
  1.2327 +       declarations.
  1.2328 +
  1.2329 +      <p> The parser's output is constructed according to the fundamental
  1.2330 +       syntax of CSS, without regards for the validity of any specific item.
  1.2331 +       Implementations may check the validity of items as they are returned
  1.2332 +       by the various parser algorithms and treat the algorithm as returning
  1.2333 +       nothing if the item was invalid according to the implementation's own
  1.2334 +       grammar knowledge, or may construct a full tree as specified and
  1.2335 +       "clean up" afterwards by removing any invalid items.
  1.2336 +
  1.2337 +      <p> The items that can appear in the tree are:
  1.2338 +
  1.2339 +      <dl>
  1.2340 +       <dt><dfn id=at-rule>at-rule</dfn>
  1.2341 +
  1.2342 +       <dd> An at-rule has a name, a prelude consisting of a list of
  1.2343 +        component values, and an optional block consisting of a simple {}
  1.2344 +        block.
  1.2345 +        <p class=note> This specification places no limits on what an
  1.2346 +         at-rule's block may contain. Individual at-rules must define whether
  1.2347 +         they accept a block, and if so, how to parse it (preferably using
  1.2348 +         one of the parser algorithms or entry points defined in this
  1.2349 +         specification).
  1.2350 +
  1.2351 +       <dt><dfn id=qualified-rule0>qualified rule</dfn>
  1.2352 +
  1.2353 +       <dd> A qualified rule has a prelude consisting of a list of component
  1.2354 +        values, and a value consisting of a list of at-rules or declarations.
  1.2355 +
  1.2356 +        <p class=note> Most qualified rules will be style rules, where the
  1.2357 +         prelude is a selector.
  1.2358 +
  1.2359 +       <dt><dfn id=declaration>declaration</dfn>
  1.2360 +
  1.2361 +       <dd> A declaration has a name, a value consisting of a list of
  1.2362 +        component values, and an <var>important</var> flag which is initially
  1.2363 +        unset.
  1.2364 +        <p class=issue> Should we go ahead and generalize the important flag
  1.2365 +         to be a list of bang values? Suggested by Zack Weinburg.
  1.2366 +
  1.2367 +        <p> Declarations are further categorized as "properties" or
  1.2368 +         "descriptors", with the former typically appearing in <a
  1.2369 +         href="#qualified-rule0"><i>qualified rules</i></a> and the latter
  1.2370 +         appearing in <a href="#at-rule"><i>at-rules</i></a>. (This
  1.2371 +         categorization does not occur at the Syntax level; instead, it is a
  1.2372 +         product of where the declaration appears, and is defined by the
  1.2373 +         respective specifications defining the given rule.)
  1.2374 +
  1.2375 +       <dt><dfn id=component-value>component value</dfn>
  1.2376 +
  1.2377 +       <dd> A component value is one of the preserved tokens, a function, or
  1.2378 +        a simple block.
  1.2379 +
  1.2380 +       <dt><dfn id=preserved-tokens>preserved tokens</dfn>
  1.2381 +
  1.2382 +       <dd> Any token produced by the tokenizer except for 〈function〉s,
  1.2383 +        〈{〉s, 〈(〉s, and 〈[〉s.
  1.2384 +        <p class=note> The non-preserved tokens listed above are always
  1.2385 +         consumed into higher-level objects, either functions or simple
  1.2386 +         blocks, and so never appear in any parser output themselves.
  1.2387 +
  1.2388 +        <p class=note> The tokens 〈}〉s, 〈)〉s, 〈]〉,
  1.2389 +         〈bad-string〉, and 〈bad-url〉 are always parse errors, but
  1.2390 +         they are preserved in the token stream by this specification to
  1.2391 +         allow other specs, such as Media Queries, to define more
  1.2392 +         fine-grainted error-handling than just dropping an entire
  1.2393 +         declaration or block.
  1.2394 +
  1.2395 +       <dt><dfn id=function>function</dfn>
  1.2396 +
  1.2397 +       <dd> A function has a name and a value consisting of a list of
  1.2398 +        component values.
  1.2399 +
  1.2400 +       <dt><dfn id=simple-block>simple block</dfn>
  1.2401 +
  1.2402 +       <dd> A simple block has an associated token (either a 〈[〉,
  1.2403 +        〈(〉, or 〈{〉) and a value consisting of a list of component
  1.2404 +        values.
  1.2405 +      </dl>
  1.2406 +
  1.2407 +      <h3 id=parser-diagrams><span class=secno>5.1. </span> Parser Railroad
  1.2408 +       Diagrams</h3>
  1.2409 +
  1.2410 +      <p> <em>This section is non-normative.</em>
  1.2411 +
  1.2412 +      <p> This section presents an informative view of the parser, in the
  1.2413 +       form of railroad diagrams. Railroad diagrams are more compact than a
  1.2414 +       state-machine, but often easier to read than a regular expression.
  1.2415 +
  1.2416 +      <p> These diagrams are <em>informative</em> and <em>incomplete</em>;
  1.2417 +       they describe the grammar of "correct" stylesheets, but do not
  1.2418 +       describe error-handling at all. They are provided solely to make it
  1.2419 +       easier to get an intuitive grasp of the syntax. <!--
  1.2420  		The "source" of these diagrams is in ./Diagrams.src.html
  1.2421  		The generated SVG is copied here so that JavaScript is not required
  1.2422  		to view the spec.
  1.2423  	-->
  1.2424  
  1.2425 -  <dl>
  1.2426 -   <dt id=stylesheet-diagram>Stylesheet
  1.2427 -
  1.2428 -   <dd><svg class=railroad-diagram height=200 width=313><g
  1.2429 -    transform="translate(.5 .5)"><path
  1.2430 -    d="M 20 121 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.2431 -    d="M40 131h0"></path><path d="M272 131h0"></path><path
  1.2432 -    d="M40 131a10 10 0 0 0 10 -10v-89a10 10 0 0 1 10 -10"></path><g><path
  1.2433 -    d="M60 22h192"></path></g><path
  1.2434 -    d="M252 22a10 10 0 0 1 10 10v89a10 10 0 0 0 10 10"></path><path
  1.2435 -    d="M40 131h20"></path><g><path d="M60 131h0"></path><path
  1.2436 -    d="M252 131h0"></path><path d="M60 131h10"></path><g><path
  1.2437 -    d="M70 131h0"></path><path d="M242 131h0"></path><path
  1.2438 -    d="M70 131a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><g><path
  1.2439 -    d="M90 101h8"></path><path d="M214 101h8"></path><rect height=22
  1.2440 -    width=116 x=98 y=90></rect><text x=156
  1.2441 -    y=105>〈whitespace〉</text></g><path
  1.2442 -    d="M222 101a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><path
  1.2443 -    d="M70 131a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path><g><path
  1.2444 -    d="M90 71h36"></path><path d="M186 71h36"></path><rect height=22 width=60
  1.2445 -    x=126 y=60></rect><text x=156 y=75>〈CDC〉</text></g><path
  1.2446 -    d="M222 71a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path><path
  1.2447 -    d="M70 131a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path><g><path
  1.2448 -    d="M90 41h36"></path><path d="M186 41h36"></path><rect height=22 width=60
  1.2449 -    x=126 y=30></rect><text x=156 y=45>〈CDO〉</text></g><path
  1.2450 -    d="M222 41a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path><path
  1.2451 -    d="M70 131h20"></path><g><path d="M90 131h0"></path><path
  1.2452 -    d="M222 131h0"></path><rect height=22 width=132 x=90 y=120></rect><text
  1.2453 -    x=156 y=135>Qualified rule</text></g><path d="M222 131h20"></path><path
  1.2454 -    d="M70 131a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.2455 -    d="M90 161h28"></path><path d="M194 161h28"></path><rect height=22
  1.2456 -    width=76 x=118 y=150></rect><text x=156 y=165>At-rule</text></g><path
  1.2457 -    d="M222 161a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.2458 -    d="M242 131h10"></path><path
  1.2459 -    d="M70 131a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path
  1.2460 -    d="M70 180h172"></path></g><path
  1.2461 -    d="M242 180a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path
  1.2462 -    d="M252 131h20"></path></g><path
  1.2463 -    d="M 272 131 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2464 -
  1.2465 -   <dt id=rule-list-diagram>Rule list
  1.2466 -
  1.2467 -   <dd><svg class=railroad-diagram height=140 width=313><g
  1.2468 -    transform="translate(.5 .5)"><path
  1.2469 -    d="M 20 61 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.2470 -    d="M40 71h0"></path><path d="M272 71h0"></path><path
  1.2471 -    d="M40 71a10 10 0 0 0 10 -10v-29a10 10 0 0 1 10 -10"></path><g><path
  1.2472 -    d="M60 22h192"></path></g><path
  1.2473 -    d="M252 22a10 10 0 0 1 10 10v29a10 10 0 0 0 10 10"></path><path
  1.2474 -    d="M40 71h20"></path><g><path d="M60 71h0"></path><path
  1.2475 -    d="M252 71h0"></path><path d="M60 71h10"></path><g><path
  1.2476 -    d="M70 71h0"></path><path d="M242 71h0"></path><path
  1.2477 -    d="M70 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><g><path
  1.2478 -    d="M90 41h8"></path><path d="M214 41h8"></path><rect height=22 width=116
  1.2479 -    x=98 y=30></rect><text x=156 y=45>〈whitespace〉</text></g><path
  1.2480 -    d="M222 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><path
  1.2481 -    d="M70 71h20"></path><g><path d="M90 71h0"></path><path
  1.2482 -    d="M222 71h0"></path><rect height=22 width=132 x=90 y=60></rect><text
  1.2483 -    x=156 y=75>Qualified rule</text></g><path d="M222 71h20"></path><path
  1.2484 -    d="M70 71a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.2485 -    d="M90 101h28"></path><path d="M194 101h28"></path><rect height=22
  1.2486 -    width=76 x=118 y=90></rect><text x=156 y=105>At-rule</text></g><path
  1.2487 -    d="M222 101a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.2488 -    d="M242 71h10"></path><path
  1.2489 -    d="M70 71a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path
  1.2490 -    d="M70 120h172"></path></g><path
  1.2491 -    d="M242 120a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path
  1.2492 -    d="M252 71h20"></path></g><path
  1.2493 -    d="M 272 71 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2494 -
  1.2495 -   <dt id=at-rule-diagram>At-rule
  1.2496 -
  1.2497 -   <dd><svg class=railroad-diagram height=102 width=541><g
  1.2498 -    transform="translate(.5 .5)"><path
  1.2499 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2500 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2501 -    d="M166 41h0"></path><rect height=22 width=116 x=50 y=30></rect><text
  1.2502 -    x=108 y=45>〈at-keyword〉</text></g><path
  1.2503 -    d="M166 41h10"></path><g><path d="M176 41h0"></path><path
  1.2504 -    d="M376 41h0"></path><path
  1.2505 -    d="M176 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2506 -    d="M196 21h160"></path></g><path
  1.2507 -    d="M356 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2508 -    d="M176 41h20"></path><g><path d="M196 41h0"></path><path
  1.2509 -    d="M356 41h0"></path><path d="M196 41h10"></path><g><path
  1.2510 -    d="M206 41h0"></path><path d="M346 41h0"></path><rect height=22 width=140
  1.2511 -    x=206 y=30></rect><text x=276 y=45>Component value</text></g><path
  1.2512 -    d="M346 41h10"></path><path
  1.2513 -    d="M206 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2514 -    d="M206 61h140"></path></g><path
  1.2515 -    d="M346 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2516 -    d="M356 41h20"></path></g><g><path d="M376 41h0"></path><path
  1.2517 -    d="M500 41h0"></path><path d="M376 41h20"></path><g><path
  1.2518 -    d="M396 41h0"></path><path d="M480 41h0"></path><rect height=22 width=84
  1.2519 -    x=396 y=30></rect><text x=438 y=45>{} block</text></g><path
  1.2520 -    d="M480 41h20"></path><path
  1.2521 -    d="M376 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.2522 -    d="M396 71h28"></path><path d="M452 71h28"></path><rect height=22 rx=10
  1.2523 -    ry=10 width=28 x=424 y=60></rect><text x=438 y=75>;</text></g><path
  1.2524 -    d="M480 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.2525 -    d="M 500 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2526 -
  1.2527 -   <dt id=qualified-rule-diagram>Qualified rule
  1.2528 -
  1.2529 -   <dd><svg class=railroad-diagram height=81 width=545><g
  1.2530 -    transform="translate(.5 .5)"><path
  1.2531 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.2532 -    d="M40 41h0"></path><path d="M240 41h0"></path><path
  1.2533 -    d="M40 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2534 -    d="M60 21h160"></path></g><path
  1.2535 -    d="M220 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2536 -    d="M40 41h20"></path><g><path d="M60 41h0"></path><path
  1.2537 -    d="M220 41h0"></path><path d="M60 41h10"></path><g><path
  1.2538 -    d="M70 41h0"></path><path d="M210 41h0"></path><rect height=22 width=140
  1.2539 -    x=70 y=30></rect><text x=140 y=45>Component value</text></g><path
  1.2540 -    d="M210 41h10"></path><path
  1.2541 -    d="M70 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2542 -    d="M70 61h140"></path></g><path
  1.2543 -    d="M210 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2544 -    d="M220 41h20"></path></g><path d="M240 41h10"></path><g><path
  1.2545 -    d="M250 41h0"></path><path d="M278 41h0"></path><rect height=22 rx=10
  1.2546 -    ry=10 width=28 x=250 y=30></rect><text x=264 y=45>{</text></g><path
  1.2547 -    d="M278 41h10"></path><path d="M288 41h10"></path><g><path
  1.2548 -    d="M298 41h0"></path><path d="M446 41h0"></path><rect height=22 width=148
  1.2549 -    x=298 y=30></rect><text x=372 y=45>Declaration list</text></g><path
  1.2550 -    d="M446 41h10"></path><path d="M456 41h10"></path><g><path
  1.2551 -    d="M466 41h0"></path><path d="M494 41h0"></path><rect height=22 rx=10
  1.2552 -    ry=10 width=28 x=466 y=30></rect><text x=480 y=45>}</text></g><path
  1.2553 -    d="M494 41h10"></path><path
  1.2554 -    d="M 504 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2555 -
  1.2556 -   <dt id=declaration-list-diagram>Declaration list
  1.2557 -
  1.2558 -   <dd><svg class=railroad-diagram height=102 width=589><g
  1.2559 -    transform="translate(.5 .5)"><path
  1.2560 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2561 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2562 -    d="M94 41h0"></path><rect height=22 width=44 x=50 y=30></rect><text x=72
  1.2563 -    y=45>ws*</text></g><path d="M94 41h10"></path><g><path
  1.2564 -    d="M104 41h0"></path><path d="M548 41h0"></path><path
  1.2565 -    d="M104 41h20"></path><g><path d="M124 41h0"></path><path
  1.2566 -    d="M528 41h0"></path><g><path d="M124 41h0"></path><path
  1.2567 -    d="M272 41h0"></path><path
  1.2568 -    d="M124 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2569 -    d="M144 21h108"></path></g><path
  1.2570 -    d="M252 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2571 -    d="M124 41h20"></path><g><path d="M144 41h0"></path><path
  1.2572 -    d="M252 41h0"></path><rect height=22 width=108 x=144 y=30></rect><text
  1.2573 -    x=198 y=45>Declaration</text></g><path d="M252 41h20"></path></g><g><path
  1.2574 -    d="M272 41h0"></path><path d="M528 41h0"></path><path
  1.2575 -    d="M272 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2576 -    d="M292 21h216"></path></g><path
  1.2577 -    d="M508 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2578 -    d="M272 41h20"></path><g><path d="M292 41h0"></path><path
  1.2579 -    d="M508 41h0"></path><path d="M292 41h10"></path><g><path
  1.2580 -    d="M302 41h0"></path><path d="M330 41h0"></path><rect height=22 rx=10
  1.2581 -    ry=10 width=28 x=302 y=30></rect><text x=316 y=45>;</text></g><path
  1.2582 -    d="M330 41h10"></path><path d="M340 41h10"></path><g><path
  1.2583 -    d="M350 41h0"></path><path d="M498 41h0"></path><rect height=22 width=148
  1.2584 -    x=350 y=30></rect><text x=424 y=45>Declaration list</text></g><path
  1.2585 -    d="M498 41h10"></path></g><path d="M508 41h20"></path></g></g><path
  1.2586 -    d="M528 41h20"></path><path
  1.2587 -    d="M104 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.2588 -    d="M124 71h70"></path><path d="M458 71h70"></path><path
  1.2589 -    d="M194 71h10"></path><g><path d="M204 71h0"></path><path
  1.2590 -    d="M280 71h0"></path><rect height=22 width=76 x=204 y=60></rect><text
  1.2591 -    x=242 y=75>At-rule</text></g><path d="M280 71h10"></path><path
  1.2592 -    d="M290 71h10"></path><g><path d="M300 71h0"></path><path
  1.2593 -    d="M448 71h0"></path><rect height=22 width=148 x=300 y=60></rect><text
  1.2594 -    x=374 y=75>Declaration list</text></g><path
  1.2595 -    d="M448 71h10"></path></g><path
  1.2596 -    d="M528 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.2597 -    d="M 548 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2598 -
  1.2599 -   <dt id=declaration-diagram>Declaration
  1.2600 -
  1.2601 -   <dd><svg class=railroad-diagram height=81 width=629><g
  1.2602 -    transform="translate(.5 .5)"><path
  1.2603 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2604 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2605 -    d="M126 41h0"></path><rect height=22 width=76 x=50 y=30></rect><text x=88
  1.2606 -    y=45>〈ident〉</text></g><path d="M126 41h10"></path><path
  1.2607 -    d="M136 41h10"></path><g><path d="M146 41h0"></path><path
  1.2608 -    d="M190 41h0"></path><rect height=22 width=44 x=146 y=30></rect><text
  1.2609 -    x=168 y=45>ws*</text></g><path d="M190 41h10"></path><path
  1.2610 -    d="M200 41h10"></path><g><path d="M210 41h0"></path><path
  1.2611 -    d="M238 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=210
  1.2612 -    y=30></rect><text x=224 y=45>:</text></g><path
  1.2613 -    d="M238 41h10"></path><g><path d="M248 41h0"></path><path
  1.2614 -    d="M448 41h0"></path><path
  1.2615 -    d="M248 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2616 -    d="M268 21h160"></path></g><path
  1.2617 -    d="M428 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2618 -    d="M248 41h20"></path><g><path d="M268 41h0"></path><path
  1.2619 -    d="M428 41h0"></path><path d="M268 41h10"></path><g><path
  1.2620 -    d="M278 41h0"></path><path d="M418 41h0"></path><rect height=22 width=140
  1.2621 -    x=278 y=30></rect><text x=348 y=45>Component value</text></g><path
  1.2622 -    d="M418 41h10"></path><path
  1.2623 -    d="M278 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2624 -    d="M278 61h140"></path></g><path
  1.2625 -    d="M418 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2626 -    d="M428 41h20"></path></g><g><path d="M448 41h0"></path><path
  1.2627 -    d="M588 41h0"></path><path
  1.2628 -    d="M448 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2629 -    d="M468 21h100"></path></g><path
  1.2630 -    d="M568 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2631 -    d="M448 41h20"></path><g><path d="M468 41h0"></path><path
  1.2632 -    d="M568 41h0"></path><rect height=22 width=100 x=468 y=30></rect><text
  1.2633 -    x=518 y=45>!important</text></g><path d="M568 41h20"></path></g><path
  1.2634 -    d="M 588 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2635 -
  1.2636 -   <dt id=important-diagram>!important
  1.2637 -
  1.2638 -   <dd><svg class=railroad-diagram height=62 width=449><g
  1.2639 -    transform="translate(.5 .5)"><path
  1.2640 -    d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2641 -    d="M40 31h10"></path><g><path d="M50 31h0"></path><path
  1.2642 -    d="M78 31h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.2643 -    y=20></rect><text x=64 y=35>!</text></g><path d="M78 31h10"></path><path
  1.2644 -    d="M88 31h10"></path><g><path d="M98 31h0"></path><path
  1.2645 -    d="M142 31h0"></path><rect height=22 width=44 x=98 y=20></rect><text
  1.2646 -    x=120 y=35>ws*</text></g><path d="M142 31h10"></path><path
  1.2647 -    d="M152 31h10"></path><g><path d="M162 31h0"></path><path
  1.2648 -    d="M334 31h0"></path><rect height=22 width=172 x=162 y=20></rect><text
  1.2649 -    x=248 y=35>〈ident "important"〉</text></g><path
  1.2650 -    d="M334 31h10"></path><path d="M344 31h10"></path><g><path
  1.2651 -    d="M354 31h0"></path><path d="M398 31h0"></path><rect height=22 width=44
  1.2652 -    x=354 y=20></rect><text x=376 y=35>ws*</text></g><path
  1.2653 -    d="M398 31h10"></path><path
  1.2654 -    d="M 408 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2655 -
  1.2656 -   <dt id=ws-diagram>ws*
  1.2657 -
  1.2658 -   <dd><svg class=railroad-diagram height=81 width=257><g
  1.2659 -    transform="translate(.5 .5)"><path
  1.2660 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.2661 -    d="M40 41h0"></path><path d="M216 41h0"></path><path
  1.2662 -    d="M40 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2663 -    d="M60 21h136"></path></g><path
  1.2664 -    d="M196 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2665 -    d="M40 41h20"></path><g><path d="M60 41h0"></path><path
  1.2666 -    d="M196 41h0"></path><path d="M60 41h10"></path><g><path
  1.2667 -    d="M70 41h0"></path><path d="M186 41h0"></path><rect height=22 width=116
  1.2668 -    x=70 y=30></rect><text x=128 y=45>〈whitespace〉</text></g><path
  1.2669 -    d="M186 41h10"></path><path
  1.2670 -    d="M70 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2671 -    d="M70 61h116"></path></g><path
  1.2672 -    d="M186 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2673 -    d="M196 41h20"></path></g><path
  1.2674 -    d="M 216 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2675 -
  1.2676 -   <dt id=component-value-diagram>Component value
  1.2677 -
  1.2678 -   <dd><svg class=railroad-diagram height=182 width=261><g
  1.2679 -    transform="translate(.5 .5)"><path
  1.2680 -    d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.2681 -    d="M40 31h0"></path><path d="M220 31h0"></path><path
  1.2682 -    d="M40 31h20"></path><g><path d="M60 31h0"></path><path
  1.2683 -    d="M200 31h0"></path><rect height=22 width=140 x=60 y=20></rect><text
  1.2684 -    x=130 y=35>Preserved token</text></g><path d="M200 31h20"></path><path
  1.2685 -    d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.2686 -    d="M60 61h28"></path><path d="M172 61h28"></path><rect height=22 width=84
  1.2687 -    x=88 y=50></rect><text x=130 y=65>{} block</text></g><path
  1.2688 -    d="M200 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><path
  1.2689 -    d="M40 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path><g><path
  1.2690 -    d="M60 91h28"></path><path d="M172 91h28"></path><rect height=22 width=84
  1.2691 -    x=88 y=80></rect><text x=130 y=95>() block</text></g><path
  1.2692 -    d="M200 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path><path
  1.2693 -    d="M40 31a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path><g><path
  1.2694 -    d="M60 121h28"></path><path d="M172 121h28"></path><rect height=22
  1.2695 -    width=84 x=88 y=110></rect><text x=130 y=125>[] block</text></g><path
  1.2696 -    d="M200 121a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path><path
  1.2697 -    d="M40 31a10 10 0 0 1 10 10v100a10 10 0 0 0 10 10"></path><g><path
  1.2698 -    d="M60 151h4"></path><path d="M196 151h4"></path><rect height=22
  1.2699 -    width=132 x=64 y=140></rect><text x=130 y=155>Function
  1.2700 -    block</text></g><path
  1.2701 -    d="M200 151a10 10 0 0 0 10 -10v-100a10 10 0 0 1 10 -10"></path></g><path
  1.2702 -    d="M 220 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2703 -
  1.2704 -   <dt id="{}-block-diagram">{} block
  1.2705 -
  1.2706 -   <dd><svg class=railroad-diagram height=81 width=377><g
  1.2707 -    transform="translate(.5 .5)"><path
  1.2708 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2709 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2710 -    d="M78 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.2711 -    y=30></rect><text x=64 y=45>{</text></g><path
  1.2712 -    d="M78 41h10"></path><g><path d="M88 41h0"></path><path
  1.2713 -    d="M288 41h0"></path><path
  1.2714 -    d="M88 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2715 -    d="M108 21h160"></path></g><path
  1.2716 -    d="M268 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2717 -    d="M88 41h20"></path><g><path d="M108 41h0"></path><path
  1.2718 -    d="M268 41h0"></path><path d="M108 41h10"></path><g><path
  1.2719 -    d="M118 41h0"></path><path d="M258 41h0"></path><rect height=22 width=140
  1.2720 -    x=118 y=30></rect><text x=188 y=45>Component value</text></g><path
  1.2721 -    d="M258 41h10"></path><path
  1.2722 -    d="M118 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2723 -    d="M118 61h140"></path></g><path
  1.2724 -    d="M258 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2725 -    d="M268 41h20"></path></g><path d="M288 41h10"></path><g><path
  1.2726 -    d="M298 41h0"></path><path d="M326 41h0"></path><rect height=22 rx=10
  1.2727 -    ry=10 width=28 x=298 y=30></rect><text x=312 y=45>}</text></g><path
  1.2728 -    d="M326 41h10"></path><path
  1.2729 -    d="M 336 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2730 -
  1.2731 -   <dt id="()-block-diagram">() block
  1.2732 -
  1.2733 -   <dd><svg class=railroad-diagram height=81 width=377><g
  1.2734 -    transform="translate(.5 .5)"><path
  1.2735 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2736 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2737 -    d="M78 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.2738 -    y=30></rect><text x=64 y=45>(</text></g><path
  1.2739 -    d="M78 41h10"></path><g><path d="M88 41h0"></path><path
  1.2740 -    d="M288 41h0"></path><path
  1.2741 -    d="M88 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2742 -    d="M108 21h160"></path></g><path
  1.2743 -    d="M268 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2744 -    d="M88 41h20"></path><g><path d="M108 41h0"></path><path
  1.2745 -    d="M268 41h0"></path><path d="M108 41h10"></path><g><path
  1.2746 -    d="M118 41h0"></path><path d="M258 41h0"></path><rect height=22 width=140
  1.2747 -    x=118 y=30></rect><text x=188 y=45>Component value</text></g><path
  1.2748 -    d="M258 41h10"></path><path
  1.2749 -    d="M118 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2750 -    d="M118 61h140"></path></g><path
  1.2751 -    d="M258 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2752 -    d="M268 41h20"></path></g><path d="M288 41h10"></path><g><path
  1.2753 -    d="M298 41h0"></path><path d="M326 41h0"></path><rect height=22 rx=10
  1.2754 -    ry=10 width=28 x=298 y=30></rect><text x=312 y=45>)</text></g><path
  1.2755 -    d="M326 41h10"></path><path
  1.2756 -    d="M 336 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2757 -
  1.2758 -   <dt id="[]-block-diagram">[] block
  1.2759 -
  1.2760 -   <dd><svg class=railroad-diagram height=81 width=377><g
  1.2761 -    transform="translate(.5 .5)"><path
  1.2762 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2763 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2764 -    d="M78 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.2765 -    y=30></rect><text x=64 y=45>[</text></g><path
  1.2766 -    d="M78 41h10"></path><g><path d="M88 41h0"></path><path
  1.2767 -    d="M288 41h0"></path><path
  1.2768 -    d="M88 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2769 -    d="M108 21h160"></path></g><path
  1.2770 -    d="M268 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2771 -    d="M88 41h20"></path><g><path d="M108 41h0"></path><path
  1.2772 -    d="M268 41h0"></path><path d="M108 41h10"></path><g><path
  1.2773 -    d="M118 41h0"></path><path d="M258 41h0"></path><rect height=22 width=140
  1.2774 -    x=118 y=30></rect><text x=188 y=45>Component value</text></g><path
  1.2775 -    d="M258 41h10"></path><path
  1.2776 -    d="M118 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2777 -    d="M118 61h140"></path></g><path
  1.2778 -    d="M258 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2779 -    d="M268 41h20"></path></g><path d="M288 41h10"></path><g><path
  1.2780 -    d="M298 41h0"></path><path d="M326 41h0"></path><rect height=22 rx=10
  1.2781 -    ry=10 width=28 x=298 y=30></rect><text x=312 y=45>]</text></g><path
  1.2782 -    d="M326 41h10"></path><path
  1.2783 -    d="M 336 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2784 -
  1.2785 -   <dt id=function-block-diagram>Function block
  1.2786 -
  1.2787 -   <dd><svg class=railroad-diagram height=81 width=449><g
  1.2788 -    transform="translate(.5 .5)"><path
  1.2789 -    d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.2790 -    d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.2791 -    d="M150 41h0"></path><rect height=22 width=100 x=50 y=30></rect><text
  1.2792 -    x=100 y=45>〈function〉</text></g><path d="M150 41h10"></path><g><path
  1.2793 -    d="M160 41h0"></path><path d="M360 41h0"></path><path
  1.2794 -    d="M160 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.2795 -    d="M180 21h160"></path></g><path
  1.2796 -    d="M340 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.2797 -    d="M160 41h20"></path><g><path d="M180 41h0"></path><path
  1.2798 -    d="M340 41h0"></path><path d="M180 41h10"></path><g><path
  1.2799 -    d="M190 41h0"></path><path d="M330 41h0"></path><rect height=22 width=140
  1.2800 -    x=190 y=30></rect><text x=260 y=45>Component value</text></g><path
  1.2801 -    d="M330 41h10"></path><path
  1.2802 -    d="M190 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.2803 -    d="M190 61h140"></path></g><path
  1.2804 -    d="M330 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.2805 -    d="M340 41h20"></path></g><path d="M360 41h10"></path><g><path
  1.2806 -    d="M370 41h0"></path><path d="M398 41h0"></path><rect height=22 rx=10
  1.2807 -    ry=10 width=28 x=370 y=30></rect><text x=384 y=45>)</text></g><path
  1.2808 -    d="M398 41h10"></path><path
  1.2809 -    d="M 408 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.2810 -  </dl>
  1.2811 -
  1.2812 -  <h3 id=definitions0><span class=secno>5.2. </span> Definitions</h3>
  1.2813 -
  1.2814 -  <dl>
  1.2815 -   <dt><dfn id=current-input-token>current input token</dfn>
  1.2816 -
  1.2817 -   <dd> The token or <a href="#component-value"><i>component value</i></a>
  1.2818 -    currently being operated on, from the list of tokens produced by the
  1.2819 -    tokenizer.
  1.2820 -
  1.2821 -   <dt><dfn id=next-input-token>next input token</dfn>
  1.2822 -
  1.2823 -   <dd> The token or <a href="#component-value"><i>component value</i></a>
  1.2824 -    following the <a href="#current-input-token"><i>current input
  1.2825 -    token</i></a> in the list of tokens produced by the tokenizer. If there
  1.2826 -    isn't a token following the <a href="#current-input-token"><i>current
  1.2827 -    input token</i></a>, the <a href="#next-input-token"><i>next input
  1.2828 -    token</i></a> is an 〈EOF〉.
  1.2829 -
  1.2830 -   <dt><dfn id=eof>〈EOF〉</dfn>
  1.2831 -
  1.2832 -   <dd> A conceptual token representing the end of the list of tokens.
  1.2833 -    Whenever the list of tokens is empty, the <a
  1.2834 -    href="#next-input-token"><i>next input token</i></a> is always an
  1.2835 -    〈EOF〉.
  1.2836 -
  1.2837 -   <dt><dfn id=reconsume-the-current-input-token>reconsume the current input
  1.2838 -    token</dfn>
  1.2839 -
  1.2840 -   <dd> Push the <a href="#current-input-token"><i>current input
  1.2841 -    token</i></a> back onto the list of tokens produced by the tokenizer, so
  1.2842 -    that the next time a mode instructs you to consume the next input token,
  1.2843 -    it will instead reconsume the <a href="#current-input-token"><i>current
  1.2844 -    input token</i></a>.
  1.2845 -
  1.2846 -   <dt><dfn id=ascii-case-insensitive>ASCII case-insensitive</dfn>
  1.2847 -
  1.2848 -   <dd> When two strings are to be matched ASCII case-insensitively,
  1.2849 -    temporarily convert both of them to ASCII lower-case form by adding 32
  1.2850 -    (0x20) to the value of each codepoint between U+0041 LATIN CAPITAL LETTER
  1.2851 -    A (A) and U+005A LATIN CAPITAL LETTER Z (Z), inclusive, and then compare
  1.2852 -    them on a codepoint-by-codepoint basis.
  1.2853 -  </dl>
  1.2854 -
  1.2855 -  <h3 id=parser-entry-points><span class=secno>5.3. </span> Parser Entry
  1.2856 -   Points</h3>
  1.2857 -
  1.2858 -  <p> The algorithms defined in this specification can be invoked in multiple
  1.2859 -   ways to convert a stream of text into various CSS concepts.
  1.2860 -
  1.2861 -  <p> All of the algorithms defined in this section begin in the parser. It
  1.2862 -   is assumed that the <a href="#preprocessing-the-input-stream">input
  1.2863 -   preprocessing</a> and <a href="#tokenization">tokenization</a> steps have
  1.2864 -   already been completed, resulting in a stream of tokens.
  1.2865 -
  1.2866 -  <p class=note> Other specs can define additional entry points for their own
  1.2867 -   purposes.
  1.2868 -
  1.2869 -  <div class=issue>
  1.2870 -   <p> The following notes should probably be translated into normative text
  1.2871 -    in the relevant specs, hooking this spec's terms:
  1.2872 -
  1.2873 -   <ul>
  1.2874 -    <li> "<a href="#parse-a-stylesheet0"><i>Parse a stylesheet</i></a>" is
  1.2875 -     intended to be the normal parser entry point, for parsing stylesheets.
  1.2876 -
  1.2877 -    <li> "<a href="#parse-a-rule0"><i>Parse a rule</i></a>" is intended for
  1.2878 -     use by the <code>CSSStyleSheet#insertRule</code> method, and similar
  1.2879 -     functions which might exist, which parse text into a single rule.
  1.2880 -
  1.2881 -    <li> "<a href="#parse-a-list-of-declarations0"><i>Parse a list of
  1.2882 -     declarations</i></a>" is for the contents of a <code>style</code>
  1.2883 -     attribute, which parses text into the contents of a single style rule.
  1.2884 -
  1.2885 -    <li> "<a href="#parse-a-component-value0"><i>Parse a component
  1.2886 -     value</i></a>" is for things that need to consume a single value, like
  1.2887 -     the parsing rules for ‘<code class=css>attr()</code>’.
  1.2888 -
  1.2889 -    <li> "<a href="#parse-a-list-of-component-values0"><i>Parse a list of
  1.2890 -     component values</i></a>" is for the contents of presentational
  1.2891 -     attributes, which parse text into a single declaration's value.
  1.2892 -   </ul>
  1.2893 -  </div>
  1.2894 -
  1.2895 -  <p> All of the algorithms defined in this spec may be called with either a
  1.2896 -   list of tokens or of component values. Either way produces an identical
  1.2897 -   result.
  1.2898 -
  1.2899 -  <h4 id=parse-a-stylesheet><span class=secno>5.3.1. </span> <dfn
  1.2900 -   id=parse-a-stylesheet0>Parse a stylesheet</dfn></h4>
  1.2901 -
  1.2902 -  <p> To <a href="#parse-a-stylesheet0"><i>parse a stylesheet</i></a> from a
  1.2903 -   stream of tokens:
  1.2904 -
  1.2905 -  <ol>
  1.2906 -   <li> Create a new stylesheet.
  1.2907 -
  1.2908 -   <li> <a href="#consume-a-list-of-rules0"><i>Consume a list of
  1.2909 -    rules</i></a> from the stream of tokens, with the <var>top-level
  1.2910 -    flag</var> set.
  1.2911 -
  1.2912 -   <li> Assign the returned value to the stylesheet's value.
  1.2913 -
  1.2914 -   <li> Return the stylesheet.
  1.2915 -  </ol>
  1.2916 -
  1.2917 -  <h4 id=parse-a-rule><span class=secno>5.3.2. </span> <dfn
  1.2918 -   id=parse-a-rule0>Parse a rule</dfn></h4>
  1.2919 -
  1.2920 -  <p> To <a href="#parse-a-rule0"><i>parse a rule</i></a> from a stream of
  1.2921 -   tokens:
  1.2922 -
  1.2923 -  <ol>
  1.2924 -   <li> Consume 〈whitespace〉s from the token stream until a
  1.2925 -    non-〈whitespace〉 is encountered.
  1.2926 -
  1.2927 -   <li> If the <a href="#current-input-token"><i>current input token</i></a>
  1.2928 -    is a 〈CDO〉, 〈CDC〉, or 〈EOF〉, return a syntax error.
  1.2929 -    <p> Otherwise, if the <a href="#current-input-token"><i>current input
  1.2930 -     token</i></a> is an 〈at-keyword〉, <a
  1.2931 -     href="#consume-an-at-rule0"><i>consume an at-rule</i></a>.
  1.2932 -
  1.2933 -    <p> Otherwise, <a href="#consume-a-qualified-rule0"><i>consume a
  1.2934 -     qualified rule</i></a>. If nothing was returned, return a syntax error.
  1.2935 -
  1.2936 -   <li> Consume 〈whitespace〉s from the token stream until a
  1.2937 -    non-〈whitespace〉 is encountered.
  1.2938 -
  1.2939 -   <li> If the <a href="#current-input-token"><i>current input token</i></a>
  1.2940 -    is an 〈EOF〉, return the rule obtained in step 2. Otherwise, return a
  1.2941 -    syntax error.
  1.2942 -  </ol>
  1.2943 -
  1.2944 -  <h4 id=parse-a-list-of-declarations><span class=secno>5.3.3. </span> <dfn
  1.2945 -   id=parse-a-list-of-declarations0>Parse a list of declarations</dfn></h4>
  1.2946 -
  1.2947 -  <p> To <a href="#parse-a-list-of-declarations0"><i>parse a list of
  1.2948 -   declarations</i></a>:
  1.2949 -
  1.2950 -  <ol>
  1.2951 -   <li> <a href="#consume-a-list-of-declarations0"><i>Consume a list of
  1.2952 -    declarations</i></a>. If anything was returned, return it.
  1.2953 -  </ol>
  1.2954 -
  1.2955 -  <h4 id=parse-a-component-value><span class=secno>5.3.4. </span> <dfn
  1.2956 -   id=parse-a-component-value0>Parse a component value</dfn></h4>
  1.2957 -
  1.2958 -  <p> To <a href="#parse-a-component-value0"><i>parse a component
  1.2959 -   value</i></a>:
  1.2960 -
  1.2961 -  <ol>
  1.2962 -   <li> Discard 〈whitespace〉s from the token stream until a
  1.2963 -    non-〈whitespace〉 is reached. If the token stream is exhausted without
  1.2964 -    finding a non-〈whitespace〉, return a syntax error.
  1.2965 -
  1.2966 -   <li> <a href="#consume-a-component-value0"><i>Consume a component
  1.2967 -    value</i></a>. If nothing is returned, return a syntax error.
  1.2968 -
  1.2969 -   <li> Discard 〈whitespace〉s from the token stream until a
  1.2970 -    non-〈whitespace〉 is reached. If the token stream is exhausted without
  1.2971 -    finding a non-〈whitespace〉, return the value found in the previous
  1.2972 -    step. Otherwise, return a syntax error.
  1.2973 -  </ol>
  1.2974 -
  1.2975 -  <h4 id=parse-a-list-of-component-values><span class=secno>5.3.5. </span>
  1.2976 -   <dfn id=parse-a-list-of-component-values0>Parse a list of component
  1.2977 -   values</dfn></h4>
  1.2978 -
  1.2979 -  <p> To <a href="#parse-a-list-of-component-values0"><i>parse a list of
  1.2980 -   component values</i></a>:
  1.2981 -
  1.2982 -  <ol>
  1.2983 -   <li> Repeatedly <a href="#consume-a-component-value0"><i>consume a
  1.2984 -    component value</i></a> until an 〈EOF〉 is returned, appending the
  1.2985 -    returned values into a list. Return the list.
  1.2986 -  </ol>
  1.2987 -
  1.2988 -  <h3 id=parser-algorithms><span class=secno>5.4. </span> Parser Algorithms</h3>
  1.2989 -
  1.2990 -  <p> The following algorithms comprise the parser. They are called by the
  1.2991 -   parser entry points above.
  1.2992 -
  1.2993 -  <p> These algorithms may be called with a list of either tokens or of
  1.2994 -   component values. (The difference being that some tokens are replaced by
  1.2995 -   <a href="#function"><i>functions</i></a> and <a
  1.2996 -   href="#simple-block"><i>simple blocks</i></a> in a list of component
  1.2997 -   values.) Similar to how the input stream returned EOF characters to
  1.2998 -   represent when it was empty during the tokenization stage, the lists in
  1.2999 -   this stage must return an 〈EOF〉 when the next token is requested but
  1.3000 -   they are empty.
  1.3001 -
  1.3002 -  <p> An algorithm may be invoked with a specific list, in which case it
  1.3003 -   consumes only that list (and when that list is exhausted, it begins
  1.3004 -   returning 〈EOF〉s). Otherwise, it is implicitly invoked with the same
  1.3005 -   list as the invoking algorithm.
  1.3006 -
  1.3007 -  <h4 id=consume-a-list-of-rules><span class=secno>5.4.1. </span> <dfn
  1.3008 -   id=consume-a-list-of-rules0>Consume a list of rules</dfn></h4>
  1.3009 -
  1.3010 -  <p> Create an initially empty list of rules.
  1.3011 -
  1.3012 -  <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3013 -   token</i></a>:
  1.3014 -
  1.3015 -  <dl>
  1.3016 -   <dt>〈whitespace〉
  1.3017 -
  1.3018 -   <dd> Do nothing.
  1.3019 -
  1.3020 -   <dt>〈EOF〉
  1.3021 -
  1.3022 -   <dd> Return the list of rules.
  1.3023 -
  1.3024 -   <dt>〈CDO〉
  1.3025 -
  1.3026 -   <dt>〈CDC〉
  1.3027 -
  1.3028 -   <dd> If the <var>top-level flag</var> is set, do nothing.
  1.3029 -    <p> Otherwise, <a href="#reconsume-the-current-input-token"><i>reconsume
  1.3030 -     the current input token</i></a>. <a
  1.3031 -     href="#consume-a-qualified-rule0"><i>Consume a qualified rule</i></a>.
  1.3032 -     If anything is returned, append it to the list of rules.
  1.3033 -
  1.3034 -   <dt>〈at-keyword〉
  1.3035 -
  1.3036 -   <dd> <a href="#reconsume-the-current-input-token"><i>Reconsume the current
  1.3037 -    input token</i></a>. <a href="#consume-an-at-rule0"><i>Consume an
  1.3038 -    at-rule</i></a>. If anything is returned, append it to the list of rules.
  1.3039 -
  1.3040 -   <dt>anything else
  1.3041 -
  1.3042 -   <dd> <a href="#reconsume-the-current-input-token"><i>Reconsume the current
  1.3043 -    input token</i></a>. <a href="#consume-a-qualified-rule0"><i>Consume a
  1.3044 -    qualified rule</i></a>. If anything is returned, append it to the list of
  1.3045 -    rules.
  1.3046 -  </dl>
  1.3047 -
  1.3048 -  <h4 id=consume-an-at-rule><span class=secno>5.4.2. </span> <dfn
  1.3049 -   id=consume-an-at-rule0>Consume an at-rule</dfn></h4>
  1.3050 -
  1.3051 -  <p> Create a new at-rule with its name set to the value of the <a
  1.3052 -   href="#current-input-token"><i>current input token</i></a>, its prelude
  1.3053 -   initially set to an empty list, and its value initially set to nothing.
  1.3054 -
  1.3055 -  <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3056 -   token</i></a>:
  1.3057 -
  1.3058 -  <dl>
  1.3059 -   <dt>〈semicolon〉
  1.3060 -
  1.3061 -   <dt>〈EOF〉
  1.3062 -
  1.3063 -   <dd> Return the at-rule.
  1.3064 -
  1.3065 -   <dt>〈{〉
  1.3066 -
  1.3067 -   <dd> <a href="#consume-a-simple-block0"><i>Consume a simple block</i></a>
  1.3068 -    and assign it to the at-rule's block. Return the at-rule.
  1.3069 -
  1.3070 -   <dt><a href="#simple-block"><i>simple block</i></a> with an associated
  1.3071 -    token of 〈{〉
  1.3072 -
  1.3073 -   <dd> Assign the block to the at-rule's block. Return the at-rule.
  1.3074 -
  1.3075 -   <dt>anything else
  1.3076 -
  1.3077 -   <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.3078 -    value</i></a>. Append the returned value to the at-rule's prelude.
  1.3079 -  </dl>
  1.3080 -
  1.3081 -  <h4 id=consume-a-qualified-rule><span class=secno>5.4.3. </span> <dfn
  1.3082 -   id=consume-a-qualified-rule0>Consume a qualified rule</dfn></h4>
  1.3083 -
  1.3084 -  <p> Create a new qualified rule with its prelude initially set to an empty
  1.3085 -   list, and its value initially set to nothing.
  1.3086 -
  1.3087 -  <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3088 -   token</i></a>:
  1.3089 -
  1.3090 -  <dl>
  1.3091 -   <dt>〈EOF〉
  1.3092 -
  1.3093 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Return
  1.3094 -    nothing.
  1.3095 -
  1.3096 -   <dt>〈{〉
  1.3097 -
  1.3098 -   <dd> <a href="#consume-a-simple-block0"><i>Consume a simple block</i></a>.
  1.3099 -    <a href="#consume-a-list-of-declarations0"><i>Consume a list of
  1.3100 -    declarations</i></a> from the block's value. If anything was returned,
  1.3101 -    assign it to the qualified rule's value. Return the qualified rule.
  1.3102 -
  1.3103 -   <dt><a href="#simple-block"><i>simple block</i></a> with an associated
  1.3104 -    token of 〈{〉
  1.3105 -
  1.3106 -   <dd> <a href="#consume-a-list-of-declarations0"><i>Consume a list of
  1.3107 -    declarations</i></a> from the block's value. If anything was returned,
  1.3108 -    assign it to the qualified rule's value. Return the qualified rule.
  1.3109 -
  1.3110 -   <dt>anything else
  1.3111 -
  1.3112 -   <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.3113 -    value</i></a>. Append the returned value to the qualified rule's prelude.
  1.3114 -  </dl>
  1.3115 -
  1.3116 -  <h4 id=consume-a-list-of-declarations><span class=secno>5.4.4. </span> <dfn
  1.3117 -   id=consume-a-list-of-declarations0>Consume a list of declarations</dfn></h4>
  1.3118 -
  1.3119 -  <p> Create an initially empty list of declarations.
  1.3120 -
  1.3121 -  <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3122 -   token</i></a>:
  1.3123 -
  1.3124 -  <dl>
  1.3125 -   <dt>〈whitespace〉
  1.3126 -
  1.3127 -   <dt>〈semicolon〉
  1.3128 -
  1.3129 -   <dd> Do nothing.
  1.3130 -
  1.3131 -   <dt>〈EOF〉
  1.3132 -
  1.3133 -   <dd> Return the list of declarations.
  1.3134 -
  1.3135 -   <dt>〈at-keyword〉
  1.3136 -
  1.3137 -   <dd> <a href="#consume-an-at-rule0"><i>Consume an at-rule</i></a>. Append
  1.3138 -    the returned rule to the list of declarations.
  1.3139 -
  1.3140 -   <dt>〈ident〉
  1.3141 -
  1.3142 -   <dd> Initialize a temporary list initially filled with the <a
  1.3143 -    href="#current-input-token"><i>current input token</i></a>. Repeatedly <a
  1.3144 -    href="#consume-a-component-value0"><i>consume a component value</i></a>
  1.3145 -    from the <a href="#next-input-token"><i>next input token</i></a> until a
  1.3146 -    〈semicolon〉 or 〈EOF〉 is returned, appending all of the returned
  1.3147 -    values up to that point to the temporary list. <a
  1.3148 -    href="#consume-a-declaration0"><i>Consume a declaration</i></a> from the
  1.3149 -    temporary list. If anything was returned, append it to the list of
  1.3150 -    declarations.
  1.3151 -
  1.3152 -   <dt>anything else
  1.3153 -
  1.3154 -   <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Repeatedly
  1.3155 -    <a href="#consume-a-component-value0"><i>consume a component
  1.3156 -    value</i></a> from the <a href="#next-input-token"><i>next input
  1.3157 -    token</i></a> until it is a 〈semicolon〉 or 〈EOF〉.
  1.3158 -  </dl>
  1.3159 -
  1.3160 -  <h4 id=consume-a-declaration><span class=secno>5.4.5. </span> <dfn
  1.3161 -   id=consume-a-declaration0>Consume a declaration</dfn></h4>
  1.3162 -
  1.3163 -  <p> Create a new declaration with its name set to the value of the <a
  1.3164 -   href="#current-input-token"><i>current input token</i></a>.
  1.3165 -
  1.3166 -  <p> Repeatedly consume 〈whitespace〉s until a non-〈whitespace〉 is
  1.3167 -   reached. If this token is anything but a 〈colon〉, this is a <a
  1.3168 -   href="#parse-errors"><i>parse error</i></a>. Return nothing.
  1.3169 -
  1.3170 -  <p> Otherwise, repeatedly <a href="#consume-a-component-value0"><i>consume
  1.3171 -   a component value</i></a> from the <a href="#next-input-token"><i>next
  1.3172 -   input token</i></a> until an 〈EOF〉 is reached, appending all of the
  1.3173 -   returned values up to that point to the declaration's value.
  1.3174 -
  1.3175 -  <p> If the last two non-〈whitespace〉s in the declaration's value are a
  1.3176 -   〈delim〉 with the value "!" followed by an 〈ident〉 with a value
  1.3177 -   that is an <a href="#ascii-case-insensitive"><i>ASCII
  1.3178 -   case-insensitive</i></a> match for "important", remove them from the
  1.3179 -   declaration's value and set the declaration's <var>important</var> flag to
  1.3180 -   true.
  1.3181 -
  1.3182 -  <p> Return the declaration.
  1.3183 -
  1.3184 -  <h4 id=consume-a-component-value><span class=secno>5.4.6. </span> <dfn
  1.3185 -   id=consume-a-component-value0>Consume a component value</dfn></h4>
  1.3186 -
  1.3187 -  <p> This section describes how to <a
  1.3188 -   href="#consume-a-component-value0"><i>consume a component value</i></a>.
  1.3189 -
  1.3190 -  <p> If the <a href="#current-input-token"><i>current input token</i></a> is
  1.3191 -   a 〈{〉, 〈[〉, or 〈(〉, <a
  1.3192 -   href="#consume-a-simple-block0"><i>consume a simple block</i></a> and
  1.3193 -   return it.
  1.3194 -
  1.3195 -  <p> Otherwise, if the <a href="#current-input-token"><i>current input
  1.3196 -   token</i></a> is a 〈function〉, <a
  1.3197 -   href="#consume-a-function0"><i>consume a function</i></a> and return it.
  1.3198 -
  1.3199 -  <p> Otherwise, return the <a href="#current-input-token"><i>current input
  1.3200 -   token</i></a>.
  1.3201 -
  1.3202 -  <h4 id=consume-a-simple-block><span class=secno>5.4.7. </span> <dfn
  1.3203 -   id=consume-a-simple-block0>Consume a simple block</dfn></h4>
  1.3204 -
  1.3205 -  <p> This section describes how to <a
  1.3206 -   href="#consume-a-simple-block0"><i>consume a simple block</i></a>.
  1.3207 -
  1.3208 -  <p> The <dfn id=ending-token>ending token</dfn> is the mirror variant of
  1.3209 -   the <a href="#current-input-token"><i>current input token</i></a>. (E.g.
  1.3210 -   if it was called with 〈[〉, the <a href="#ending-token"><i>ending
  1.3211 -   token</i></a> is 〈]〉.)
  1.3212 -
  1.3213 -  <p> Create a simple block with its associated token set to the <a
  1.3214 -   href="#current-input-token"><i>current input token</i></a>.
  1.3215 -
  1.3216 -  <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3217 -   token</i></a> and process it as follows:
  1.3218 -
  1.3219 -  <dl>
  1.3220 -   <dt>〈EOF〉
  1.3221 -
  1.3222 -   <dt><a href="#ending-token"><i>ending token</i></a>
  1.3223 -
  1.3224 -   <dd> Return the block.
  1.3225 -
  1.3226 -   <dt>anything else
  1.3227 -
  1.3228 -   <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.3229 -    value</i></a> and append it to the value of the block.
  1.3230 -  </dl>
  1.3231 -
  1.3232 -  <h4 id=consume-a-function><span class=secno>5.4.8. </span> <dfn
  1.3233 -   id=consume-a-function0>Consume a function</dfn></h4>
  1.3234 -
  1.3235 -  <p> This section describes how to <a href="#consume-a-function0"><i>consume
  1.3236 -   a function</i></a>.
  1.3237 -
  1.3238 -  <p> Create a function with a name equal to the value of the <a
  1.3239 -   href="#current-input-token"><i>current input token</i></a>, and with a
  1.3240 -   value which is initially an empty list.
  1.3241 -
  1.3242 -  <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3243 -   token</i></a> and process it as follows:
  1.3244 -
  1.3245 -  <dl>
  1.3246 -   <dt>〈EOF〉
  1.3247 -
  1.3248 -   <dt>〈)〉
  1.3249 -
  1.3250 -   <dd> Return the function.
  1.3251 -
  1.3252 -   <dt>anything else
  1.3253 -
  1.3254 -   <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.3255 -    value</i></a> and append the returned value to the function's value.
  1.3256 -  </dl>
  1.3257 -
  1.3258 -  <h3 id=changes-from-css-2.1-core-grammar><span class=secno>5.5. </span>
  1.3259 -   Changes from CSS 2.1 Core Grammar</h3>
  1.3260 -
  1.3261 -  <p> <em>This section is non-normative.</em>
  1.3262 -
  1.3263 -  <p class=note> Note that the point of this spec is to match reality;
  1.3264 -   changes from CSS2.1&apos;s Core Grammar are nearly always because the Core
  1.3265 -   Grammar specified something that doesn't match actual browser behavior, or
  1.3266 -   left something unspecified. If some detail doesn't match browsers, please
  1.3267 -   let me know as it's almost certainly unintentional.
  1.3268 -
  1.3269 -  <ol>
  1.3270 -   <li> The handling of some miscellanous "special" tokens (like an unmatched
  1.3271 -    〈}〉) showing up in various places in the grammar has been specified
  1.3272 -    with some reasonable behavior shown by at least one browser. Previously,
  1.3273 -    stylesheets with those tokens in those places just didn't match the
  1.3274 -    stylesheet grammar at all, so their handling was totally undefined.
  1.3275 -    Specifically:
  1.3276 -    <ul>
  1.3277 -     <li> [] blocks, () blocks and functions can now contain {} blocks,
  1.3278 -      〈at-keyword〉s or semicolons
  1.3279 -
  1.3280 -     <li> Selectors can now contain semicolons
  1.3281 -
  1.3282 -     <li> Selectors and at-rule preludes can now contain 〈at-keyword〉s
  1.3283 -    </ul>
  1.3284 -
  1.3285 -   <li> The <a href="#anb0"><var>An+B</var></a> microsyntax has now been
  1.3286 -    formally defined in terms of CSS tokens, rather than with a separate
  1.3287 -    tokenizer. This has resulted in minor differences:
  1.3288 -    <ul>
  1.3289 -     <li> In values starting with "+n", a space is now allowed between the
  1.3290 -      "+" and "n". (This is an accidental consequence of the "+" and "n"
  1.3291 -      parsing as separate CSS tokens, and CSS's value grammar ignoring
  1.3292 -      whitespace.)
  1.3293 -
  1.3294 -     <li> In some cases, "-" characters or digits can be escaped (when they
  1.3295 -      appear as part of the unit of a 〈dimension〉 or 〈ident〉).
  1.3296 -    </ul>
  1.3297 -  </ol>
  1.3298 -
  1.3299 -  <h2 id=anb><span class=secno>6. </span> The <a
  1.3300 -   href="#anb0"><var>An+B</var></a> microsyntax</h2>
  1.3301 -
  1.3302 -  <p> Several things in CSS, such as the ‘<code
  1.3303 -   class=css>:nth-child()</code>’ pseudoclass, need to indicate indexes in
  1.3304 -   a list. The <a href="#anb0"><var>An+B</var></a> microsyntax is useful for
  1.3305 -   this, allowing an author to easily indicate single elements or all
  1.3306 -   elements at regularly-spaced intervals in a list.
  1.3307 -
  1.3308 -  <p> The <dfn id=anb0>An+B</dfn> notation defines an integer step (<dfn
  1.3309 -   id=a>A</dfn>) and offset (<dfn id=b>B</dfn>), and represents the <a
  1.3310 -   href="#anb0"><var>An+B</var></a>th elements in a list, for every positive
  1.3311 -   integer or zero value of <var>n</var>, with the first element in the list
  1.3312 -   having index 1 (not 0).
  1.3313 -
  1.3314 -  <p> For values of <a href="#a"><var>A</var></a> and <a
  1.3315 -   href="#b"><var>B</var></a> greater than 0, this effectively divides the
  1.3316 -   list into groups of <a href="#a"><var>A</var></a> elements (the last group
  1.3317 -   taking the remainder), and selecting the <a href="#b"><var>B</var></a>th
  1.3318 -   element of each group.
  1.3319 -
  1.3320 -  <p> The <a href="#anb0"><var>An+B</var></a> notation also accepts the
  1.3321 -   ‘<code class=css>even</code>’ and ‘<code class=css>odd</code>’
  1.3322 -   keywords, which have the same meaning as ‘<code class=css>2n</code>’
  1.3323 -   and ‘<code class=css>2n+1</code>’, respectively.
  1.3324 -
  1.3325 -  <div class=example>
  1.3326 -   <p>Examples:
  1.3327 -
  1.3328 -   <pre><!--
  1.3329 +      <dl>
  1.3330 +       <dt id=stylesheet-diagram>Stylesheet
  1.3331 +
  1.3332 +       <dd><svg class=railroad-diagram height=200 width=313><g
  1.3333 +        transform="translate(.5 .5)"><path
  1.3334 +        d="M 20 121 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.3335 +        d="M40 131h0"></path><path d="M272 131h0"></path><path
  1.3336 +        d="M40 131a10 10 0 0 0 10 -10v-89a10 10 0 0 1 10 -10"></path><g><path
  1.3337 +        d="M60 22h192"></path></g><path
  1.3338 +        d="M252 22a10 10 0 0 1 10 10v89a10 10 0 0 0 10 10"></path><path
  1.3339 +        d="M40 131h20"></path><g><path d="M60 131h0"></path><path
  1.3340 +        d="M252 131h0"></path><path d="M60 131h10"></path><g><path
  1.3341 +        d="M70 131h0"></path><path d="M242 131h0"></path><path
  1.3342 +        d="M70 131a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><g><path
  1.3343 +        d="M90 101h8"></path><path d="M214 101h8"></path><rect height=22
  1.3344 +        width=116 x=98 y=90></rect><text x=156
  1.3345 +        y=105>〈whitespace〉</text></g><path
  1.3346 +        d="M222 101a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><path
  1.3347 +        d="M70 131a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path><g><path
  1.3348 +        d="M90 71h36"></path><path d="M186 71h36"></path><rect height=22
  1.3349 +        width=60 x=126 y=60></rect><text x=156 y=75>〈CDC〉</text></g><path
  1.3350 +        d="M222 71a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path><path
  1.3351 +        d="M70 131a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path><g><path
  1.3352 +        d="M90 41h36"></path><path d="M186 41h36"></path><rect height=22
  1.3353 +        width=60 x=126 y=30></rect><text x=156 y=45>〈CDO〉</text></g><path
  1.3354 +        d="M222 41a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path><path
  1.3355 +        d="M70 131h20"></path><g><path d="M90 131h0"></path><path
  1.3356 +        d="M222 131h0"></path><rect height=22 width=132 x=90
  1.3357 +        y=120></rect><text x=156 y=135>Qualified rule</text></g><path
  1.3358 +        d="M222 131h20"></path><path
  1.3359 +        d="M70 131a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.3360 +        d="M90 161h28"></path><path d="M194 161h28"></path><rect height=22
  1.3361 +        width=76 x=118 y=150></rect><text x=156 y=165>At-rule</text></g><path
  1.3362 +        d="M222 161a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.3363 +        d="M242 131h10"></path><path
  1.3364 +        d="M70 131a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path
  1.3365 +        d="M70 180h172"></path></g><path
  1.3366 +        d="M242 180a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path
  1.3367 +        d="M252 131h20"></path></g><path
  1.3368 +        d="M 272 131 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3369 +
  1.3370 +       <dt id=rule-list-diagram>Rule list
  1.3371 +
  1.3372 +       <dd><svg class=railroad-diagram height=140 width=313><g
  1.3373 +        transform="translate(.5 .5)"><path
  1.3374 +        d="M 20 61 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.3375 +        d="M40 71h0"></path><path d="M272 71h0"></path><path
  1.3376 +        d="M40 71a10 10 0 0 0 10 -10v-29a10 10 0 0 1 10 -10"></path><g><path
  1.3377 +        d="M60 22h192"></path></g><path
  1.3378 +        d="M252 22a10 10 0 0 1 10 10v29a10 10 0 0 0 10 10"></path><path
  1.3379 +        d="M40 71h20"></path><g><path d="M60 71h0"></path><path
  1.3380 +        d="M252 71h0"></path><path d="M60 71h10"></path><g><path
  1.3381 +        d="M70 71h0"></path><path d="M242 71h0"></path><path
  1.3382 +        d="M70 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><g><path
  1.3383 +        d="M90 41h8"></path><path d="M214 41h8"></path><rect height=22
  1.3384 +        width=116 x=98 y=30></rect><text x=156
  1.3385 +        y=45>〈whitespace〉</text></g><path
  1.3386 +        d="M222 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><path
  1.3387 +        d="M70 71h20"></path><g><path d="M90 71h0"></path><path
  1.3388 +        d="M222 71h0"></path><rect height=22 width=132 x=90 y=60></rect><text
  1.3389 +        x=156 y=75>Qualified rule</text></g><path d="M222 71h20"></path><path
  1.3390 +        d="M70 71a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.3391 +        d="M90 101h28"></path><path d="M194 101h28"></path><rect height=22
  1.3392 +        width=76 x=118 y=90></rect><text x=156 y=105>At-rule</text></g><path
  1.3393 +        d="M222 101a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.3394 +        d="M242 71h10"></path><path
  1.3395 +        d="M70 71a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path
  1.3396 +        d="M70 120h172"></path></g><path
  1.3397 +        d="M242 120a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path
  1.3398 +        d="M252 71h20"></path></g><path
  1.3399 +        d="M 272 71 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3400 +
  1.3401 +       <dt id=at-rule-diagram>At-rule
  1.3402 +
  1.3403 +       <dd><svg class=railroad-diagram height=102 width=541><g
  1.3404 +        transform="translate(.5 .5)"><path
  1.3405 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3406 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3407 +        d="M166 41h0"></path><rect height=22 width=116 x=50 y=30></rect><text
  1.3408 +        x=108 y=45>〈at-keyword〉</text></g><path
  1.3409 +        d="M166 41h10"></path><g><path d="M176 41h0"></path><path
  1.3410 +        d="M376 41h0"></path><path
  1.3411 +        d="M176 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3412 +        d="M196 21h160"></path></g><path
  1.3413 +        d="M356 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3414 +        d="M176 41h20"></path><g><path d="M196 41h0"></path><path
  1.3415 +        d="M356 41h0"></path><path d="M196 41h10"></path><g><path
  1.3416 +        d="M206 41h0"></path><path d="M346 41h0"></path><rect height=22
  1.3417 +        width=140 x=206 y=30></rect><text x=276 y=45>Component
  1.3418 +        value</text></g><path d="M346 41h10"></path><path
  1.3419 +        d="M206 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3420 +        d="M206 61h140"></path></g><path
  1.3421 +        d="M346 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3422 +        d="M356 41h20"></path></g><g><path d="M376 41h0"></path><path
  1.3423 +        d="M500 41h0"></path><path d="M376 41h20"></path><g><path
  1.3424 +        d="M396 41h0"></path><path d="M480 41h0"></path><rect height=22
  1.3425 +        width=84 x=396 y=30></rect><text x=438 y=45>{} block</text></g><path
  1.3426 +        d="M480 41h20"></path><path
  1.3427 +        d="M376 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.3428 +        d="M396 71h28"></path><path d="M452 71h28"></path><rect height=22
  1.3429 +        rx=10 ry=10 width=28 x=424 y=60></rect><text x=438
  1.3430 +        y=75>;</text></g><path
  1.3431 +        d="M480 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.3432 +        d="M 500 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3433 +
  1.3434 +       <dt id=qualified-rule-diagram>Qualified rule
  1.3435 +
  1.3436 +       <dd><svg class=railroad-diagram height=81 width=545><g
  1.3437 +        transform="translate(.5 .5)"><path
  1.3438 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.3439 +        d="M40 41h0"></path><path d="M240 41h0"></path><path
  1.3440 +        d="M40 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3441 +        d="M60 21h160"></path></g><path
  1.3442 +        d="M220 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3443 +        d="M40 41h20"></path><g><path d="M60 41h0"></path><path
  1.3444 +        d="M220 41h0"></path><path d="M60 41h10"></path><g><path
  1.3445 +        d="M70 41h0"></path><path d="M210 41h0"></path><rect height=22
  1.3446 +        width=140 x=70 y=30></rect><text x=140 y=45>Component
  1.3447 +        value</text></g><path d="M210 41h10"></path><path
  1.3448 +        d="M70 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3449 +        d="M70 61h140"></path></g><path
  1.3450 +        d="M210 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3451 +        d="M220 41h20"></path></g><path d="M240 41h10"></path><g><path
  1.3452 +        d="M250 41h0"></path><path d="M278 41h0"></path><rect height=22 rx=10
  1.3453 +        ry=10 width=28 x=250 y=30></rect><text x=264 y=45>{</text></g><path
  1.3454 +        d="M278 41h10"></path><path d="M288 41h10"></path><g><path
  1.3455 +        d="M298 41h0"></path><path d="M446 41h0"></path><rect height=22
  1.3456 +        width=148 x=298 y=30></rect><text x=372 y=45>Declaration
  1.3457 +        list</text></g><path d="M446 41h10"></path><path
  1.3458 +        d="M456 41h10"></path><g><path d="M466 41h0"></path><path
  1.3459 +        d="M494 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=466
  1.3460 +        y=30></rect><text x=480 y=45>}</text></g><path
  1.3461 +        d="M494 41h10"></path><path
  1.3462 +        d="M 504 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3463 +
  1.3464 +       <dt id=declaration-list-diagram>Declaration list
  1.3465 +
  1.3466 +       <dd><svg class=railroad-diagram height=102 width=589><g
  1.3467 +        transform="translate(.5 .5)"><path
  1.3468 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3469 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3470 +        d="M94 41h0"></path><rect height=22 width=44 x=50 y=30></rect><text
  1.3471 +        x=72 y=45>ws*</text></g><path d="M94 41h10"></path><g><path
  1.3472 +        d="M104 41h0"></path><path d="M548 41h0"></path><path
  1.3473 +        d="M104 41h20"></path><g><path d="M124 41h0"></path><path
  1.3474 +        d="M528 41h0"></path><g><path d="M124 41h0"></path><path
  1.3475 +        d="M272 41h0"></path><path
  1.3476 +        d="M124 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3477 +        d="M144 21h108"></path></g><path
  1.3478 +        d="M252 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3479 +        d="M124 41h20"></path><g><path d="M144 41h0"></path><path
  1.3480 +        d="M252 41h0"></path><rect height=22 width=108 x=144
  1.3481 +        y=30></rect><text x=198 y=45>Declaration</text></g><path
  1.3482 +        d="M252 41h20"></path></g><g><path d="M272 41h0"></path><path
  1.3483 +        d="M528 41h0"></path><path
  1.3484 +        d="M272 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3485 +        d="M292 21h216"></path></g><path
  1.3486 +        d="M508 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3487 +        d="M272 41h20"></path><g><path d="M292 41h0"></path><path
  1.3488 +        d="M508 41h0"></path><path d="M292 41h10"></path><g><path
  1.3489 +        d="M302 41h0"></path><path d="M330 41h0"></path><rect height=22 rx=10
  1.3490 +        ry=10 width=28 x=302 y=30></rect><text x=316 y=45>;</text></g><path
  1.3491 +        d="M330 41h10"></path><path d="M340 41h10"></path><g><path
  1.3492 +        d="M350 41h0"></path><path d="M498 41h0"></path><rect height=22
  1.3493 +        width=148 x=350 y=30></rect><text x=424 y=45>Declaration
  1.3494 +        list</text></g><path d="M498 41h10"></path></g><path
  1.3495 +        d="M508 41h20"></path></g></g><path d="M528 41h20"></path><path
  1.3496 +        d="M104 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.3497 +        d="M124 71h70"></path><path d="M458 71h70"></path><path
  1.3498 +        d="M194 71h10"></path><g><path d="M204 71h0"></path><path
  1.3499 +        d="M280 71h0"></path><rect height=22 width=76 x=204 y=60></rect><text
  1.3500 +        x=242 y=75>At-rule</text></g><path d="M280 71h10"></path><path
  1.3501 +        d="M290 71h10"></path><g><path d="M300 71h0"></path><path
  1.3502 +        d="M448 71h0"></path><rect height=22 width=148 x=300
  1.3503 +        y=60></rect><text x=374 y=75>Declaration list</text></g><path
  1.3504 +        d="M448 71h10"></path></g><path
  1.3505 +        d="M528 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path
  1.3506 +        d="M 548 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3507 +
  1.3508 +       <dt id=declaration-diagram>Declaration
  1.3509 +
  1.3510 +       <dd><svg class=railroad-diagram height=81 width=629><g
  1.3511 +        transform="translate(.5 .5)"><path
  1.3512 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3513 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3514 +        d="M126 41h0"></path><rect height=22 width=76 x=50 y=30></rect><text
  1.3515 +        x=88 y=45>〈ident〉</text></g><path d="M126 41h10"></path><path
  1.3516 +        d="M136 41h10"></path><g><path d="M146 41h0"></path><path
  1.3517 +        d="M190 41h0"></path><rect height=22 width=44 x=146 y=30></rect><text
  1.3518 +        x=168 y=45>ws*</text></g><path d="M190 41h10"></path><path
  1.3519 +        d="M200 41h10"></path><g><path d="M210 41h0"></path><path
  1.3520 +        d="M238 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=210
  1.3521 +        y=30></rect><text x=224 y=45>:</text></g><path
  1.3522 +        d="M238 41h10"></path><g><path d="M248 41h0"></path><path
  1.3523 +        d="M448 41h0"></path><path
  1.3524 +        d="M248 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3525 +        d="M268 21h160"></path></g><path
  1.3526 +        d="M428 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3527 +        d="M248 41h20"></path><g><path d="M268 41h0"></path><path
  1.3528 +        d="M428 41h0"></path><path d="M268 41h10"></path><g><path
  1.3529 +        d="M278 41h0"></path><path d="M418 41h0"></path><rect height=22
  1.3530 +        width=140 x=278 y=30></rect><text x=348 y=45>Component
  1.3531 +        value</text></g><path d="M418 41h10"></path><path
  1.3532 +        d="M278 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3533 +        d="M278 61h140"></path></g><path
  1.3534 +        d="M418 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3535 +        d="M428 41h20"></path></g><g><path d="M448 41h0"></path><path
  1.3536 +        d="M588 41h0"></path><path
  1.3537 +        d="M448 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3538 +        d="M468 21h100"></path></g><path
  1.3539 +        d="M568 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3540 +        d="M448 41h20"></path><g><path d="M468 41h0"></path><path
  1.3541 +        d="M568 41h0"></path><rect height=22 width=100 x=468
  1.3542 +        y=30></rect><text x=518 y=45>!important</text></g><path
  1.3543 +        d="M568 41h20"></path></g><path
  1.3544 +        d="M 588 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3545 +
  1.3546 +       <dt id=important-diagram>!important
  1.3547 +
  1.3548 +       <dd><svg class=railroad-diagram height=62 width=449><g
  1.3549 +        transform="translate(.5 .5)"><path
  1.3550 +        d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3551 +        d="M40 31h10"></path><g><path d="M50 31h0"></path><path
  1.3552 +        d="M78 31h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.3553 +        y=20></rect><text x=64 y=35>!</text></g><path
  1.3554 +        d="M78 31h10"></path><path d="M88 31h10"></path><g><path
  1.3555 +        d="M98 31h0"></path><path d="M142 31h0"></path><rect height=22
  1.3556 +        width=44 x=98 y=20></rect><text x=120 y=35>ws*</text></g><path
  1.3557 +        d="M142 31h10"></path><path d="M152 31h10"></path><g><path
  1.3558 +        d="M162 31h0"></path><path d="M334 31h0"></path><rect height=22
  1.3559 +        width=172 x=162 y=20></rect><text x=248 y=35>〈ident
  1.3560 +        "important"〉</text></g><path d="M334 31h10"></path><path
  1.3561 +        d="M344 31h10"></path><g><path d="M354 31h0"></path><path
  1.3562 +        d="M398 31h0"></path><rect height=22 width=44 x=354 y=20></rect><text
  1.3563 +        x=376 y=35>ws*</text></g><path d="M398 31h10"></path><path
  1.3564 +        d="M 408 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3565 +
  1.3566 +       <dt id=ws-diagram>ws*
  1.3567 +
  1.3568 +       <dd><svg class=railroad-diagram height=81 width=257><g
  1.3569 +        transform="translate(.5 .5)"><path
  1.3570 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.3571 +        d="M40 41h0"></path><path d="M216 41h0"></path><path
  1.3572 +        d="M40 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3573 +        d="M60 21h136"></path></g><path
  1.3574 +        d="M196 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3575 +        d="M40 41h20"></path><g><path d="M60 41h0"></path><path
  1.3576 +        d="M196 41h0"></path><path d="M60 41h10"></path><g><path
  1.3577 +        d="M70 41h0"></path><path d="M186 41h0"></path><rect height=22
  1.3578 +        width=116 x=70 y=30></rect><text x=128
  1.3579 +        y=45>〈whitespace〉</text></g><path d="M186 41h10"></path><path
  1.3580 +        d="M70 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3581 +        d="M70 61h116"></path></g><path
  1.3582 +        d="M186 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3583 +        d="M196 41h20"></path></g><path
  1.3584 +        d="M 216 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3585 +
  1.3586 +       <dt id=component-value-diagram>Component value
  1.3587 +
  1.3588 +       <dd><svg class=railroad-diagram height=182 width=261><g
  1.3589 +        transform="translate(.5 .5)"><path
  1.3590 +        d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
  1.3591 +        d="M40 31h0"></path><path d="M220 31h0"></path><path
  1.3592 +        d="M40 31h20"></path><g><path d="M60 31h0"></path><path
  1.3593 +        d="M200 31h0"></path><rect height=22 width=140 x=60 y=20></rect><text
  1.3594 +        x=130 y=35>Preserved token</text></g><path
  1.3595 +        d="M200 31h20"></path><path
  1.3596 +        d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path
  1.3597 +        d="M60 61h28"></path><path d="M172 61h28"></path><rect height=22
  1.3598 +        width=84 x=88 y=50></rect><text x=130 y=65>{} block</text></g><path
  1.3599 +        d="M200 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><path
  1.3600 +        d="M40 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path><g><path
  1.3601 +        d="M60 91h28"></path><path d="M172 91h28"></path><rect height=22
  1.3602 +        width=84 x=88 y=80></rect><text x=130 y=95>() block</text></g><path
  1.3603 +        d="M200 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path><path
  1.3604 +        d="M40 31a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path><g><path
  1.3605 +        d="M60 121h28"></path><path d="M172 121h28"></path><rect height=22
  1.3606 +        width=84 x=88 y=110></rect><text x=130 y=125>[] block</text></g><path
  1.3607 +        d="M200 121a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path><path
  1.3608 +        d="M40 31a10 10 0 0 1 10 10v100a10 10 0 0 0 10 10"></path><g><path
  1.3609 +        d="M60 151h4"></path><path d="M196 151h4"></path><rect height=22
  1.3610 +        width=132 x=64 y=140></rect><text x=130 y=155>Function
  1.3611 +        block</text></g><path
  1.3612 +        d="M200 151a10 10 0 0 0 10 -10v-100a10 10 0 0 1 10 -10"></path></g><path
  1.3613 +        d="M 220 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3614 +
  1.3615 +       <dt id="{}-block-diagram">{} block
  1.3616 +
  1.3617 +       <dd><svg class=railroad-diagram height=81 width=377><g
  1.3618 +        transform="translate(.5 .5)"><path
  1.3619 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3620 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3621 +        d="M78 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.3622 +        y=30></rect><text x=64 y=45>{</text></g><path
  1.3623 +        d="M78 41h10"></path><g><path d="M88 41h0"></path><path
  1.3624 +        d="M288 41h0"></path><path
  1.3625 +        d="M88 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3626 +        d="M108 21h160"></path></g><path
  1.3627 +        d="M268 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3628 +        d="M88 41h20"></path><g><path d="M108 41h0"></path><path
  1.3629 +        d="M268 41h0"></path><path d="M108 41h10"></path><g><path
  1.3630 +        d="M118 41h0"></path><path d="M258 41h0"></path><rect height=22
  1.3631 +        width=140 x=118 y=30></rect><text x=188 y=45>Component
  1.3632 +        value</text></g><path d="M258 41h10"></path><path
  1.3633 +        d="M118 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3634 +        d="M118 61h140"></path></g><path
  1.3635 +        d="M258 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3636 +        d="M268 41h20"></path></g><path d="M288 41h10"></path><g><path
  1.3637 +        d="M298 41h0"></path><path d="M326 41h0"></path><rect height=22 rx=10
  1.3638 +        ry=10 width=28 x=298 y=30></rect><text x=312 y=45>}</text></g><path
  1.3639 +        d="M326 41h10"></path><path
  1.3640 +        d="M 336 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3641 +
  1.3642 +       <dt id="()-block-diagram">() block
  1.3643 +
  1.3644 +       <dd><svg class=railroad-diagram height=81 width=377><g
  1.3645 +        transform="translate(.5 .5)"><path
  1.3646 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3647 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3648 +        d="M78 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.3649 +        y=30></rect><text x=64 y=45>(</text></g><path
  1.3650 +        d="M78 41h10"></path><g><path d="M88 41h0"></path><path
  1.3651 +        d="M288 41h0"></path><path
  1.3652 +        d="M88 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3653 +        d="M108 21h160"></path></g><path
  1.3654 +        d="M268 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3655 +        d="M88 41h20"></path><g><path d="M108 41h0"></path><path
  1.3656 +        d="M268 41h0"></path><path d="M108 41h10"></path><g><path
  1.3657 +        d="M118 41h0"></path><path d="M258 41h0"></path><rect height=22
  1.3658 +        width=140 x=118 y=30></rect><text x=188 y=45>Component
  1.3659 +        value</text></g><path d="M258 41h10"></path><path
  1.3660 +        d="M118 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3661 +        d="M118 61h140"></path></g><path
  1.3662 +        d="M258 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3663 +        d="M268 41h20"></path></g><path d="M288 41h10"></path><g><path
  1.3664 +        d="M298 41h0"></path><path d="M326 41h0"></path><rect height=22 rx=10
  1.3665 +        ry=10 width=28 x=298 y=30></rect><text x=312 y=45>)</text></g><path
  1.3666 +        d="M326 41h10"></path><path
  1.3667 +        d="M 336 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3668 +
  1.3669 +       <dt id="[]-block-diagram">[] block
  1.3670 +
  1.3671 +       <dd><svg class=railroad-diagram height=81 width=377><g
  1.3672 +        transform="translate(.5 .5)"><path
  1.3673 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3674 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3675 +        d="M78 41h0"></path><rect height=22 rx=10 ry=10 width=28 x=50
  1.3676 +        y=30></rect><text x=64 y=45>[</text></g><path
  1.3677 +        d="M78 41h10"></path><g><path d="M88 41h0"></path><path
  1.3678 +        d="M288 41h0"></path><path
  1.3679 +        d="M88 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3680 +        d="M108 21h160"></path></g><path
  1.3681 +        d="M268 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3682 +        d="M88 41h20"></path><g><path d="M108 41h0"></path><path
  1.3683 +        d="M268 41h0"></path><path d="M108 41h10"></path><g><path
  1.3684 +        d="M118 41h0"></path><path d="M258 41h0"></path><rect height=22
  1.3685 +        width=140 x=118 y=30></rect><text x=188 y=45>Component
  1.3686 +        value</text></g><path d="M258 41h10"></path><path
  1.3687 +        d="M118 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3688 +        d="M118 61h140"></path></g><path
  1.3689 +        d="M258 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3690 +        d="M268 41h20"></path></g><path d="M288 41h10"></path><g><path
  1.3691 +        d="M298 41h0"></path><path d="M326 41h0"></path><rect height=22 rx=10
  1.3692 +        ry=10 width=28 x=298 y=30></rect><text x=312 y=45>]</text></g><path
  1.3693 +        d="M326 41h10"></path><path
  1.3694 +        d="M 336 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3695 +
  1.3696 +       <dt id=function-block-diagram>Function block
  1.3697 +
  1.3698 +       <dd><svg class=railroad-diagram height=81 width=449><g
  1.3699 +        transform="translate(.5 .5)"><path
  1.3700 +        d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path
  1.3701 +        d="M40 41h10"></path><g><path d="M50 41h0"></path><path
  1.3702 +        d="M150 41h0"></path><rect height=22 width=100 x=50 y=30></rect><text
  1.3703 +        x=100 y=45>〈function〉</text></g><path
  1.3704 +        d="M150 41h10"></path><g><path d="M160 41h0"></path><path
  1.3705 +        d="M360 41h0"></path><path
  1.3706 +        d="M160 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path
  1.3707 +        d="M180 21h160"></path></g><path
  1.3708 +        d="M340 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path
  1.3709 +        d="M160 41h20"></path><g><path d="M180 41h0"></path><path
  1.3710 +        d="M340 41h0"></path><path d="M180 41h10"></path><g><path
  1.3711 +        d="M190 41h0"></path><path d="M330 41h0"></path><rect height=22
  1.3712 +        width=140 x=190 y=30></rect><text x=260 y=45>Component
  1.3713 +        value</text></g><path d="M330 41h10"></path><path
  1.3714 +        d="M190 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path
  1.3715 +        d="M190 61h140"></path></g><path
  1.3716 +        d="M330 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path
  1.3717 +        d="M340 41h20"></path></g><path d="M360 41h10"></path><g><path
  1.3718 +        d="M370 41h0"></path><path d="M398 41h0"></path><rect height=22 rx=10
  1.3719 +        ry=10 width=28 x=370 y=30></rect><text x=384 y=45>)</text></g><path
  1.3720 +        d="M398 41h10"></path><path
  1.3721 +        d="M 408 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
  1.3722 +      </dl>
  1.3723 +
  1.3724 +      <h3 id=definitions0><span class=secno>5.2. </span> Definitions</h3>
  1.3725 +
  1.3726 +      <dl>
  1.3727 +       <dt><dfn id=current-input-token>current input token</dfn>
  1.3728 +
  1.3729 +       <dd> The token or <a href="#component-value"><i>component
  1.3730 +        value</i></a> currently being operated on, from the list of tokens
  1.3731 +        produced by the tokenizer.
  1.3732 +
  1.3733 +       <dt><dfn id=next-input-token>next input token</dfn>
  1.3734 +
  1.3735 +       <dd> The token or <a href="#component-value"><i>component
  1.3736 +        value</i></a> following the <a href="#current-input-token"><i>current
  1.3737 +        input token</i></a> in the list of tokens produced by the tokenizer.
  1.3738 +        If there isn't a token following the <a
  1.3739 +        href="#current-input-token"><i>current input token</i></a>, the <a
  1.3740 +        href="#next-input-token"><i>next input token</i></a> is an 〈EOF〉.
  1.3741 +
  1.3742 +       <dt><dfn id=eof>〈EOF〉</dfn>
  1.3743 +
  1.3744 +       <dd> A conceptual token representing the end of the list of tokens.
  1.3745 +        Whenever the list of tokens is empty, the <a
  1.3746 +        href="#next-input-token"><i>next input token</i></a> is always an
  1.3747 +        〈EOF〉.
  1.3748 +
  1.3749 +       <dt><dfn id=reconsume-the-current-input-token>reconsume the current
  1.3750 +        input token</dfn>
  1.3751 +
  1.3752 +       <dd> Push the <a href="#current-input-token"><i>current input
  1.3753 +        token</i></a> back onto the list of tokens produced by the tokenizer,
  1.3754 +        so that the next time a mode instructs you to consume the next input
  1.3755 +        token, it will instead reconsume the <a
  1.3756 +        href="#current-input-token"><i>current input token</i></a>.
  1.3757 +
  1.3758 +       <dt><dfn id=ascii-case-insensitive>ASCII case-insensitive</dfn>
  1.3759 +
  1.3760 +       <dd> When two strings are to be matched ASCII case-insensitively,
  1.3761 +        temporarily convert both of them to ASCII lower-case form by adding
  1.3762 +        32 (0x20) to the value of each codepoint between U+0041 LATIN CAPITAL
  1.3763 +        LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z), inclusive, and
  1.3764 +        then compare them on a codepoint-by-codepoint basis.
  1.3765 +      </dl>
  1.3766 +
  1.3767 +      <h3 id=parser-entry-points><span class=secno>5.3. </span> Parser Entry
  1.3768 +       Points</h3>
  1.3769 +
  1.3770 +      <p> The algorithms defined in this specification can be invoked in
  1.3771 +       multiple ways to convert a stream of text into various CSS concepts.
  1.3772 +
  1.3773 +      <p> All of the algorithms defined in this section begin in the parser.
  1.3774 +       It is assumed that the <a href="#preprocessing-the-input-stream">input
  1.3775 +       preprocessing</a> and <a href="#tokenization">tokenization</a> steps
  1.3776 +       have already been completed, resulting in a stream of tokens.
  1.3777 +
  1.3778 +      <p class=note> Other specs can define additional entry points for their
  1.3779 +       own purposes.
  1.3780 +
  1.3781 +      <div class=issue>
  1.3782 +       <p> The following notes should probably be translated into normative
  1.3783 +        text in the relevant specs, hooking this spec's terms:
  1.3784 +
  1.3785 +       <ul>
  1.3786 +        <li> "<a href="#parse-a-stylesheet0"><i>Parse a stylesheet</i></a>"
  1.3787 +         is intended to be the normal parser entry point, for parsing
  1.3788 +         stylesheets.
  1.3789 +
  1.3790 +        <li> "<a href="#parse-a-rule0"><i>Parse a rule</i></a>" is intended
  1.3791 +         for use by the <code>CSSStyleSheet#insertRule</code> method, and
  1.3792 +         similar functions which might exist, which parse text into a single
  1.3793 +         rule.
  1.3794 +
  1.3795 +        <li> "<a href="#parse-a-list-of-declarations0"><i>Parse a list of
  1.3796 +         declarations</i></a>" is for the contents of a <code>style</code>
  1.3797 +         attribute, which parses text into the contents of a single style
  1.3798 +         rule.
  1.3799 +
  1.3800 +        <li> "<a href="#parse-a-component-value0"><i>Parse a component
  1.3801 +         value</i></a>" is for things that need to consume a single value,
  1.3802 +         like the parsing rules for ‘<code class=css>attr()</code>’.
  1.3803 +
  1.3804 +        <li> "<a href="#parse-a-list-of-component-values0"><i>Parse a list of
  1.3805 +         component values</i></a>" is for the contents of presentational
  1.3806 +         attributes, which parse text into a single declaration's value.
  1.3807 +       </ul>
  1.3808 +      </div>
  1.3809 +
  1.3810 +      <p> All of the algorithms defined in this spec may be called with
  1.3811 +       either a list of tokens or of component values. Either way produces an
  1.3812 +       identical result.
  1.3813 +
  1.3814 +      <h4 id=parse-a-stylesheet><span class=secno>5.3.1. </span> <dfn
  1.3815 +       id=parse-a-stylesheet0>Parse a stylesheet</dfn></h4>
  1.3816 +
  1.3817 +      <p> To <a href="#parse-a-stylesheet0"><i>parse a stylesheet</i></a>
  1.3818 +       from a stream of tokens:
  1.3819 +
  1.3820 +      <ol>
  1.3821 +       <li> Create a new stylesheet.
  1.3822 +
  1.3823 +       <li> <a href="#consume-a-list-of-rules0"><i>Consume a list of
  1.3824 +        rules</i></a> from the stream of tokens, with the <var>top-level
  1.3825 +        flag</var> set.
  1.3826 +
  1.3827 +       <li> Assign the returned value to the stylesheet's value.
  1.3828 +
  1.3829 +       <li> Return the stylesheet.
  1.3830 +      </ol>
  1.3831 +
  1.3832 +      <h4 id=parse-a-rule><span class=secno>5.3.2. </span> <dfn
  1.3833 +       id=parse-a-rule0>Parse a rule</dfn></h4>
  1.3834 +
  1.3835 +      <p> To <a href="#parse-a-rule0"><i>parse a rule</i></a> from a stream
  1.3836 +       of tokens:
  1.3837 +
  1.3838 +      <ol>
  1.3839 +       <li> Consume 〈whitespace〉s from the token stream until a
  1.3840 +        non-〈whitespace〉 is encountered.
  1.3841 +
  1.3842 +       <li> If the <a href="#current-input-token"><i>current input
  1.3843 +        token</i></a> is a 〈CDO〉, 〈CDC〉, or 〈EOF〉, return a
  1.3844 +        syntax error.
  1.3845 +        <p> Otherwise, if the <a href="#current-input-token"><i>current input
  1.3846 +         token</i></a> is an 〈at-keyword〉, <a
  1.3847 +         href="#consume-an-at-rule0"><i>consume an at-rule</i></a>.
  1.3848 +
  1.3849 +        <p> Otherwise, <a href="#consume-a-qualified-rule0"><i>consume a
  1.3850 +         qualified rule</i></a>. If nothing was returned, return a syntax
  1.3851 +         error.
  1.3852 +
  1.3853 +       <li> Consume 〈whitespace〉s from the token stream until a
  1.3854 +        non-〈whitespace〉 is encountered.
  1.3855 +
  1.3856 +       <li> If the <a href="#current-input-token"><i>current input
  1.3857 +        token</i></a> is an 〈EOF〉, return the rule obtained in step 2.
  1.3858 +        Otherwise, return a syntax error.
  1.3859 +      </ol>
  1.3860 +
  1.3861 +      <h4 id=parse-a-list-of-declarations><span class=secno>5.3.3. </span>
  1.3862 +       <dfn id=parse-a-list-of-declarations0>Parse a list of
  1.3863 +       declarations</dfn></h4>
  1.3864 +
  1.3865 +      <p> To <a href="#parse-a-list-of-declarations0"><i>parse a list of
  1.3866 +       declarations</i></a>:
  1.3867 +
  1.3868 +      <ol>
  1.3869 +       <li> <a href="#consume-a-list-of-declarations0"><i>Consume a list of
  1.3870 +        declarations</i></a>. If anything was returned, return it.
  1.3871 +      </ol>
  1.3872 +
  1.3873 +      <h4 id=parse-a-component-value><span class=secno>5.3.4. </span> <dfn
  1.3874 +       id=parse-a-component-value0>Parse a component value</dfn></h4>
  1.3875 +
  1.3876 +      <p> To <a href="#parse-a-component-value0"><i>parse a component
  1.3877 +       value</i></a>:
  1.3878 +
  1.3879 +      <ol>
  1.3880 +       <li> Discard 〈whitespace〉s from the token stream until a
  1.3881 +        non-〈whitespace〉 is reached. If the token stream is exhausted
  1.3882 +        without finding a non-〈whitespace〉, return a syntax error.
  1.3883 +
  1.3884 +       <li> <a href="#consume-a-component-value0"><i>Consume a component
  1.3885 +        value</i></a>. If nothing is returned, return a syntax error.
  1.3886 +
  1.3887 +       <li> Discard 〈whitespace〉s from the token stream until a
  1.3888 +        non-〈whitespace〉 is reached. If the token stream is exhausted
  1.3889 +        without finding a non-〈whitespace〉, return the value found in the
  1.3890 +        previous step. Otherwise, return a syntax error.
  1.3891 +      </ol>
  1.3892 +
  1.3893 +      <h4 id=parse-a-list-of-component-values><span class=secno>5.3.5.
  1.3894 +       </span> <dfn id=parse-a-list-of-component-values0>Parse a list of
  1.3895 +       component values</dfn></h4>
  1.3896 +
  1.3897 +      <p> To <a href="#parse-a-list-of-component-values0"><i>parse a list of
  1.3898 +       component values</i></a>:
  1.3899 +
  1.3900 +      <ol>
  1.3901 +       <li> Repeatedly <a href="#consume-a-component-value0"><i>consume a
  1.3902 +        component value</i></a> until an 〈EOF〉 is returned, appending the
  1.3903 +        returned values into a list. Return the list.
  1.3904 +      </ol>
  1.3905 +
  1.3906 +      <h3 id=parser-algorithms><span class=secno>5.4. </span> Parser
  1.3907 +       Algorithms</h3>
  1.3908 +
  1.3909 +      <p> The following algorithms comprise the parser. They are called by
  1.3910 +       the parser entry points above.
  1.3911 +
  1.3912 +      <p> These algorithms may be called with a list of either tokens or of
  1.3913 +       component values. (The difference being that some tokens are replaced
  1.3914 +       by <a href="#function"><i>functions</i></a> and <a
  1.3915 +       href="#simple-block"><i>simple blocks</i></a> in a list of component
  1.3916 +       values.) Similar to how the input stream returned EOF characters to
  1.3917 +       represent when it was empty during the tokenization stage, the lists
  1.3918 +       in this stage must return an 〈EOF〉 when the next token is
  1.3919 +       requested but they are empty.
  1.3920 +
  1.3921 +      <p> An algorithm may be invoked with a specific list, in which case it
  1.3922 +       consumes only that list (and when that list is exhausted, it begins
  1.3923 +       returning 〈EOF〉s). Otherwise, it is implicitly invoked with the
  1.3924 +       same list as the invoking algorithm.
  1.3925 +
  1.3926 +      <h4 id=consume-a-list-of-rules><span class=secno>5.4.1. </span> <dfn
  1.3927 +       id=consume-a-list-of-rules0>Consume a list of rules</dfn></h4>
  1.3928 +
  1.3929 +      <p> Create an initially empty list of rules.
  1.3930 +
  1.3931 +      <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3932 +       token</i></a>:
  1.3933 +
  1.3934 +      <dl>
  1.3935 +       <dt>〈whitespace〉
  1.3936 +
  1.3937 +       <dd> Do nothing.
  1.3938 +
  1.3939 +       <dt>〈EOF〉
  1.3940 +
  1.3941 +       <dd> Return the list of rules.
  1.3942 +
  1.3943 +       <dt>〈CDO〉
  1.3944 +
  1.3945 +       <dt>〈CDC〉
  1.3946 +
  1.3947 +       <dd> If the <var>top-level flag</var> is set, do nothing.
  1.3948 +        <p> Otherwise, <a
  1.3949 +         href="#reconsume-the-current-input-token"><i>reconsume the current
  1.3950 +         input token</i></a>. <a href="#consume-a-qualified-rule0"><i>Consume
  1.3951 +         a qualified rule</i></a>. If anything is returned, append it to the
  1.3952 +         list of rules.
  1.3953 +
  1.3954 +       <dt>〈at-keyword〉
  1.3955 +
  1.3956 +       <dd> <a href="#reconsume-the-current-input-token"><i>Reconsume the
  1.3957 +        current input token</i></a>. <a
  1.3958 +        href="#consume-an-at-rule0"><i>Consume an at-rule</i></a>. If
  1.3959 +        anything is returned, append it to the list of rules.
  1.3960 +
  1.3961 +       <dt>anything else
  1.3962 +
  1.3963 +       <dd> <a href="#reconsume-the-current-input-token"><i>Reconsume the
  1.3964 +        current input token</i></a>. <a
  1.3965 +        href="#consume-a-qualified-rule0"><i>Consume a qualified
  1.3966 +        rule</i></a>. If anything is returned, append it to the list of
  1.3967 +        rules.
  1.3968 +      </dl>
  1.3969 +
  1.3970 +      <h4 id=consume-an-at-rule><span class=secno>5.4.2. </span> <dfn
  1.3971 +       id=consume-an-at-rule0>Consume an at-rule</dfn></h4>
  1.3972 +
  1.3973 +      <p> Create a new at-rule with its name set to the value of the <a
  1.3974 +       href="#current-input-token"><i>current input token</i></a>, its
  1.3975 +       prelude initially set to an empty list, and its value initially set to
  1.3976 +       nothing.
  1.3977 +
  1.3978 +      <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.3979 +       token</i></a>:
  1.3980 +
  1.3981 +      <dl>
  1.3982 +       <dt>〈semicolon〉
  1.3983 +
  1.3984 +       <dt>〈EOF〉
  1.3985 +
  1.3986 +       <dd> Return the at-rule.
  1.3987 +
  1.3988 +       <dt>〈{〉
  1.3989 +
  1.3990 +       <dd> <a href="#consume-a-simple-block0"><i>Consume a simple
  1.3991 +        block</i></a> and assign it to the at-rule's block. Return the
  1.3992 +        at-rule.
  1.3993 +
  1.3994 +       <dt><a href="#simple-block"><i>simple block</i></a> with an associated
  1.3995 +        token of 〈{〉
  1.3996 +
  1.3997 +       <dd> Assign the block to the at-rule's block. Return the at-rule.
  1.3998 +
  1.3999 +       <dt>anything else
  1.4000 +
  1.4001 +       <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.4002 +        value</i></a>. Append the returned value to the at-rule's prelude.
  1.4003 +      </dl>
  1.4004 +
  1.4005 +      <h4 id=consume-a-qualified-rule><span class=secno>5.4.3. </span> <dfn
  1.4006 +       id=consume-a-qualified-rule0>Consume a qualified rule</dfn></h4>
  1.4007 +
  1.4008 +      <p> Create a new qualified rule with its prelude initially set to an
  1.4009 +       empty list, and its value initially set to nothing.
  1.4010 +
  1.4011 +      <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.4012 +       token</i></a>:
  1.4013 +
  1.4014 +      <dl>
  1.4015 +       <dt>〈EOF〉
  1.4016 +
  1.4017 +       <dd> This is a <a href="#parse-errors"><i>parse error</i></a>. Return
  1.4018 +        nothing.
  1.4019 +
  1.4020 +       <dt>〈{〉
  1.4021 +
  1.4022 +       <dd> <a href="#consume-a-simple-block0"><i>Consume a simple
  1.4023 +        block</i></a>. <a href="#consume-a-list-of-declarations0"><i>Consume
  1.4024 +        a list of declarations</i></a> from the block's value. If anything
  1.4025 +        was returned, assign it to the qualified rule's value. Return the
  1.4026 +        qualified rule.
  1.4027 +
  1.4028 +       <dt><a href="#simple-block"><i>simple block</i></a> with an associated
  1.4029 +        token of 〈{〉
  1.4030 +
  1.4031 +       <dd> <a href="#consume-a-list-of-declarations0"><i>Consume a list of
  1.4032 +        declarations</i></a> from the block's value. If anything was
  1.4033 +        returned, assign it to the qualified rule's value. Return the
  1.4034 +        qualified rule.
  1.4035 +
  1.4036 +       <dt>anything else
  1.4037 +
  1.4038 +       <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.4039 +        value</i></a>. Append the returned value to the qualified rule's
  1.4040 +        prelude.
  1.4041 +      </dl>
  1.4042 +
  1.4043 +      <h4 id=consume-a-list-of-declarations><span class=secno>5.4.4. </span>
  1.4044 +       <dfn id=consume-a-list-of-declarations0>Consume a list of
  1.4045 +       declarations</dfn></h4>
  1.4046 +
  1.4047 +      <p> Create an initially empty list of declarations.
  1.4048 +
  1.4049 +      <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.4050 +       token</i></a>:
  1.4051 +
  1.4052 +      <dl>
  1.4053 +       <dt>〈whitespace〉
  1.4054 +
  1.4055 +       <dt>〈semicolon〉
  1.4056 +
  1.4057 +       <dd> Do nothing.
  1.4058 +
  1.4059 +       <dt>〈EOF〉
  1.4060 +
  1.4061 +       <dd> Return the list of declarations.
  1.4062 +
  1.4063 +       <dt>〈at-keyword〉
  1.4064 +
  1.4065 +       <dd> <a href="#consume-an-at-rule0"><i>Consume an at-rule</i></a>.
  1.4066 +        Append the returned rule to the list of declarations.
  1.4067 +
  1.4068 +       <dt>〈ident〉
  1.4069 +
  1.4070 +       <dd> Initialize a temporary list initially filled with the <a
  1.4071 +        href="#current-input-token"><i>current input token</i></a>.
  1.4072 +        Repeatedly <a href="#consume-a-component-value0"><i>consume a
  1.4073 +        component value</i></a> from the <a href="#next-input-token"><i>next
  1.4074 +        input token</i></a> until a 〈semicolon〉 or 〈EOF〉 is returned,
  1.4075 +        appending all of the returned values up to that point to the
  1.4076 +        temporary list. <a href="#consume-a-declaration0"><i>Consume a
  1.4077 +        declaration</i></a> from the temporary list. If anything was
  1.4078 +        returned, append it to the list of declarations.
  1.4079 +
  1.4080 +       <dt>anything else
  1.4081 +
  1.4082 +       <dd> This is a <a href="#parse-errors"><i>parse error</i></a>.
  1.4083 +        Repeatedly <a href="#consume-a-component-value0"><i>consume a
  1.4084 +        component value</i></a> from the <a href="#next-input-token"><i>next
  1.4085 +        input token</i></a> until it is a 〈semicolon〉 or 〈EOF〉.
  1.4086 +      </dl>
  1.4087 +
  1.4088 +      <h4 id=consume-a-declaration><span class=secno>5.4.5. </span> <dfn
  1.4089 +       id=consume-a-declaration0>Consume a declaration</dfn></h4>
  1.4090 +
  1.4091 +      <p> Create a new declaration with its name set to the value of the <a
  1.4092 +       href="#current-input-token"><i>current input token</i></a>.
  1.4093 +
  1.4094 +      <p> Repeatedly consume 〈whitespace〉s until a non-〈whitespace〉
  1.4095 +       is reached. If this token is anything but a 〈colon〉, this is a <a
  1.4096 +       href="#parse-errors"><i>parse error</i></a>. Return nothing.
  1.4097 +
  1.4098 +      <p> Otherwise, repeatedly <a
  1.4099 +       href="#consume-a-component-value0"><i>consume a component
  1.4100 +       value</i></a> from the <a href="#next-input-token"><i>next input
  1.4101 +       token</i></a> until an 〈EOF〉 is reached, appending all of the
  1.4102 +       returned values up to that point to the declaration's value.
  1.4103 +
  1.4104 +      <p> If the last two non-〈whitespace〉s in the declaration's value
  1.4105 +       are a 〈delim〉 with the value "!" followed by an 〈ident〉 with a
  1.4106 +       value that is an <a href="#ascii-case-insensitive"><i>ASCII
  1.4107 +       case-insensitive</i></a> match for "important", remove them from the
  1.4108 +       declaration's value and set the declaration's <var>important</var>
  1.4109 +       flag to true.
  1.4110 +
  1.4111 +      <p> Return the declaration.
  1.4112 +
  1.4113 +      <h4 id=consume-a-component-value><span class=secno>5.4.6. </span> <dfn
  1.4114 +       id=consume-a-component-value0>Consume a component value</dfn></h4>
  1.4115 +
  1.4116 +      <p> This section describes how to <a
  1.4117 +       href="#consume-a-component-value0"><i>consume a component
  1.4118 +       value</i></a>.
  1.4119 +
  1.4120 +      <p> If the <a href="#current-input-token"><i>current input
  1.4121 +       token</i></a> is a 〈{〉, 〈[〉, or 〈(〉, <a
  1.4122 +       href="#consume-a-simple-block0"><i>consume a simple block</i></a> and
  1.4123 +       return it.
  1.4124 +
  1.4125 +      <p> Otherwise, if the <a href="#current-input-token"><i>current input
  1.4126 +       token</i></a> is a 〈function〉, <a
  1.4127 +       href="#consume-a-function0"><i>consume a function</i></a> and return
  1.4128 +       it.
  1.4129 +
  1.4130 +      <p> Otherwise, return the <a href="#current-input-token"><i>current
  1.4131 +       input token</i></a>.
  1.4132 +
  1.4133 +      <h4 id=consume-a-simple-block><span class=secno>5.4.7. </span> <dfn
  1.4134 +       id=consume-a-simple-block0>Consume a simple block</dfn></h4>
  1.4135 +
  1.4136 +      <p> This section describes how to <a
  1.4137 +       href="#consume-a-simple-block0"><i>consume a simple block</i></a>.
  1.4138 +
  1.4139 +      <p> The <dfn id=ending-token>ending token</dfn> is the mirror variant
  1.4140 +       of the <a href="#current-input-token"><i>current input token</i></a>.
  1.4141 +       (E.g. if it was called with 〈[〉, the <a
  1.4142 +       href="#ending-token"><i>ending token</i></a> is 〈]〉.)
  1.4143 +
  1.4144 +      <p> Create a simple block with its associated token set to the <a
  1.4145 +       href="#current-input-token"><i>current input token</i></a>.
  1.4146 +
  1.4147 +      <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.4148 +       token</i></a> and process it as follows:
  1.4149 +
  1.4150 +      <dl>
  1.4151 +       <dt>〈EOF〉
  1.4152 +
  1.4153 +       <dt><a href="#ending-token"><i>ending token</i></a>
  1.4154 +
  1.4155 +       <dd> Return the block.
  1.4156 +
  1.4157 +       <dt>anything else
  1.4158 +
  1.4159 +       <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.4160 +        value</i></a> and append it to the value of the block.
  1.4161 +      </dl>
  1.4162 +
  1.4163 +      <h4 id=consume-a-function><span class=secno>5.4.8. </span> <dfn
  1.4164 +       id=consume-a-function0>Consume a function</dfn></h4>
  1.4165 +
  1.4166 +      <p> This section describes how to <a
  1.4167 +       href="#consume-a-function0"><i>consume a function</i></a>.
  1.4168 +
  1.4169 +      <p> Create a function with a name equal to the value of the <a
  1.4170 +       href="#current-input-token"><i>current input token</i></a>, and with a
  1.4171 +       value which is initially an empty list.
  1.4172 +
  1.4173 +      <p> Repeatedly consume the <a href="#next-input-token"><i>next input
  1.4174 +       token</i></a> and process it as follows:
  1.4175 +
  1.4176 +      <dl>
  1.4177 +       <dt>〈EOF〉
  1.4178 +
  1.4179 +       <dt>〈)〉
  1.4180 +
  1.4181 +       <dd> Return the function.
  1.4182 +
  1.4183 +       <dt>anything else
  1.4184 +
  1.4185 +       <dd> <a href="#consume-a-component-value0"><i>Consume a component
  1.4186 +        value</i></a> and append the returned value to the function's value.
  1.4187 +      </dl>
  1.4188 +
  1.4189 +      <h3 id=changes-from-css-2.1-core-grammar><span class=secno>5.5. </span>
  1.4190 +       Changes from CSS 2.1 Core Grammar</h3>
  1.4191 +
  1.4192 +      <p> <em>This section is non-normative.</em>
  1.4193 +
  1.4194 +      <p class=note> Note that the point of this spec is to match reality;
  1.4195 +       changes from CSS2.1&apos;s Core Grammar are nearly always because the
  1.4196 +       Core Grammar specified something that doesn't match actual browser
  1.4197 +       behavior, or left something unspecified. If some detail doesn't match
  1.4198 +       browsers, please let me know as it's almost certainly unintentional.
  1.4199 +
  1.4200 +      <ol>
  1.4201 +       <li> The handling of some miscellanous "special" tokens (like an
  1.4202 +        unmatched 〈}〉) showing up in various places in the grammar has
  1.4203 +        been specified with some reasonable behavior shown by at least one
  1.4204 +        browser. Previously, stylesheets with those tokens in those places
  1.4205 +        just didn't match the stylesheet grammar at all, so their handling
  1.4206 +        was totally undefined. Specifically:
  1.4207 +        <ul>
  1.4208 +         <li> [] blocks, () blocks and functions can now contain {} blocks,
  1.4209 +          〈at-keyword〉s or semicolons
  1.4210 +
  1.4211 +         <li> Selectors can now contain semicolons
  1.4212 +
  1.4213 +         <li> Selectors and at-rule preludes can now contain
  1.4214 +          〈at-keyword〉s
  1.4215 +        </ul>
  1.4216 +
  1.4217 +       <li> The <a href="#anb0"><var>An+B</var></a> microsyntax has now been
  1.4218 +        formally defined in terms of CSS tokens, rather than with a separate
  1.4219 +        tokenizer. This has resulted in minor differences:
  1.4220 +        <ul>
  1.4221 +         <li> In values starting with "+n", a space is now allowed between
  1.4222 +          the "+" and "n". (This is an accidental consequence of the "+" and
  1.4223 +          "n" parsing as separate CSS tokens, and CSS's value grammar
  1.4224 +          ignoring whitespace.)
  1.4225 +
  1.4226 +         <li> In some cases, "-" characters or digits can be escaped (when
  1.4227 +          they appear as part of the unit of a 〈dimension〉 or
  1.4228 +          〈ident〉).
  1.4229 +        </ul>
  1.4230 +      </ol>
  1.4231 +
  1.4232 +      <h2 id=anb><span class=secno>6. </span> The <a
  1.4233 +       href="#anb0"><var>An+B</var></a> microsyntax</h2>
  1.4234 +
  1.4235 +      <p> Several things in CSS, such as the ‘<code
  1.4236 +       class=css>:nth-child()</code>’ pseudoclass, need to indicate indexes
  1.4237 +       in a list. The <a href="#anb0"><var>An+B</var></a> microsyntax is
  1.4238 +       useful for this, allowing an author to easily indicate single elements
  1.4239 +       or all elements at regularly-spaced intervals in a list.
  1.4240 +
  1.4241 +      <p> The <dfn id=anb0>An+B</dfn> notation defines an integer step (<dfn
  1.4242 +       id=a>A</dfn>) and offset (<dfn id=b>B</dfn>), and represents the <a
  1.4243 +       href="#anb0"><var>An+B</var></a>th elements in a list, for every
  1.4244 +       positive integer or zero value of <var>n</var>, with the first element
  1.4245 +       in the list having index 1 (not 0).
  1.4246 +
  1.4247 +      <p> For values of <a href="#a"><var>A</var></a> and <a
  1.4248 +       href="#b"><var>B</var></a> greater than 0, this effectively divides
  1.4249 +       the list into groups of <a href="#a"><var>A</var></a> elements (the
  1.4250 +       last group taking the remainder), and selecting the <a
  1.4251 +       href="#b"><var>B</var></a>th element of each group.
  1.4252 +
  1.4253 +      <p> The <a href="#anb0"><var>An+B</var></a> notation also accepts the
  1.4254 +       ‘<code class=css>even</code>’ and ‘<code class=css>odd</code>’
  1.4255 +       keywords, which have the same meaning as ‘<code
  1.4256 +       class=css>2n</code>’ and ‘<code class=css>2n+1</code>’,
  1.4257 +       respectively.
  1.4258 +
  1.4259 +      <div class=example>
  1.4260 +       <p>Examples:
  1.4261 +
  1.4262 +       <pre><!--
  1.4263  		-->2n+0   /* represents all of the even elements in the list */
  1.4264  <!--
  1.4265  		-->even   /* same */
  1.4266  <!--
  1.4267  		-->4n+1   /* represents the 1st, 5th, 9th, 13th, etc. elements in the list */</pre>
  1.4268 -  </div>
  1.4269 -
  1.4270 -  <p> The values of <a href="#a"><var>A</var></a> and <a
  1.4271 -   href="#b"><var>B</var></a> can be negative, but only the positive results
  1.4272 -   of <a href="#anb0"><var>An+B</var></a>, for <var>n</var> ≥ 0, are used.
  1.4273 -
  1.4274 -  <div class=example>
  1.4275 -   <p>Example:
  1.4276 -
  1.4277 -   <pre>-n+6   /* represents the first 6 elements of the list */</pre>
  1.4278 -  </div>
  1.4279 -
  1.4280 -  <p> If both <a href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a>
  1.4281 -   are 0, the pseudo-class represents no element in the list.
  1.4282 -
  1.4283 -  <h3 id=anb-syntax><span class=secno>6.1. </span> Informal Syntax
  1.4284 -   Description</h3>
  1.4285 -
  1.4286 -  <p><em>This section is non-normative.</em>
  1.4287 -
  1.4288 -  <p> When <a href="#a"><var>A</var></a> is 0, the <var>An</var> part may be
  1.4289 -   omitted (unless the <a href="#b"><var>B</var></a> part is already
  1.4290 -   omitted). When <var>An</var> is not included and <a
  1.4291 -   href="#b"><var>B</var></a> is non-negative, the ‘<code
  1.4292 -   class=css>+</code>’ sign before <a href="#b"><var>B</var></a> (when
  1.4293 -   allowed) may also be omitted. In this case the syntax simplifies to just
  1.4294 -   <a href="#b"><var>B</var></a>.
  1.4295 -
  1.4296 -  <div class=example>
  1.4297 -   <p>Examples:
  1.4298 -
  1.4299 -   <pre><!--
  1.4300 +      </div>
  1.4301 +
  1.4302 +      <p> The values of <a href="#a"><var>A</var></a> and <a
  1.4303 +       href="#b"><var>B</var></a> can be negative, but only the positive
  1.4304 +       results of <a href="#anb0"><var>An+B</var></a>, for <var>n</var> ≥
  1.4305 +       0, are used.
  1.4306 +
  1.4307 +      <div class=example>
  1.4308 +       <p>Example:
  1.4309 +
  1.4310 +       <pre>-n+6   /* represents the first 6 elements of the list */</pre>
  1.4311 +      </div>
  1.4312 +
  1.4313 +      <p> If both <a href="#a"><var>A</var></a> and <a
  1.4314 +       href="#b"><var>B</var></a> are 0, the pseudo-class represents no
  1.4315 +       element in the list.
  1.4316 +
  1.4317 +      <h3 id=anb-syntax><span class=secno>6.1. </span> Informal Syntax
  1.4318 +       Description</h3>
  1.4319 +
  1.4320 +      <p><em>This section is non-normative.</em>
  1.4321 +
  1.4322 +      <p> When <a href="#a"><var>A</var></a> is 0, the <var>An</var> part may
  1.4323 +       be omitted (unless the <a href="#b"><var>B</var></a> part is already
  1.4324 +       omitted). When <var>An</var> is not included and <a
  1.4325 +       href="#b"><var>B</var></a> is non-negative, the ‘<code
  1.4326 +       class=css>+</code>’ sign before <a href="#b"><var>B</var></a> (when
  1.4327 +       allowed) may also be omitted. In this case the syntax simplifies to
  1.4328 +       just <a href="#b"><var>B</var></a>.
  1.4329 +
  1.4330 +      <div class=example>
  1.4331 +       <p>Examples:
  1.4332 +
  1.4333 +       <pre><!--
  1.4334  		-->0n+5   /* represents the 5th element in the list */
  1.4335  <!--
  1.4336  		-->5      /* same */</pre>
  1.4337 -  </div>
  1.4338 -
  1.4339 -  <p> When <a href="#a"><var>A</var></a> is 1 or -1, the <code>1</code> may
  1.4340 -   be omitted from the rule.
  1.4341 -
  1.4342 -  <div class=example>
  1.4343 -   <p>Examples:
  1.4344 -
  1.4345 -   <p>The following notations are therefore equivalent:
  1.4346 -
  1.4347 -   <pre><!--
  1.4348 +      </div>
  1.4349 +
  1.4350 +      <p> When <a href="#a"><var>A</var></a> is 1 or -1, the <code>1</code>
  1.4351 +       may be omitted from the rule.
  1.4352 +
  1.4353 +      <div class=example>
  1.4354 +       <p>Examples:
  1.4355 +
  1.4356 +       <p>The following notations are therefore equivalent:
  1.4357 +
  1.4358 +       <pre><!--
  1.4359  		-->1n+0   /* represents all elements in the list */
  1.4360  <!--
  1.4361  		-->n+0    /* same */
  1.4362  <!--
  1.4363  		-->n      /* same */</pre>
  1.4364 -  </div>
  1.4365 -
  1.4366 -  <p> If <a href="#b"><var>B</var></a> is 0, then every <a
  1.4367 -   href="#a"><var>A</var></a>th element is picked. In such a case, the <a
  1.4368 -   href="#b"><var>+B</var></a> (or <var>-B</var>) part may be omitted unless
  1.4369 -   the <a href="#a"><var>A</var></a> part is already omitted.
  1.4370 -
  1.4371 -  <div class=example>
  1.4372 -   <p>Examples:
  1.4373 -
  1.4374 -   <pre><!--
  1.4375 +      </div>
  1.4376 +
  1.4377 +      <p> If <a href="#b"><var>B</var></a> is 0, then every <a
  1.4378 +       href="#a"><var>A</var></a>th element is picked. In such a case, the <a
  1.4379 +       href="#b"><var>+B</var></a> (or <var>-B</var>) part may be omitted
  1.4380 +       unless the <a href="#a"><var>A</var></a> part is already omitted.
  1.4381 +
  1.4382 +      <div class=example>
  1.4383 +       <p>Examples:
  1.4384 +
  1.4385 +       <pre><!--
  1.4386  		-->2n+0   /* represents every even element in the list */
  1.4387  <!--
  1.4388  		-->2n     /* same */</pre>
  1.4389 -  </div>
  1.4390 -
  1.4391 -  <p> Whitespace is permitted on either side of the ‘<code
  1.4392 -   class=css>+</code>’ or ‘<code class=css>-</code>’ that separates the
  1.4393 -   <var>An</var> and <a href="#b"><var>B</var></a> parts when both are
  1.4394 -   present.
  1.4395 -
  1.4396 -  <div class=example>
  1.4397 -   <p>Valid Examples with white space:
  1.4398 -
  1.4399 -   <pre><!--
  1.4400 +      </div>
  1.4401 +
  1.4402 +      <p> Whitespace is permitted on either side of the ‘<code
  1.4403 +       class=css>+</code>’ or ‘<code class=css>-</code>’ that separates
  1.4404 +       the <var>An</var> and <a href="#b"><var>B</var></a> parts when both
  1.4405 +       are present.
  1.4406 +
  1.4407 +      <div class=example>
  1.4408 +       <p>Valid Examples with white space:
  1.4409 +
  1.4410 +       <pre><!--
  1.4411  		-->3n + 1
  1.4412  <!--
  1.4413  		-->+3n - 2
  1.4414 @@ -3834,418 +3525,431 @@
  1.4415  <!--
  1.4416  		-->+6</pre>
  1.4417  
  1.4418 -   <p>Invalid Examples with white space:
  1.4419 -
  1.4420 -   <pre><!--
  1.4421 +       <p>Invalid Examples with white space:
  1.4422 +
  1.4423 +       <pre><!--
  1.4424  		-->3 n
  1.4425  <!--
  1.4426  		-->+ 2n
  1.4427  <!--
  1.4428  		-->+ 2</pre>
  1.4429 -  </div>
  1.4430 -
  1.4431 -  <h3 id=the-anb-type><span class=secno>6.2. </span> The <a
  1.4432 -   href="#anb-production"><code>&lt;an+b></code></a> type</h3>
  1.4433 -
  1.4434 -  <p> The <a href="#anb0"><var>An+B</var></a> notation was originally defined
  1.4435 -   using a slightly different tokenizer than the rest of CSS, resulting in a
  1.4436 -   somewhat odd definition when expressed in terms of CSS tokens. This
  1.4437 -   section describes how to recognize the <a href="#anb0"><var>An+B</var></a>
  1.4438 -   notation in terms of CSS tokens (thus defining the <a
  1.4439 -   href="#anb-production"><var>&lt;an+b></var></a> type for CSS grammar
  1.4440 -   purposes), and how to interpret the CSS tokens to obtain values for <a
  1.4441 -   href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a>.
  1.4442 -
  1.4443 -  <p> The <a href="#anb-production"><var>&lt;an+b></var></a> type is defined
  1.4444 -   (using the <a href="http://www.w3.org/TR/css3-values/#value-defs">Value
  1.4445 -   Definition Syntax in the Values &amp; Units spec</a>) as:
  1.4446 -
  1.4447 -  <pre class=prod>
  1.4448 +      </div>
  1.4449 +
  1.4450 +      <h3 id=the-anb-type><span class=secno>6.2. </span> The <a
  1.4451 +       href="#anb-production"><code>&lt;an+b></code></a> type</h3>
  1.4452 +
  1.4453 +      <p> The <a href="#anb0"><var>An+B</var></a> notation was originally
  1.4454 +       defined using a slightly different tokenizer than the rest of CSS,
  1.4455 +       resulting in a somewhat odd definition when expressed in terms of CSS
  1.4456 +       tokens. This section describes how to recognize the <a
  1.4457 +       href="#anb0"><var>An+B</var></a> notation in terms of CSS tokens (thus
  1.4458 +       defining the <a href="#anb-production"><var>&lt;an+b></var></a> type
  1.4459 +       for CSS grammar purposes), and how to interpret the CSS tokens to
  1.4460 +       obtain values for <a href="#a"><var>A</var></a> and <a
  1.4461 +       href="#b"><var>B</var></a>.
  1.4462 +
  1.4463 +      <p> The <a href="#anb-production"><var>&lt;an+b></var></a> type is
  1.4464 +       defined (using the <a
  1.4465 +       href="http://www.w3.org/TR/css3-values/#value-defs">Value Definition
  1.4466 +       Syntax in the Values &amp; Units spec</a>) as:
  1.4467 +
  1.4468 +      <pre class=prod>
  1.4469  <dfn id=anb-production>&lt;an+b></dfn> =
  1.4470    odd | even |
  1.4471    <a
  1.4472 -   href="#ltinteger"><var>&lt;integer></var></a> |
  1.4473 +       href="#ltinteger"><var>&lt;integer></var></a> |
  1.4474  
  1.4475    <a
  1.4476 -   href="#ltn-dimension"><var>&lt;n-dimension></var></a> |
  1.4477 +       href="#ltn-dimension"><var>&lt;n-dimension></var></a> |
  1.4478    '+'? n |
  1.4479    -n |
  1.4480  
  1.4481    <a
  1.4482 -   href="#ltndashdigit-dimension"><var>&lt;ndashdigit-dimension></var></a> |
  1.4483 +       href="#ltndashdigit-dimension"><var>&lt;ndashdigit-dimension></var></a> |
  1.4484    '+'? <a
  1.4485 -   href="#ltndashdigit-ident"><var>&lt;ndashdigit-ident></var></a> |
  1.4486 +       href="#ltndashdigit-ident"><var>&lt;ndashdigit-ident></var></a> |
  1.4487    <a
  1.4488 -   href="#ltdashndashdigit-ident"><var>&lt;dashndashdigit-ident></var></a> |
  1.4489 +       href="#ltdashndashdigit-ident"><var>&lt;dashndashdigit-ident></var></a> |
  1.4490  
  1.4491    <a
  1.4492 -   href="#ltn-dimension"><var>&lt;n-dimension></var></a> <a
  1.4493 -   href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
  1.4494 +       href="#ltn-dimension"><var>&lt;n-dimension></var></a> <a
  1.4495 +       href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
  1.4496    '+'? n <a
  1.4497 -   href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
  1.4498 +       href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
  1.4499    -n <a
  1.4500 -   href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
  1.4501 +       href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
  1.4502  
  1.4503    <a
  1.4504 -   href="#ltn-dimension"><var>&lt;n-dimension></var></a> ['+' | '-'] <a
  1.4505 -   href="#ltsignless-integer"><var>&lt;signless-integer></var></a>
  1.4506 +       href="#ltn-dimension"><var>&lt;n-dimension></var></a> ['+' | '-'] <a
  1.4507 +       href="#ltsignless-integer"><var>&lt;signless-integer></var></a>
  1.4508    '+'? n ['+' | '-'] <a
  1.4509 -   href="#ltsignless-integer"><var>&lt;signless-integer></var></a> |
  1.4510 +       href="#ltsignless-integer"><var>&lt;signless-integer></var></a> |
  1.4511    -n ['+' | '-'] <a
  1.4512 -   href="#ltsignless-integer"><var>&lt;signless-integer></var></a></pre>
  1.4513 -
  1.4514 -  <p> where:
  1.4515 -
  1.4516 -  <ul>
  1.4517 -   <li><dfn id=ltn-dimension><code>&lt;n-dimension></code></dfn> is a
  1.4518 -    〈dimension〉 with its type flag set to "integer", and a unit that is
  1.4519 -    an <a href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a>
  1.4520 -    match for "n"
  1.4521 -
  1.4522 -   <li><dfn
  1.4523 -    id=ltndashdigit-dimension><code>&lt;ndashdigit-dimension></code></dfn> is
  1.4524 -    a 〈dimension〉 with its type flag set to "integer", and a unit that is
  1.4525 -    an <a href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a>
  1.4526 -    match for "n-*", where "*" is a series of one or more <a
  1.4527 -    href="#digit"><i>digits</i></a>
  1.4528 -
  1.4529 -   <li><dfn id=ltndashdigit-ident><code>&lt;ndashdigit-ident></code></dfn> is
  1.4530 -    an 〈ident〉 whose representation is an <a
  1.4531 -    href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match
  1.4532 -    for "n-*", where "*" is a series of one or more <a
  1.4533 -    href="#digit"><i>digits</i></a>
  1.4534 -
  1.4535 -   <li><dfn
  1.4536 -    id=ltdashndashdigit-ident><code>&lt;dashndashdigit-ident></code></dfn> is
  1.4537 -    an 〈ident〉 whose representation is an <a
  1.4538 -    href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match
  1.4539 -    for "-n-*", where "*" is a series of one or more <a
  1.4540 -    href="#digit"><i>digits</i></a>
  1.4541 -
  1.4542 -   <li><dfn id=ltinteger><code>&lt;integer></code></dfn> is a 〈number〉
  1.4543 -    with its type flag set to "integer"
  1.4544 -
  1.4545 -   <li><dfn id=ltsigned-integer><code>&lt;signed-integer></code></dfn> is a
  1.4546 -    〈number〉 with its type flag set to "integer", and whose
  1.4547 -    representation starts with "+" or "-"
  1.4548 -
  1.4549 -   <li><dfn id=ltsignless-integer><code>&lt;signless-integer></code></dfn> is
  1.4550 -    a 〈number〉 with its type flag set to "integer", and whose
  1.4551 -    representation start with a <a href="#digit"><i>digit</i></a>
  1.4552 -  </ul>
  1.4553 -
  1.4554 -  <p> The clauses of the production are interpreted as follows:
  1.4555 -
  1.4556 -  <dl>
  1.4557 -   <dt>‘<code class=css>odd</code>’
  1.4558 -
  1.4559 -   <dd> <a href="#a"><var>A</var></a> is 2, <a href="#b"><var>B</var></a> is
  1.4560 -    1.
  1.4561 -
  1.4562 -   <dt>‘<code class=css>even</code>’
  1.4563 -
  1.4564 -   <dd> <a href="#a"><var>A</var></a> is 2, <a href="#b"><var>B</var></a> is
  1.4565 -    0.
  1.4566 -
  1.4567 -   <dt><a href="#ltinteger"><code><var>&lt;integer></var></code></a>
  1.4568 -
  1.4569 -   <dd> <a href="#a"><var>A</var></a> is 0, <a href="#b"><var>B</var></a> is
  1.4570 -    the integer.
  1.4571 -
  1.4572 -   <dt><a href="#ltn-dimension"><code><var>&lt;n-dimension></var></code></a>
  1.4573 -
  1.4574 -   <dt><code>'+'? n</code>
  1.4575 -
  1.4576 -   <dt><code>-n</code>
  1.4577 -
  1.4578 -   <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4579 -    respectively. <a href="#b"><var>B</var></a> is 0.
  1.4580 -
  1.4581 -   <dt><a
  1.4582 -    href="#ltndashdigit-dimension"><code><var>&lt;ndashdigit-dimension></var></code></a>
  1.4583 -
  1.4584 -   <dt><code>'+'? <a
  1.4585 -    href="#ltndashdigit-ident"><var>&lt;ndashdigit-ident></var></a></code>
  1.4586 -
  1.4587 -   <dt><a
  1.4588 -    href="#ltdashndashdigit-ident"><code><var>&lt;dashndashdigit-ident></var></code></a>
  1.4589 -
  1.4590 -   <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4591 -    respectively. <a href="#b"><var>B</var></a> is the dimension's unit or
  1.4592 -    ident's representation, as appropriate, with the first two characters
  1.4593 -    removed and the remainder interpreted as a base-10 number.
  1.4594 -
  1.4595 -   <dt><code><a href="#ltn-dimension"><var>&lt;n-dimension></var></a> <a
  1.4596 -    href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
  1.4597 -
  1.4598 -   <dt><code>'+'? n <a
  1.4599 -    href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
  1.4600 -
  1.4601 -   <dt><code>-n <a
  1.4602 -    href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
  1.4603 -
  1.4604 -   <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4605 -    respectively. <a href="#b"><var>B</var></a> is the integer.
  1.4606 -
  1.4607 -   <dt><code><a href="#ltn-dimension"><var>&lt;n-dimension></var></a> ['+' |
  1.4608 -    '-'] <a
  1.4609 -    href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
  1.4610 -
  1.4611 -   <dt><code>'+'? n ['+' | '-'] <a
  1.4612 -    href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
  1.4613 -
  1.4614 -   <dt><code>-n ['+' | '-'] <a
  1.4615 -    href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
  1.4616 -
  1.4617 -   <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4618 -    respectively. <a href="#b"><var>B</var></a> is the integer. If a ‘<code
  1.4619 -    class=property>-</code>’ was provided between the two, <a
  1.4620 -    href="#b"><var>B</var></a> is instead the negation of the integer.
  1.4621 -  </dl>
  1.4622 -
  1.4623 -  <h2 id=rule-defs><span class=secno>7. </span> Defining Grammars for Rules
  1.4624 -   and Other Values</h2>
  1.4625 -
  1.4626 -  <p> The <a href="http://www.w3.org/TR/css3-values/">Values</a> spec defines
  1.4627 -   how to specify a grammar for properties. This section does the same, but
  1.4628 -   for rules.
  1.4629 -
  1.4630 -  <p> Just like in property grammars, the notation <code>&lt;foo></code>
  1.4631 -   refers to the "foo" grammar term, assumed to be defined elsewhere.
  1.4632 -   Substituting the <code>&lt;foo></code> for its definition results in a
  1.4633 -   semantically identical grammar.
  1.4634 -
  1.4635 -  <p> Several types of tokens are written literally, without quotes:
  1.4636 -
  1.4637 -  <ul>
  1.4638 -   <li>〈Ident〉s (such as ‘<code class=css>auto</code>’, ‘<code
  1.4639 -    class=css>disc</code>’, etc.)
  1.4640 -
  1.4641 -   <li>〈at-keyword〉s, which are written as an @ character followed by the
  1.4642 -    token's name, like "@media".
  1.4643 -
  1.4644 -   <li>〈function〉s, which are written as the function name followed by a
  1.4645 -    ( character, like "translate(".
  1.4646 -
  1.4647 -   <li>The 〈colon〉 (written as <code>:</code>), 〈comma〉 (written as
  1.4648 -    <code>,</code>), 〈semicolon〉 (written as <code>;</code>), 〈(〉,
  1.4649 -    〈)〉, 〈{〉, and 〈}〉s.
  1.4650 -  </ul>
  1.4651 -
  1.4652 -  <p> 〈delim〉s are written with their value enclosed in single quotes.
  1.4653 -   For example, a 〈delim〉 containing the "+" character is written as
  1.4654 -   <code>'+'</code>. Similarly, the 〈[〉 and 〈]〉s must be written in
  1.4655 -   single quotes, as they're used by the syntax of the grammar itself to
  1.4656 -   group clauses. 〈whitespace〉 is never indicated in the grammar;
  1.4657 -   〈whitespace〉s are allowed before, after, and between any two tokens,
  1.4658 -   unless explicitly specified otherwise in prose definitions. (For example,
  1.4659 -   if the prelude of a rule is a selector, whitespace is significant.)
  1.4660 -
  1.4661 -  <p> When defining a function or a block, the ending token must be specified
  1.4662 -   in the grammar, but if it's not present in the eventual token stream, it
  1.4663 -   still matches.
  1.4664 -
  1.4665 -  <div class=example> For example, the syntax of the ‘<code
  1.4666 -   class=css>translateX()</code>’ function is:
  1.4667 -   <pre>translateX( &lt;translation-value> )</pre>
  1.4668 -
  1.4669 -   <p> However, the stylesheet may end with the function unclosed, like:
  1.4670 -
  1.4671 -   <pre>.foo { transform: translate(50px</pre>
  1.4672 -
  1.4673 -   <p> The CSS parser parses this as a style rule containing one declaration,
  1.4674 -    whose value is a function named "translate". This matches the above
  1.4675 -    grammar, even though the ending token didn't appear in the token stream,
  1.4676 -    because by the time the parser is finished, the presence of the ending
  1.4677 -    token is no longer possible to determine; all you have is the fact that
  1.4678 -    there's a block and a function.
  1.4679 -  </div>
  1.4680 -
  1.4681 -  <h3 id=declaration-rule-list><span class=secno>7.1. </span> Defining Block
  1.4682 -   Contents: the <a
  1.4683 -   href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>, <a
  1.4684 -   href="#ltrule-list"><var>&lt;rule-list></var></a>, and <a
  1.4685 -   href="#ltstylesheet"><var>&lt;stylesheet></var></a> productions</h3>
  1.4686 -
  1.4687 -  <p> The CSS parser is agnostic as to the contents of blocks, such as those
  1.4688 -   that come at the end of some at-rules. Defining the generic grammar of the
  1.4689 -   blocks in terms of tokens is non-trivial, but there are dedicated and
  1.4690 -   unambiguous algorithms defined for parsing this.
  1.4691 -
  1.4692 -  <p> The <dfn id=ltdeclaration-list><var>&lt;declaration-list></var></dfn>
  1.4693 -   production represents a list of declarations. It may only be used in
  1.4694 -   grammars as the sole value in a block, and represents that the contents of
  1.4695 -   the block must be parsed using the <a
  1.4696 -   href="#consume-a-list-of-declarations0"><i>consume a list of
  1.4697 -   declarations</i></a> algorithm.
  1.4698 -
  1.4699 -  <p> Similarly, the <dfn id=ltrule-list><var>&lt;rule-list></var></dfn>
  1.4700 -   production represents a list of rules, and may only be used in grammars as
  1.4701 -   the sole value in a block. It represents that the contents of the block
  1.4702 -   must be parsed using the <a href="#consume-a-list-of-rules0"><i>consume a
  1.4703 -   list of rules</i></a> algorithm.
  1.4704 -
  1.4705 -  <p> Finally, the <dfn id=ltstylesheet><var>&lt;stylesheet></var></dfn>
  1.4706 -   production represents a list of rules. It is identical to <a
  1.4707 -   href="#ltrule-list"><var>&lt;rule-list></var></a>, except that blocks
  1.4708 -   using it default to accepting all rules that aren't otherwise limited to a
  1.4709 -   particular context.
  1.4710 -
  1.4711 -  <div class=example> For example, the ‘<code
  1.4712 -   class=css>@font-face</code>’ rule is defined to have an empty prelude,
  1.4713 -   and to contain a list of declarations. This is expressed with the
  1.4714 -   following grammar:
  1.4715 -   <pre>@font-face { &lt;declaration-list> }</pre>
  1.4716 -
  1.4717 -   <p> This is a complete and sufficient definition of the rule's grammar.
  1.4718 -
  1.4719 -   <p> For another example, ‘<code class=css>@keyframes</code>’ rules are
  1.4720 -    more complex, interpreting their prelude as a name and containing
  1.4721 -    keyframes rules in their block Their grammar is:
  1.4722 -
  1.4723 -   <pre>@keyframes &lt;keyframes-name> { &lt;rule-list> }</pre>
  1.4724 -  </div>
  1.4725 -
  1.4726 -  <p> For rules that use <a
  1.4727 -   href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>, the spec
  1.4728 -   for the rule must define which properties, descriptors, and/or at-rules
  1.4729 -   are valid inside the rule; this may be as simple as saying "The @foo rule
  1.4730 -   accepts the properties/descriptors defined in this
  1.4731 -   specification/section.", and extension specs may simply say "The @foo rule
  1.4732 -   additionally accepts the following properties/descriptors.". Any
  1.4733 -   declarations or at-rules found inside the block that are not defined as
  1.4734 -   valid must be removed from the rule's value.
  1.4735 -
  1.4736 -  <p> Within a <a
  1.4737 -   href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>,
  1.4738 -   <code>!important</code> is automatically invalid on any descriptors. If
  1.4739 -   the rule accepts properties, the spec for the rule must define whether the
  1.4740 -   properties interact with the cascade, and with what specificity. If they
  1.4741 -   don't interact with the cascade, properties containing
  1.4742 -   <code>!important</code> are automatically invalid; otherwise using
  1.4743 -   <code>!important</code> is valid and has its usual effect on the cascade
  1.4744 -   origin of the property.
  1.4745 -
  1.4746 -  <div class=example> For example, the grammar for ‘<code
  1.4747 -   class=css>@font-face</code>’ in the previous example must, in addition
  1.4748 -   to what is written there, define that the allowed declarations are the
  1.4749 -   descriptors defined in the Fonts spec.</div>
  1.4750 -
  1.4751 -  <p> For rules that use <a
  1.4752 -   href="#ltrule-list"><var>&lt;rule-list></var></a>, the spec for the rule
  1.4753 -   must define what types of rules are valid inside the rule, same as <a
  1.4754 -   href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>, and
  1.4755 -   unrecognized rules must similarly be removed from the rule's value.
  1.4756 -
  1.4757 -  <div class=example> For example, the grammar for ‘<code
  1.4758 -   class=css>@keyframes</code>’ in the previous example must, in addition
  1.4759 -   to what is written there, define that the only allowed rules are
  1.4760 -   <var>&lt;keyframe-rule></var>s, which are defined as:
  1.4761 -   <pre>&lt;keyframe-rule> = &lt;keyframe-selector> { &lt;declaration-list> }</pre>
  1.4762 -
  1.4763 -   <p> Keyframe rules, then, must further define that they accept as
  1.4764 -    declarations all animatable CSS properties, plus the ‘<code
  1.4765 -    class=property>animation-timing-function</code>’ property, but that
  1.4766 -    they do not interact with the cascade.
  1.4767 -  </div>
  1.4768 -
  1.4769 -  <p> For rules that use <a
  1.4770 -   href="#ltstylesheet"><var>&lt;stylesheet></var></a>, all rules are allowed
  1.4771 -   by default, but the spec for the rule may define what types of rules are
  1.4772 -   <em>invalid</em> inside the rule.
  1.4773 -
  1.4774 -  <div class=example> For example, the ‘<code class=css>@media</code>’
  1.4775 -   rule accepts anything that can be placed in a stylesheet, except more
  1.4776 -   ‘<code class=css>@media</code>’ rules. As such, its grammar is:
  1.4777 -   <pre>@media &lt;media-query-list> { &lt;stylesheet> }</pre>
  1.4778 -
  1.4779 -   <p> It additionally defines a restriction that the <a
  1.4780 -    href="#ltstylesheet"><var>&lt;stylesheet></var></a> can not contain
  1.4781 -    ‘<code class=css>@media</code>’ rules, which causes them to be
  1.4782 -    dropped from the outer rule's value if they appear.
  1.4783 -  </div>
  1.4784 -
  1.4785 -  <h2 id=serialization><span class=secno>8. </span>Serialization</h2>
  1.4786 -
  1.4787 -  <p> This specification does not define how to serialize CSS in general,
  1.4788 -   leaving that task to the CSSOM and individual feature specifications.
  1.4789 -   However, there is one important facet that must be specified here
  1.4790 -   regarding comments, to ensure accurate "round-tripping" of data from text
  1.4791 -   to CSS objects and back.
  1.4792 -
  1.4793 -  <p> The tokenizer described in this specification does not produce tokens
  1.4794 -   for comments, or otherwise preserve them in any way. Implementations may
  1.4795 -   preserve the contents of comments and their location in the token stream.
  1.4796 -   If they do, this preserved information must have no effect on the parsing
  1.4797 -   step, but must be serialized in its position as "/*" followed by its
  1.4798 -   contents followed by "*/".
  1.4799 -
  1.4800 -  <p> If the implementation does not preserve comments, it must insert the
  1.4801 -   text "/**/" between the serialization of adjacent tokens when the two
  1.4802 -   tokens are of the following pairs:
  1.4803 -
  1.4804 -  <ul>
  1.4805 -   <li> a 〈hash〉 or 〈at-keyword〉 followed by a 〈number〉,
  1.4806 -    〈percentage〉, 〈ident〉, 〈dimension〉, 〈unicode-range〉,
  1.4807 -    〈url〉, or a 〈function〉 token;
  1.4808 -
  1.4809 -   <li> 〈number〉s, 〈ident〉s, and 〈dimension〉s in any combination;
  1.4810 -
  1.4811 -   <li> a 〈number〉, 〈ident〉, or 〈dimension〉 followed by a
  1.4812 -    〈percentage〉, 〈unicode-range〉, 〈url〉, or 〈function〉;
  1.4813 -
  1.4814 -   <li> an 〈ident〉 followed by a 〈(〉;
  1.4815 -
  1.4816 -   <li> a 〈delim〉 containing "#" or "@" followed by any token except
  1.4817 -    〈whitespace〉;
  1.4818 -
  1.4819 -   <li> a 〈delim〉 containing "-", "+", ".", "&lt;", ">", or "!" following
  1.4820 -    or followed by any token except 〈whitespace〉;
  1.4821 -
  1.4822 -   <li> a 〈delim〉 containing "/" following or followed by a 〈delim〉
  1.4823 -    containing "*".
  1.4824 -  </ul>
  1.4825 -
  1.4826 -  <p class=note> The preceding pairs of tokens can only be adjacent due to
  1.4827 -   comments in the original text, so the above rule reinserts the minimum
  1.4828 -   number of comments into the serialized text to ensure an accurate
  1.4829 -   round-trip. (Roughly. The 〈delim〉 rules are slightly too powerful, for
  1.4830 -   simplicity.)
  1.4831 -
  1.4832 -  <h3 id=serializing-anb><span class=secno>8.1. </span> Serializing <a
  1.4833 -   href="#anb-production"><var>&lt;an+b></var></a></h3>
  1.4834 -
  1.4835 -  <p> To serialize an <a href="#anb-production"><var>&lt;an+b></var></a>
  1.4836 -   value, let <var>s</var> initially be the empty string:
  1.4837 -
  1.4838 -  <dl>
  1.4839 -   <dt><a href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a> are
  1.4840 -    both zero
  1.4841 -
  1.4842 -   <dd> Append "0" to <var>s</var>.
  1.4843 -
  1.4844 -   <dt><a href="#a"><var>A</var></a> is zero, <a href="#b"><var>B</var></a>
  1.4845 -    is non-zero
  1.4846 -
  1.4847 -   <dd> Serialize <a href="#b"><var>B</var></a> and append it to
  1.4848 -    <var>s</var>.
  1.4849 -
  1.4850 -   <dt><a href="#a"><var>A</var></a> is non-zero, <a
  1.4851 -    href="#b"><var>B</var></a> is zero
  1.4852 -
  1.4853 -   <dd> Serialize <a href="#a"><var>A</var></a> and append it to
  1.4854 -    <var>s</var>. Append "n" to <var>s</var>.
  1.4855 -
  1.4856 -   <dt><a href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a> are
  1.4857 -    both non-zero
  1.4858 -
  1.4859 -   <dd> Serialize <a href="#a"><var>A</var></a> and append it to
  1.4860 -    <var>s</var>. Append "n" to <var>s</var>. If <a
  1.4861 -    href="#b"><var>B</var></a> is positive, append "+" to <var>s</var>
  1.4862 -    Serialize <a href="#b"><var>B</var></a> and append it to <var>s</var>.
  1.4863 -  </dl>
  1.4864 -
  1.4865 -  <p> Return <var>s</var>. <!--
  1.4866 +       href="#ltsignless-integer"><var>&lt;signless-integer></var></a></pre>
  1.4867 +
  1.4868 +      <p> where:
  1.4869 +
  1.4870 +      <ul>
  1.4871 +       <li><dfn id=ltn-dimension><code>&lt;n-dimension></code></dfn> is a
  1.4872 +        〈dimension〉 with its type flag set to "integer", and a unit that
  1.4873 +        is an <a href="#ascii-case-insensitive"><i>ASCII
  1.4874 +        case-insensitive</i></a> match for "n"
  1.4875 +
  1.4876 +       <li><dfn
  1.4877 +        id=ltndashdigit-dimension><code>&lt;ndashdigit-dimension></code></dfn>
  1.4878 +        is a 〈dimension〉 with its type flag set to "integer", and a unit
  1.4879 +        that is an <a href="#ascii-case-insensitive"><i>ASCII
  1.4880 +        case-insensitive</i></a> match for "n-*", where "*" is a series of
  1.4881 +        one or more <a href="#digit"><i>digits</i></a>
  1.4882 +
  1.4883 +       <li><dfn
  1.4884 +        id=ltndashdigit-ident><code>&lt;ndashdigit-ident></code></dfn> is an
  1.4885 +        〈ident〉 whose representation is an <a
  1.4886 +        href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a>
  1.4887 +        match for "n-*", where "*" is a series of one or more <a
  1.4888 +        href="#digit"><i>digits</i></a>
  1.4889 +
  1.4890 +       <li><dfn
  1.4891 +        id=ltdashndashdigit-ident><code>&lt;dashndashdigit-ident></code></dfn>
  1.4892 +        is an 〈ident〉 whose representation is an <a
  1.4893 +        href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a>
  1.4894 +        match for "-n-*", where "*" is a series of one or more <a
  1.4895 +        href="#digit"><i>digits</i></a>
  1.4896 +
  1.4897 +       <li><dfn id=ltinteger><code>&lt;integer></code></dfn> is a
  1.4898 +        〈number〉 with its type flag set to "integer"
  1.4899 +
  1.4900 +       <li><dfn id=ltsigned-integer><code>&lt;signed-integer></code></dfn> is
  1.4901 +        a 〈number〉 with its type flag set to "integer", and whose
  1.4902 +        representation starts with "+" or "-"
  1.4903 +
  1.4904 +       <li><dfn
  1.4905 +        id=ltsignless-integer><code>&lt;signless-integer></code></dfn> is a
  1.4906 +        〈number〉 with its type flag set to "integer", and whose
  1.4907 +        representation start with a <a href="#digit"><i>digit</i></a>
  1.4908 +      </ul>
  1.4909 +
  1.4910 +      <p> The clauses of the production are interpreted as follows:
  1.4911 +
  1.4912 +      <dl>
  1.4913 +       <dt>‘<code class=css>odd</code>’
  1.4914 +
  1.4915 +       <dd> <a href="#a"><var>A</var></a> is 2, <a href="#b"><var>B</var></a>
  1.4916 +        is 1.
  1.4917 +
  1.4918 +       <dt>‘<code class=css>even</code>’
  1.4919 +
  1.4920 +       <dd> <a href="#a"><var>A</var></a> is 2, <a href="#b"><var>B</var></a>
  1.4921 +        is 0.
  1.4922 +
  1.4923 +       <dt><a href="#ltinteger"><code><var>&lt;integer></var></code></a>
  1.4924 +
  1.4925 +       <dd> <a href="#a"><var>A</var></a> is 0, <a href="#b"><var>B</var></a>
  1.4926 +        is the integer.
  1.4927 +
  1.4928 +       <dt><a
  1.4929 +        href="#ltn-dimension"><code><var>&lt;n-dimension></var></code></a>
  1.4930 +
  1.4931 +       <dt><code>'+'? n</code>
  1.4932 +
  1.4933 +       <dt><code>-n</code>
  1.4934 +
  1.4935 +       <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4936 +        respectively. <a href="#b"><var>B</var></a> is 0.
  1.4937 +
  1.4938 +       <dt><a
  1.4939 +        href="#ltndashdigit-dimension"><code><var>&lt;ndashdigit-dimension></var></code></a>
  1.4940 +
  1.4941 +       <dt><code>'+'? <a
  1.4942 +        href="#ltndashdigit-ident"><var>&lt;ndashdigit-ident></var></a></code>
  1.4943 +
  1.4944 +       <dt><a
  1.4945 +        href="#ltdashndashdigit-ident"><code><var>&lt;dashndashdigit-ident></var></code></a>
  1.4946 +
  1.4947 +       <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4948 +        respectively. <a href="#b"><var>B</var></a> is the dimension's unit
  1.4949 +        or ident's representation, as appropriate, with the first two
  1.4950 +        characters removed and the remainder interpreted as a base-10 number.
  1.4951 +
  1.4952 +       <dt><code><a href="#ltn-dimension"><var>&lt;n-dimension></var></a> <a
  1.4953 +        href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
  1.4954 +
  1.4955 +       <dt><code>'+'? n <a
  1.4956 +        href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
  1.4957 +
  1.4958 +       <dt><code>-n <a
  1.4959 +        href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
  1.4960 +
  1.4961 +       <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4962 +        respectively. <a href="#b"><var>B</var></a> is the integer.
  1.4963 +
  1.4964 +       <dt><code><a href="#ltn-dimension"><var>&lt;n-dimension></var></a>
  1.4965 +        ['+' | '-'] <a
  1.4966 +        href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
  1.4967 +
  1.4968 +       <dt><code>'+'? n ['+' | '-'] <a
  1.4969 +        href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
  1.4970 +
  1.4971 +       <dt><code>-n ['+' | '-'] <a
  1.4972 +        href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
  1.4973 +
  1.4974 +       <dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
  1.4975 +        respectively. <a href="#b"><var>B</var></a> is the integer. If a
  1.4976 +        ‘<code class=property>-</code>’ was provided between the two, <a
  1.4977 +        href="#b"><var>B</var></a> is instead the negation of the integer.
  1.4978 +      </dl>
  1.4979 +
  1.4980 +      <h2 id=rule-defs><span class=secno>7. </span> Defining Grammars for
  1.4981 +       Rules and Other Values</h2>
  1.4982 +
  1.4983 +      <p> The <a href="http://www.w3.org/TR/css3-values/">Values</a> spec
  1.4984 +       defines how to specify a grammar for properties. This section does the
  1.4985 +       same, but for rules.
  1.4986 +
  1.4987 +      <p> Just like in property grammars, the notation <code>&lt;foo></code>
  1.4988 +       refers to the "foo" grammar term, assumed to be defined elsewhere.
  1.4989 +       Substituting the <code>&lt;foo></code> for its definition results in a
  1.4990 +       semantically identical grammar.
  1.4991 +
  1.4992 +      <p> Several types of tokens are written literally, without quotes:
  1.4993 +
  1.4994 +      <ul>
  1.4995 +       <li>〈Ident〉s (such as ‘<code class=css>auto</code>’, ‘<code
  1.4996 +        class=css>disc</code>’, etc.)
  1.4997 +
  1.4998 +       <li>〈at-keyword〉s, which are written as an @ character followed by
  1.4999 +        the token's name, like "@media".
  1.5000 +
  1.5001 +       <li>〈function〉s, which are written as the function name followed
  1.5002 +        by a ( character, like "translate(".
  1.5003 +
  1.5004 +       <li>The 〈colon〉 (written as <code>:</code>), 〈comma〉 (written
  1.5005 +        as <code>,</code>), 〈semicolon〉 (written as <code>;</code>),
  1.5006 +        〈(〉, 〈)〉, 〈{〉, and 〈}〉s.
  1.5007 +      </ul>
  1.5008 +
  1.5009 +      <p> 〈delim〉s are written with their value enclosed in single
  1.5010 +       quotes. For example, a 〈delim〉 containing the "+" character is
  1.5011 +       written as <code>'+'</code>. Similarly, the 〈[〉 and 〈]〉s must
  1.5012 +       be written in single quotes, as they're used by the syntax of the
  1.5013 +       grammar itself to group clauses. 〈whitespace〉 is never indicated
  1.5014 +       in the grammar; 〈whitespace〉s are allowed before, after, and
  1.5015 +       between any two tokens, unless explicitly specified otherwise in prose
  1.5016 +       definitions. (For example, if the prelude of a rule is a selector,
  1.5017 +       whitespace is significant.)
  1.5018 +
  1.5019 +      <p> When defining a function or a block, the ending token must be
  1.5020 +       specified in the grammar, but if it's not present in the eventual
  1.5021 +       token stream, it still matches.
  1.5022 +
  1.5023 +      <div class=example> For example, the syntax of the ‘<code
  1.5024 +       class=css>translateX()</code>’ function is:
  1.5025 +       <pre>translateX( &lt;translation-value> )</pre>
  1.5026 +
  1.5027 +       <p> However, the stylesheet may end with the function unclosed, like:
  1.5028 +
  1.5029 +       <pre>.foo { transform: translate(50px</pre>
  1.5030 +
  1.5031 +       <p> The CSS parser parses this as a style rule containing one
  1.5032 +        declaration, whose value is a function named "translate". This
  1.5033 +        matches the above grammar, even though the ending token didn't appear
  1.5034 +        in the token stream, because by the time the parser is finished, the
  1.5035 +        presence of the ending token is no longer possible to determine; all
  1.5036 +        you have is the fact that there's a block and a function.
  1.5037 +      </div>
  1.5038 +
  1.5039 +      <h3 id=declaration-rule-list><span class=secno>7.1. </span> Defining
  1.5040 +       Block Contents: the <a
  1.5041 +       href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>, <a
  1.5042 +       href="#ltrule-list"><var>&lt;rule-list></var></a>, and <a
  1.5043 +       href="#ltstylesheet"><var>&lt;stylesheet></var></a> productions</h3>
  1.5044 +
  1.5045 +      <p> The CSS parser is agnostic as to the contents of blocks, such as
  1.5046 +       those that come at the end of some at-rules. Defining the generic
  1.5047 +       grammar of the blocks in terms of tokens is non-trivial, but there are
  1.5048 +       dedicated and unambiguous algorithms defined for parsing this.
  1.5049 +
  1.5050 +      <p> The <dfn
  1.5051 +       id=ltdeclaration-list><var>&lt;declaration-list></var></dfn>
  1.5052 +       production represents a list of declarations. It may only be used in
  1.5053 +       grammars as the sole value in a block, and represents that the
  1.5054 +       contents of the block must be parsed using the <a
  1.5055 +       href="#consume-a-list-of-declarations0"><i>consume a list of
  1.5056 +       declarations</i></a> algorithm.
  1.5057 +
  1.5058 +      <p> Similarly, the <dfn id=ltrule-list><var>&lt;rule-list></var></dfn>
  1.5059 +       production represents a list of rules, and may only be used in
  1.5060 +       grammars as the sole value in a block. It represents that the contents
  1.5061 +       of the block must be parsed using the <a
  1.5062 +       href="#consume-a-list-of-rules0"><i>consume a list of rules</i></a>
  1.5063 +       algorithm.
  1.5064 +
  1.5065 +      <p> Finally, the <dfn id=ltstylesheet><var>&lt;stylesheet></var></dfn>
  1.5066 +       production represents a list of rules. It is identical to <a
  1.5067 +       href="#ltrule-list"><var>&lt;rule-list></var></a>, except that blocks
  1.5068 +       using it default to accepting all rules that aren't otherwise limited
  1.5069 +       to a particular context.
  1.5070 +
  1.5071 +      <div class=example> For example, the ‘<code
  1.5072 +       class=css>@font-face</code>’ rule is defined to have an empty
  1.5073 +       prelude, and to contain a list of declarations. This is expressed with
  1.5074 +       the following grammar:
  1.5075 +       <pre>@font-face { &lt;declaration-list> }</pre>
  1.5076 +
  1.5077 +       <p> This is a complete and sufficient definition of the rule's
  1.5078 +        grammar.
  1.5079 +
  1.5080 +       <p> For another example, ‘<code class=css>@keyframes</code>’ rules
  1.5081 +        are more complex, interpreting their prelude as a name and containing
  1.5082 +        keyframes rules in their block Their grammar is:
  1.5083 +
  1.5084 +       <pre>@keyframes &lt;keyframes-name> { &lt;rule-list> }</pre>
  1.5085 +      </div>
  1.5086 +
  1.5087 +      <p> For rules that use <a
  1.5088 +       href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>, the
  1.5089 +       spec for the rule must define which properties, descriptors, and/or
  1.5090 +       at-rules are valid inside the rule; this may be as simple as saying
  1.5091 +       "The @foo rule accepts the properties/descriptors defined in this
  1.5092 +       specification/section.", and extension specs may simply say "The @foo
  1.5093 +       rule additionally accepts the following properties/descriptors.". Any
  1.5094 +       declarations or at-rules found inside the block that are not defined
  1.5095 +       as valid must be removed from the rule's value.
  1.5096 +
  1.5097 +      <p> Within a <a
  1.5098 +       href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>,
  1.5099 +       <code>!important</code> is automatically invalid on any descriptors.
  1.5100 +       If the rule accepts properties, the spec for the rule must define
  1.5101 +       whether the properties interact with the cascade, and with what
  1.5102 +       specificity. If they don't interact with the cascade, properties
  1.5103 +       containing <code>!important</code> are automatically invalid;
  1.5104 +       otherwise using <code>!important</code> is valid and has its usual
  1.5105 +       effect on the cascade origin of the property.
  1.5106 +
  1.5107 +      <div class=example> For example, the grammar for ‘<code
  1.5108 +       class=css>@font-face</code>’ in the previous example must, in
  1.5109 +       addition to what is written there, define that the allowed
  1.5110 +       declarations are the descriptors defined in the Fonts spec.</div>
  1.5111 +
  1.5112 +      <p> For rules that use <a
  1.5113 +       href="#ltrule-list"><var>&lt;rule-list></var></a>, the spec for the
  1.5114 +       rule must define what types of rules are valid inside the rule, same
  1.5115 +       as <a href="#ltdeclaration-list"><var>&lt;declaration-list></var></a>,
  1.5116 +       and unrecognized rules must similarly be removed from the rule's
  1.5117 +       value.
  1.5118 +
  1.5119 +      <div class=example> For example, the grammar for ‘<code
  1.5120 +       class=css>@keyframes</code>’ in the previous example must, in
  1.5121 +       addition to what is written there, define that the only allowed rules
  1.5122 +       are <var>&lt;keyframe-rule></var>s, which are defined as:
  1.5123 +       <pre>&lt;keyframe-rule> = &lt;keyframe-selector> { &lt;declaration-list> }</pre>
  1.5124 +
  1.5125 +       <p> Keyframe rules, then, must further define that they accept as
  1.5126 +        declarations all animatable CSS properties, plus the ‘<code
  1.5127 +        class=property>animation-timing-function</code>’ property, but that
  1.5128 +        they do not interact with the cascade.
  1.5129 +      </div>
  1.5130 +
  1.5131 +      <p> For rules that use <a
  1.5132 +       href="#ltstylesheet"><var>&lt;stylesheet></var></a>, all rules are
  1.5133 +       allowed by default, but the spec for the rule may define what types of
  1.5134 +       rules are <em>invalid</em> inside the rule.
  1.5135 +
  1.5136 +      <div class=example> For example, the ‘<code
  1.5137 +       class=css>@media</code>’ rule accepts anything that can be placed in
  1.5138 +       a stylesheet, except more ‘<code class=css>@media</code>’ rules.
  1.5139 +       As such, its grammar is:
  1.5140 +       <pre>@media &lt;media-query-list> { &lt;stylesheet> }</pre>
  1.5141 +
  1.5142 +       <p> It additionally defines a restriction that the <a
  1.5143 +        href="#ltstylesheet"><var>&lt;stylesheet></var></a> can not contain
  1.5144 +        ‘<code class=css>@media</code>’ rules, which causes them to be
  1.5145 +        dropped from the outer rule's value if they appear.
  1.5146 +      </div>
  1.5147 +
  1.5148 +      <h2 id=serialization><span class=secno>8. </span>Serialization</h2>
  1.5149 +
  1.5150 +      <p> This specification does not define how to serialize CSS in general,
  1.5151 +       leaving that task to the CSSOM and individual feature specifications.
  1.5152 +       However, there is one important facet that must be specified here
  1.5153 +       regarding comments, to ensure accurate "round-tripping" of data from
  1.5154 +       text to CSS objects and back.
  1.5155 +
  1.5156 +      <p> The tokenizer described in this specification does not produce
  1.5157 +       tokens for comments, or otherwise preserve them in any way.
  1.5158 +       Implementations may preserve the contents of comments and their
  1.5159 +       location in the token stream. If they do, this preserved information
  1.5160 +       must have no effect on the parsing step, but must be serialized in its
  1.5161 +       position as "/*" followed by its contents followed by "*/".
  1.5162 +
  1.5163 +      <p> If the implementation does not preserve comments, it must insert
  1.5164 +       the text "/**/" between the serialization of adjacent tokens when the
  1.5165 +       two tokens are of the following pairs:
  1.5166 +
  1.5167 +      <ul>
  1.5168 +       <li> a 〈hash〉 or 〈at-keyword〉 followed by a 〈number〉,
  1.5169 +        〈percentage〉, 〈ident〉, 〈dimension〉, 〈unicode-range〉,
  1.5170 +        〈url〉, or a 〈function〉 token;
  1.5171 +
  1.5172 +       <li> 〈number〉s, 〈ident〉s, and 〈dimension〉s in any
  1.5173 +        combination;
  1.5174 +
  1.5175 +       <li> a 〈number〉, 〈ident〉, or 〈dimension〉 followed by a
  1.5176 +        〈percentage〉, 〈unicode-range〉, 〈url〉, or 〈function〉;
  1.5177 +
  1.5178 +       <li> an 〈ident〉 followed by a 〈(〉;
  1.5179 +
  1.5180 +       <li> a 〈delim〉 containing "#" or "@" followed by any token except
  1.5181 +        〈whitespace〉;
  1.5182 +
  1.5183 +       <li> a 〈delim〉 containing "-", "+", ".", "&lt;", ">", or "!"
  1.5184 +        following or followed by any token except 〈whitespace〉;
  1.5185 +
  1.5186 +       <li> a 〈delim〉 containing "/" following or followed by a
  1.5187 +        〈delim〉 containing "*".
  1.5188 +      </ul>
  1.5189 +
  1.5190 +      <p class=note> The preceding pairs of tokens can only be adjacent due
  1.5191 +       to comments in the original text, so the above rule reinserts the
  1.5192 +       minimum number of comments into the serialized text to ensure an
  1.5193 +       accurate round-trip. (Roughly. The 〈delim〉 rules are slightly too
  1.5194 +       powerful, for simplicity.)
  1.5195 +
  1.5196 +      <h3 id=serializing-anb><span class=secno>8.1. </span> Serializing <a
  1.5197 +       href="#anb-production"><var>&lt;an+b></var></a></h3>
  1.5198 +
  1.5199 +      <p> To serialize an <a href="#anb-production"><var>&lt;an+b></var></a>
  1.5200 +       value, let <var>s</var> initially be the empty string:
  1.5201 +
  1.5202 +      <dl>
  1.5203 +       <dt><a href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a>
  1.5204 +        are both zero
  1.5205 +
  1.5206 +       <dd> Append "0" to <var>s</var>.
  1.5207 +
  1.5208 +       <dt><a href="#a"><var>A</var></a> is zero, <a
  1.5209 +        href="#b"><var>B</var></a> is non-zero
  1.5210 +
  1.5211 +       <dd> Serialize <a href="#b"><var>B</var></a> and append it to
  1.5212 +        <var>s</var>.
  1.5213 +
  1.5214 +       <dt><a href="#a"><var>A</var></a> is non-zero, <a
  1.5215 +        href="#b"><var>B</var></a> is zero
  1.5216 +
  1.5217 +       <dd> Serialize <a href="#a"><var>A</var></a> and append it to
  1.5218 +        <var>s</var>. Append "n" to <var>s</var>.
  1.5219 +
  1.5220 +       <dt><a href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a>
  1.5221 +        are both non-zero
  1.5222 +
  1.5223 +       <dd> Serialize <a href="#a"><var>A</var></a> and append it to
  1.5224 +        <var>s</var>. Append "n" to <var>s</var>. If <a
  1.5225 +        href="#b"><var>B</var></a> is positive, append "+" to <var>s</var>
  1.5226 +        Serialize <a href="#b"><var>B</var></a> and append it to
  1.5227 +        <var>s</var>.
  1.5228 +      </dl>
  1.5229 +
  1.5230 +      <p> Return <var>s</var>. <!--
  1.5231  
  1.5232  TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHH     HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE
  1.5233  T:::::::::::::::::::::TH:::::::H     H:::::::HE::::::::::::::::::::E
  1.5234 @@ -4284,457 +3988,426 @@
  1.5235  EEEEEEEEEEEEEEEEEEEEEENNNNNNNN         NNNNNNNDDDDDDDDDDDDD
  1.5236  -->
  1.5237  
  1.5238 -  <h2 id=conformance><span class=secno>9. </span> Conformance</h2>
  1.5239 -
  1.5240 -  <h3 id=conventions><span class=secno>9.1. </span> Document conventions</h3>
  1.5241 -
  1.5242 -  <p>Conformance requirements are expressed with a combination of descriptive
  1.5243 -   assertions and RFC 2119 terminology. The key words “MUST”, “MUST
  1.5244 -   NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
  1.5245 -   “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the
  1.5246 -   normative parts of this document are to be interpreted as described in RFC
  1.5247 -   2119. However, for readability, these words do not appear in all uppercase
  1.5248 -   letters in this specification.
  1.5249 -
  1.5250 -  <p>All of the text of this specification is normative except sections
  1.5251 -   explicitly marked as non-normative, examples, and notes. <a
  1.5252 -   href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
  1.5253 -
  1.5254 -  <p>Examples in this specification are introduced with the words “for
  1.5255 -   example” or are set apart from the normative text with
  1.5256 -   <code>class="example"</code>, like this:
  1.5257 -
  1.5258 -  <div class=example>
  1.5259 -   <p>This is an example of an informative example.
  1.5260 -  </div>
  1.5261 -
  1.5262 -  <p>Informative notes begin with the word “Note” and are set apart from
  1.5263 -   the normative text with <code>class="note"</code>, like this:
  1.5264 -
  1.5265 -  <p class=note>Note, this is an informative note.
  1.5266 -
  1.5267 -  <h3 id=conformance-classes><span class=secno>9.2. </span> Conformance
  1.5268 -   classes</h3>
  1.5269 -
  1.5270 -  <p>Conformance to CSS Syntax Module Level 3 is defined for three
  1.5271 -   conformance classes:
  1.5272 -
  1.5273 -  <dl>
  1.5274 -   <dt><dfn id=style-sheet title="style sheet!!as conformance class">style
  1.5275 -    sheet</dfn>
  1.5276 -
  1.5277 -   <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
  1.5278 -    style sheet</a>.
  1.5279 -
  1.5280 -   <dt><dfn id=renderer>renderer</dfn>
  1.5281 -
  1.5282 -   <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1.5283 -    that interprets the semantics of a style sheet and renders documents that
  1.5284 -    use them.
  1.5285 -
  1.5286 -   <dt><dfn id=authoring-tool>authoring tool</dfn>
  1.5287 -
  1.5288 -   <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1.5289 -    that writes a style sheet.
  1.5290 -  </dl>
  1.5291 -
  1.5292 -  <p>A style sheet is conformant to CSS Syntax Module Level 3 if it is
  1.5293 -   syntactically valid according to this module.
  1.5294 -
  1.5295 -  <p>A renderer is conformant to CSS Syntax Module Level 3 if it parses a
  1.5296 -   stylesheet according to this module.
  1.5297 -
  1.5298 -  <p>An authoring tool is conformant to CSS Syntax Module Level 3 if it
  1.5299 -   writes style sheets that are syntactically valid according to this module.
  1.5300 -
  1.5301 -  <h2 class=no-num id=acknowledgments> Acknowledgments</h2>
  1.5302 -
  1.5303 -  <p> Thanks for feedback and contributions from David Baron, 呂康豪
  1.5304 -   (Kang-Hao Lu), and Simon Sapin.
  1.5305 -
  1.5306 -  <h2 class=no-num id=references> References</h2>
  1.5307 -
  1.5308 -  <h3 class=no-num id=normative-references> Normative references</h3>
  1.5309 -  <!--begin-normative-->
  1.5310 -  <!-- Sorted by label -->
  1.5311 -
  1.5312 -  <dl class=bibliography>
  1.5313 -   <dd style="display: none"><!-- keeps the doc valid if the DL is empty -->
  1.5314 -    <!---->
  1.5315 -
  1.5316 -   <dt id=RFC2119>[RFC2119]
  1.5317 -
  1.5318 -   <dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
  1.5319 -    words for use in RFCs to Indicate Requirement Levels.</cite></a> Internet
  1.5320 -    RFC 2119. URL: <a
  1.5321 -    href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
  1.5322 -   </dd>
  1.5323 -   <!---->
  1.5324 -  </dl>
  1.5325 -  <!--end-normative-->
  1.5326 -
  1.5327 -  <h3 class=no-num id=other-references> Other references</h3>
  1.5328 -  <!--begin-informative-->
  1.5329 -  <!-- Sorted by label -->
  1.5330 -
  1.5331 -  <dl class=bibliography>
  1.5332 -   <dd style="display: none"><!-- keeps the doc valid if the DL is empty -->
  1.5333 -    <!---->
  1.5334 -
  1.5335 -   <dt id=SELECT>[SELECT]
  1.5336 -
  1.5337 -   <dd>Tantek Çelik; et al. <a
  1.5338 -    href="http://www.w3.org/TR/2011/REC-css3-selectors-20110929/"><cite>Selectors
  1.5339 -    Level 3.</cite></a> 29 September 2011. W3C Recommendation. URL: <a
  1.5340 -    href="http://www.w3.org/TR/2011/REC-css3-selectors-20110929/">http://www.w3.org/TR/2011/REC-css3-selectors-20110929/</a>
  1.5341 -   </dd>
  1.5342 -   <!---->
  1.5343 -  </dl>
  1.5344 -  <!--end-informative-->
  1.5345 -
  1.5346 -  <h2 class=no-num id=index> Index</h2>
  1.5347 -  <!--begin-index-->
  1.5348 -
  1.5349 -  <ul class=indexlist>
  1.5350 -   <li>A, <a href="#a" title="section 6."><strong>6.</strong></a>
  1.5351 -
  1.5352 -   <li>&lt;an+b>, <a href="#anb-production"
  1.5353 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5354 -
  1.5355 -   <li>An+B, <a href="#anb0" title="section 6."><strong>6.</strong></a>
  1.5356 -
  1.5357 -   <li>are a valid escape, <a
  1.5358 -    href="#check-if-two-characters-are-a-valid-esca0"
  1.5359 -    title="section 4.4.4."><strong>4.4.4.</strong></a>
  1.5360 -
  1.5361 -   <li>ASCII case-insensitive, <a href="#ascii-case-insensitive"
  1.5362 -    title="section 5.2."><strong>5.2.</strong></a>
  1.5363 -
  1.5364 -   <li>At-keyword state, <a href="#at-keyword-state0"
  1.5365 -    title="section 4.3.6."><strong>4.3.6.</strong></a>
  1.5366 -
  1.5367 -   <li>at-rule, <a href="#at-rule"
  1.5368 -    title="section 5."><strong>5.</strong></a>, <a href="#at-rules"
  1.5369 -    title="section 2."><strong>2.</strong></a>
  1.5370 -
  1.5371 -   <li>authoring tool, <a href="#authoring-tool"
  1.5372 -    title="section 9.2."><strong>9.2.</strong></a>
  1.5373 -
  1.5374 -   <li>B, <a href="#b" title="section 6."><strong>6.</strong></a>
  1.5375 -
  1.5376 -   <li>Bad-URL state, <a href="#bad-url-state0"
  1.5377 -    title="section 4.3.18."><strong>4.3.18.</strong></a>
  1.5378 -
  1.5379 -   <li>check if three characters would start an identifier, <a
  1.5380 -    href="#check-if-three-characters-would-start-an0"
  1.5381 -    title="section 4.4.5."><strong>4.4.5.</strong></a>
  1.5382 -
  1.5383 -   <li>check if three characters would start a number, <a
  1.5384 -    href="#check-if-three-characters-would-start-a-0"
  1.5385 -    title="section 4.4.6."><strong>4.4.6.</strong></a>
  1.5386 -
  1.5387 -   <li>check if two characters are a valid escape, <a
  1.5388 -    href="#check-if-two-characters-are-a-valid-esca0"
  1.5389 -    title="section 4.4.4."><strong>4.4.4.</strong></a>
  1.5390 -
  1.5391 -   <li>Comment state, <a href="#comment-state0"
  1.5392 -    title="section 4.3.5."><strong>4.3.5.</strong></a>
  1.5393 -
  1.5394 -   <li>component value, <a href="#component-value"
  1.5395 -    title="section 5."><strong>5.</strong></a>
  1.5396 -
  1.5397 -   <li>Consume a component value, <a href="#consume-a-component-value0"
  1.5398 -    title="section 5.4.6."><strong>5.4.6.</strong></a>
  1.5399 -
  1.5400 -   <li>Consume a declaration, <a href="#consume-a-declaration0"
  1.5401 -    title="section 5.4.5."><strong>5.4.5.</strong></a>
  1.5402 -
  1.5403 -   <li>Consume a function, <a href="#consume-a-function0"
  1.5404 -    title="section 5.4.8."><strong>5.4.8.</strong></a>
  1.5405 -
  1.5406 -   <li>Consume a list of declarations, <a
  1.5407 -    href="#consume-a-list-of-declarations0"
  1.5408 -    title="section 5.4.4."><strong>5.4.4.</strong></a>
  1.5409 -
  1.5410 -   <li>Consume a list of rules, <a href="#consume-a-list-of-rules0"
  1.5411 -    title="section 5.4.1."><strong>5.4.1.</strong></a>
  1.5412 -
  1.5413 -   <li>Consume an at-rule, <a href="#consume-an-at-rule0"
  1.5414 -    title="section 5.4.2."><strong>5.4.2.</strong></a>
  1.5415 -
  1.5416 -   <li>Consume an escaped character, <a href="#consume-an-escaped-character0"
  1.5417 -    title="section 4.4.1."><strong>4.4.1.</strong></a>
  1.5418 -
  1.5419 -   <li>Consume a qualified rule, <a href="#consume-a-qualified-rule0"
  1.5420 -    title="section 5.4.3."><strong>5.4.3.</strong></a>
  1.5421 -
  1.5422 -   <li>Consume a simple block, <a href="#consume-a-simple-block0"
  1.5423 -    title="section 5.4.7."><strong>5.4.7.</strong></a>
  1.5424 -
  1.5425 -   <li>convert a sci-notation representation into a value, <a
  1.5426 -    href="#convert-a-sci-notation-representation-in0"
  1.5427 -    title="section 4.4.3."><strong>4.4.3.</strong></a>
  1.5428 -
  1.5429 -   <li>current input character, <a href="#current-input-character"
  1.5430 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5431 -
  1.5432 -   <li>current input token, <a href="#current-input-token"
  1.5433 -    title="section 5.2."><strong>5.2.</strong></a>
  1.5434 -
  1.5435 -   <li><code>&lt;dashndashdigit-ident></code>, <a
  1.5436 -    href="#ltdashndashdigit-ident"
  1.5437 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5438 -
  1.5439 -   <li>Data state, <a href="#data-state0"
  1.5440 -    title="section 4.3.1."><strong>4.3.1.</strong></a>
  1.5441 -
  1.5442 -   <li>declaration, <a href="#declaration"
  1.5443 -    title="section 5."><strong>5.</strong></a>
  1.5444 -
  1.5445 -   <li><var>&lt;declaration-list></var>, <a href="#ltdeclaration-list"
  1.5446 -    title="section 7.1."><strong>7.1.</strong></a>
  1.5447 -
  1.5448 -   <li>decode, <a href="#decode"
  1.5449 -    title="section 3.2."><strong>3.2.</strong></a>
  1.5450 -
  1.5451 -   <li>digit, <a href="#digit" title="section 4.2."><strong>4.2.</strong></a>
  1.5452 -
  1.5453 -   <li>Dimension state, <a href="#dimension-state0"
  1.5454 -    title="section 4.3.12."><strong>4.3.12.</strong></a>
  1.5455 -
  1.5456 -   <li>Double-quote-string state, <a href="#double-quote-string-state0"
  1.5457 -    title="section 4.3.2."><strong>4.3.2.</strong></a>
  1.5458 -
  1.5459 -   <li>ending token, <a href="#ending-token"
  1.5460 -    title="section 5.4.7."><strong>5.4.7.</strong></a>
  1.5461 -
  1.5462 -   <li>end of the range, <a href="#end-of-the-range"
  1.5463 -    title="section 4.4.2."><strong>4.4.2.</strong></a>
  1.5464 -
  1.5465 -   <li>〈EOF〉, <a href="#eof"
  1.5466 -    title="section 5.2."><strong>5.2.</strong></a>
  1.5467 -
  1.5468 -   <li>EOF character, <a href="#eof-character"
  1.5469 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5470 -
  1.5471 -   <li>function, <a href="#function"
  1.5472 -    title="section 5."><strong>5.</strong></a>
  1.5473 -
  1.5474 -   <li>get an encoding, <a href="#get-an-encoding"
  1.5475 -    title="section 3.2."><strong>3.2.</strong></a>
  1.5476 -
  1.5477 -   <li>Hash state, <a href="#hash-state0"
  1.5478 -    title="section 4.3.4."><strong>4.3.4.</strong></a>
  1.5479 -
  1.5480 -   <li>hex digit, <a href="#hex-digit"
  1.5481 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5482 -
  1.5483 -   <li>Ident state, <a href="#ident-state0"
  1.5484 -    title="section 4.3.7."><strong>4.3.7.</strong></a>
  1.5485 -
  1.5486 -   <li><code>&lt;integer></code>, <a href="#ltinteger"
  1.5487 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5488 -
  1.5489 -   <li>letter, <a href="#letter"
  1.5490 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5491 -
  1.5492 -   <li>lowercase letter, <a href="#lowercase-letter"
  1.5493 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5494 -
  1.5495 -   <li>maximum allowed codepoint, <a href="#maximum-allowed-codepoint"
  1.5496 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5497 -
  1.5498 -   <li>name character, <a href="#name-character"
  1.5499 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5500 -
  1.5501 -   <li>name-start character, <a href="#name-start-character"
  1.5502 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5503 -
  1.5504 -   <li><code>&lt;ndashdigit-dimension></code>, <a
  1.5505 -    href="#ltndashdigit-dimension"
  1.5506 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5507 -
  1.5508 -   <li><code>&lt;ndashdigit-ident></code>, <a href="#ltndashdigit-ident"
  1.5509 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5510 -
  1.5511 -   <li><code>&lt;n-dimension></code>, <a href="#ltn-dimension"
  1.5512 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5513 -
  1.5514 -   <li>newline, <a href="#newline"
  1.5515 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5516 -
  1.5517 -   <li>next input character, <a href="#next-input-character"
  1.5518 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5519 -
  1.5520 -   <li>next input token, <a href="#next-input-token"
  1.5521 -    title="section 5.2."><strong>5.2.</strong></a>
  1.5522 -
  1.5523 -   <li>non-ASCII character, <a href="#non-ascii-character"
  1.5524 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5525 -
  1.5526 -   <li>non-printable character, <a href="#non-printable-character"
  1.5527 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5528 -
  1.5529 -   <li>Number-end state, <a href="#number-end-state0"
  1.5530 -    title="section 4.3.11."><strong>4.3.11.</strong></a>
  1.5531 -
  1.5532 -   <li>Number-rest state, <a href="#number-rest-state0"
  1.5533 -    title="section 4.3.9."><strong>4.3.9.</strong></a>
  1.5534 -
  1.5535 -   <li>Number state, <a href="#number-state0"
  1.5536 -    title="section 4.3.8."><strong>4.3.8.</strong></a>
  1.5537 -
  1.5538 -   <li>Parse a component value, <a href="#parse-a-component-value0"
  1.5539 -    title="section 5.3.4."><strong>5.3.4.</strong></a>
  1.5540 -
  1.5541 -   <li>Parse a list of component values, <a
  1.5542 -    href="#parse-a-list-of-component-values0"
  1.5543 -    title="section 5.3.5."><strong>5.3.5.</strong></a>
  1.5544 -
  1.5545 -   <li>Parse a list of declarations, <a href="#parse-a-list-of-declarations0"
  1.5546 -    title="section 5.3.3."><strong>5.3.3.</strong></a>
  1.5547 -
  1.5548 -   <li>Parse a rule, <a href="#parse-a-rule0"
  1.5549 -    title="section 5.3.2."><strong>5.3.2.</strong></a>
  1.5550 -
  1.5551 -   <li>Parse a stylesheet, <a href="#parse-a-stylesheet0"
  1.5552 -    title="section 5.3.1."><strong>5.3.1.</strong></a>
  1.5553 -
  1.5554 -   <li>parse error, <a href="#parse-errors"
  1.5555 -    title="section 3."><strong>3.</strong></a>
  1.5556 -
  1.5557 -   <li>preserved tokens, <a href="#preserved-tokens"
  1.5558 -    title="section 5."><strong>5.</strong></a>
  1.5559 -
  1.5560 -   <li>qualified rule, <a href="#qualified-rule"
  1.5561 -    title="section 2."><strong>2.</strong></a>, <a href="#qualified-rule0"
  1.5562 -    title="section 5."><strong>5.</strong></a>
  1.5563 -
  1.5564 -   <li>reconsume the current input character, <a
  1.5565 -    href="#reconsume-the-current-input-character"
  1.5566 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5567 -
  1.5568 -   <li>reconsume the current input token, <a
  1.5569 -    href="#reconsume-the-current-input-token"
  1.5570 -    title="section 5.2."><strong>5.2.</strong></a>
  1.5571 -
  1.5572 -   <li>renderer, <a href="#renderer"
  1.5573 -    title="section 9.2."><strong>9.2.</strong></a>
  1.5574 -
  1.5575 -   <li><var>&lt;rule-list></var>, <a href="#ltrule-list"
  1.5576 -    title="section 7.1."><strong>7.1.</strong></a>
  1.5577 -
  1.5578 -   <li>Sci-notation state, <a href="#sci-notation-state0"
  1.5579 -    title="section 4.3.10."><strong>4.3.10.</strong></a>
  1.5580 -
  1.5581 -   <li>sci-not-to-value, <a href="#convert-a-sci-notation-representation-in0"
  1.5582 -    title="section 4.4.3."><strong>4.4.3.</strong></a>
  1.5583 -
  1.5584 -   <li>Set the 〈unicode-range〉’s range, <a
  1.5585 -    href="#set-the-unicode-ranges-range0"
  1.5586 -    title="section 4.4.2."><strong>4.4.2.</strong></a>
  1.5587 -
  1.5588 -   <li><code>&lt;signed-integer></code>, <a href="#ltsigned-integer"
  1.5589 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5590 -
  1.5591 -   <li><code>&lt;signless-integer></code>, <a href="#ltsignless-integer"
  1.5592 -    title="section 6.2."><strong>6.2.</strong></a>
  1.5593 -
  1.5594 -   <li>simple block, <a href="#simple-block"
  1.5595 -    title="section 5."><strong>5.</strong></a>
  1.5596 -
  1.5597 -   <li>Single-quote-string state, <a href="#single-quote-string-state0"
  1.5598 -    title="section 4.3.3."><strong>4.3.3.</strong></a>
  1.5599 -
  1.5600 -   <li>start of the range, <a href="#start-of-the-range"
  1.5601 -    title="section 4.4.2."><strong>4.4.2.</strong></a>
  1.5602 -
  1.5603 -   <li>starts with an identifier, <a
  1.5604 -    href="#check-if-three-characters-would-start-an0"
  1.5605 -    title="section 4.4.5."><strong>4.4.5.</strong></a>
  1.5606 -
  1.5607 -   <li>starts with a number, <a
  1.5608 -    href="#check-if-three-characters-would-start-a-0"
  1.5609 -    title="section 4.4.6."><strong>4.4.6.</strong></a>
  1.5610 -
  1.5611 -   <li>starts with a valid escape, <a
  1.5612 -    href="#check-if-two-characters-are-a-valid-esca0"
  1.5613 -    title="section 4.4.4."><strong>4.4.4.</strong></a>
  1.5614 -
  1.5615 -   <li>start with an identifier, <a
  1.5616 -    href="#check-if-three-characters-would-start-an0"
  1.5617 -    title="section 4.4.5."><strong>4.4.5.</strong></a>
  1.5618 -
  1.5619 -   <li>start with a number, <a
  1.5620 -    href="#check-if-three-characters-would-start-a-0"
  1.5621 -    title="section 4.4.6."><strong>4.4.6.</strong></a>
  1.5622 -
  1.5623 -   <li><var>&lt;stylesheet></var>, <a href="#ltstylesheet"
  1.5624 -    title="section 7.1."><strong>7.1.</strong></a>
  1.5625 -
  1.5626 -   <li>style sheet
  1.5627 -    <ul>
  1.5628 -     <li>as conformance class, <a href="#style-sheet"
  1.5629 -      title="section 9.2."><strong>9.2.</strong></a>
  1.5630 -    </ul>
  1.5631 -
  1.5632 -   <li>Unicode-range state, <a href="#unicode-range-state0"
  1.5633 -    title="section 4.3.19."><strong>4.3.19.</strong></a>
  1.5634 -
  1.5635 -   <li>uppercase letter, <a href="#uppercase-letter"
  1.5636 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5637 -
  1.5638 -   <li>URL-double-quote state, <a href="#url-double-quote-state0"
  1.5639 -    title="section 4.3.14."><strong>4.3.14.</strong></a>
  1.5640 -
  1.5641 -   <li>URL-end state, <a href="#url-end-state0"
  1.5642 -    title="section 4.3.17."><strong>4.3.17.</strong></a>
  1.5643 -
  1.5644 -   <li>URL-single-quote state, <a href="#url-single-quote-state0"
  1.5645 -    title="section 4.3.15."><strong>4.3.15.</strong></a>
  1.5646 -
  1.5647 -   <li>URL state, <a href="#url-state0"
  1.5648 -    title="section 4.3.13."><strong>4.3.13.</strong></a>
  1.5649 -
  1.5650 -   <li>URL-unquoted state, <a href="#url-unquoted-state0"
  1.5651 -    title="section 4.3.16."><strong>4.3.16.</strong></a>
  1.5652 -
  1.5653 -   <li>whitespace, <a href="#whitespace"
  1.5654 -    title="section 4.2."><strong>4.2.</strong></a>
  1.5655 -
  1.5656 -   <li>would start an identifier, <a
  1.5657 -    href="#check-if-three-characters-would-start-an0"
  1.5658 -    title="section 4.4.5."><strong>4.4.5.</strong></a>
  1.5659 -
  1.5660 -   <li>would start a number, <a
  1.5661 -    href="#check-if-three-characters-would-start-a-0"
  1.5662 -    title="section 4.4.6."><strong>4.4.6.</strong></a>
  1.5663 -  </ul>
  1.5664 -  <!--end-index-->
  1.5665 -
  1.5666 -  <h2 class=no-num id=property-index> Property index</h2>
  1.5667 -  <!--begin-properties-->
  1.5668 -
  1.5669 -  <table class=proptable>
  1.5670 -   <thead>
  1.5671 -    <tr>
  1.5672 -     <th>Property
  1.5673 -
  1.5674 -     <th>Values
  1.5675 -
  1.5676 -     <th>Initial
  1.5677 -
  1.5678 -     <th>Applies to
  1.5679 -
  1.5680 -     <th>Inh.
  1.5681 -
  1.5682 -     <th>Percentages
  1.5683 -
  1.5684 -     <th>Media
  1.5685 -
  1.5686 -   <tbody>
  1.5687 -  </table>
  1.5688 -  <!--end-properties-->
  1.5689 +      <h2 id=conformance><span class=secno>9. </span> Conformance</h2>
  1.5690 +
  1.5691 +      <h3 id=conventions><span class=secno>9.1. </span> Document conventions</h3>
  1.5692 +
  1.5693 +      <p>Conformance requirements are expressed with a combination of
  1.5694 +       descriptive assertions and RFC 2119 terminology. The key words
  1.5695 +       “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL
  1.5696 +       NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”,
  1.5697 +       and “OPTIONAL” in the normative parts of this document are to be
  1.5698 +       interpreted as described in RFC 2119. However, for readability, these
  1.5699 +       words do not appear in all uppercase letters in this specification.
  1.5700 +
  1.5701 +      <p>All of the text of this specification is normative except sections
  1.5702 +       explicitly marked as non-normative, examples, and notes. <a
  1.5703 +       href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
  1.5704 +
  1.5705 +      <p>Examples in this specification are introduced with the words “for
  1.5706 +       example” or are set apart from the normative text with
  1.5707 +       <code>class="example"</code>, like this:
  1.5708 +
  1.5709 +      <div class=example>
  1.5710 +       <p>This is an example of an informative example.
  1.5711 +      </div>
  1.5712 +
  1.5713 +      <p>Informative notes begin with the word “Note” and are set apart
  1.5714 +       from the normative text with <code>class="note"</code>, like this:
  1.5715 +
  1.5716 +      <p class=note>Note, this is an informative note.
  1.5717 +
  1.5718 +      <h3 id=conformance-classes><span class=secno>9.2. </span> Conformance
  1.5719 +       classes</h3>
  1.5720 +
  1.5721 +      <p>Conformance to CSS Syntax Module Level 3 is defined for three
  1.5722 +       conformance classes:
  1.5723 +
  1.5724 +      <dl>
  1.5725 +       <dt><dfn id=style-sheet
  1.5726 +        title="style sheet!!as conformance class">style sheet</dfn>
  1.5727 +
  1.5728 +       <dd>A <a
  1.5729 +        href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style
  1.5730 +        sheet</a>.
  1.5731 +
  1.5732 +       <dt><dfn id=renderer>renderer</dfn>
  1.5733 +
  1.5734 +       <dd>A <a
  1.5735 +        href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that
  1.5736 +        interprets the semantics of a style sheet and renders documents that
  1.5737 +        use them.
  1.5738 +
  1.5739 +       <dt><dfn id=authoring-tool>authoring tool</dfn>
  1.5740 +
  1.5741 +       <dd>A <a
  1.5742 +        href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that
  1.5743 +        writes a style sheet.
  1.5744 +      </dl>
  1.5745 +
  1.5746 +      <p>A style sheet is conformant to CSS Syntax Module Level 3 if it is
  1.5747 +       syntactically valid according to this module.
  1.5748 +
  1.5749 +      <p>A renderer is conformant to CSS Syntax Module Level 3 if it parses a
  1.5750 +       stylesheet according to this module.
  1.5751 +
  1.5752 +      <p>An authoring tool is conformant to CSS Syntax Module Level 3 if it
  1.5753 +       writes style sheets that are syntactically valid according to this
  1.5754 +       module.
  1.5755 +
  1.5756 +      <h2 class=no-num id=acknowledgments> Acknowledgments</h2>
  1.5757 +
  1.5758 +      <p> Thanks for feedback and contributions from David Baron, 呂康豪
  1.5759 +       (Kang-Hao Lu), and Simon Sapin.
  1.5760 +
  1.5761 +      <h2 class=no-num id=references> References</h2>
  1.5762 +
  1.5763 +      <h3 class=no-num id=normative-references> Normative references</h3>
  1.5764 +      <!--begin-normative--> <!-- Sorted by label -->
  1.5765 +      <dl class=bibliography>
  1.5766 +       <dd
  1.5767 +        style="display: none"><!-- keeps the doc valid if the DL is empty -->
  1.5768 +        <!---->
  1.5769 +
  1.5770 +       <dt id=RFC2119>[RFC2119]
  1.5771 +
  1.5772 +       <dd>S. Bradner. <a
  1.5773 +        href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in
  1.5774 +        RFCs to Indicate Requirement Levels.</cite></a> Internet RFC 2119.
  1.5775 +        URL: <a
  1.5776 +        href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
  1.5777 +       </dd>
  1.5778 +       <!---->
  1.5779 +      </dl>
  1.5780 +      <!--end-normative-->
  1.5781 +      <h3 class=no-num id=other-references> Other references</h3>
  1.5782 +      <!--begin-informative--> <!-- Sorted by label -->
  1.5783 +      <dl class=bibliography>
  1.5784 +       <dd
  1.5785 +        style="display: none"><!-- keeps the doc valid if the DL is empty -->
  1.5786 +        <!---->
  1.5787 +
  1.5788 +       <dt id=SELECT>[SELECT]
  1.5789 +
  1.5790 +       <dd>Tantek Çelik; et al. <a
  1.5791 +        href="http://www.w3.org/TR/2011/REC-css3-selectors-20110929/"><cite>Selectors
  1.5792 +        Level 3.</cite></a> 29 September 2011. W3C Recommendation. URL: <a
  1.5793 +        href="http://www.w3.org/TR/2011/REC-css3-selectors-20110929/">http://www.w3.org/TR/2011/REC-css3-selectors-20110929/</a>
  1.5794 +       </dd>
  1.5795 +       <!---->
  1.5796 +      </dl>
  1.5797 +      <!--end-informative-->
  1.5798 +      <h2 class=no-num id=index> Index</h2>
  1.5799 +      <!--begin-index-->
  1.5800 +      <ul class=indexlist>
  1.5801 +       <li>A, <a href="#a" title="section 6."><strong>6.</strong></a>
  1.5802 +
  1.5803 +       <li>&lt;an+b>, <a href="#anb-production"
  1.5804 +        title="section 6.2."><strong>6.2.</strong></a>
  1.5805 +
  1.5806 +       <li>An+B, <a href="#anb0" title="section 6."><strong>6.</strong></a>
  1.5807 +
  1.5808 +       <li>are a valid escape, <a
  1.5809 +        href="#check-if-two-characters-are-a-valid-esca0"
  1.5810 +        title="section 4.3.7."><strong>4.3.7.</strong></a>
  1.5811 +
  1.5812 +       <li>ASCII case-insensitive, <a href="#ascii-case-insensitive"
  1.5813 +        title="section 5.2."><strong>5.2.</strong></a>
  1.5814 +
  1.5815 +       <li>at-rule, <a href="#at-rule"
  1.5816 +        title="section 5."><strong>5.</strong></a>, <a href="#at-rules"
  1.5817 +        title="section 2."><strong>2.</strong></a>
  1.5818 +
  1.5819 +       <li>authoring tool, <a href="#authoring-tool"
  1.5820 +        title="section 9.2."><strong>9.2.</strong></a>
  1.5821 +
  1.5822 +       <li>B, <a href="#b" title="section 6."><strong>6.</strong></a>
  1.5823 +
  1.5824 +       <li>check if three characters would start an identifier, <a
  1.5825 +        href="#check-if-three-characters-would-start-an0"
  1.5826 +        title="section 4.3.8."><strong>4.3.8.</strong></a>
  1.5827 +
  1.5828 +       <li>check if three characters would start a number, <a
  1.5829 +        href="#check-if-three-characters-would-start-a-0"
  1.5830 +        title="section 4.3.9."><strong>4.3.9.</strong></a>
  1.5831 +
  1.5832 +       <li>check if two characters are a valid escape, <a
  1.5833 +        href="#check-if-two-characters-are-a-valid-esca0"
  1.5834 +        title="section 4.3.7."><strong>4.3.7.</strong></a>
  1.5835 +
  1.5836 +       <li>component value, <a href="#component-value"
  1.5837 +        title="section 5."><strong>5.</strong></a>
  1.5838 +
  1.5839 +       <li>Consume a component value, <a href="#consume-a-component-value0"
  1.5840 +        title="section 5.4.6."><strong>5.4.6.</strong></a>
  1.5841 +
  1.5842 +       <li>Consume a declaration, <a href="#consume-a-declaration0"
  1.5843 +        title="section 5.4.5."><strong>5.4.5.</strong></a>
  1.5844 +
  1.5845 +       <li>Consume a function, <a href="#consume-a-function0"
  1.5846 +        title="section 5.4.8."><strong>5.4.8.</strong></a>
  1.5847 +
  1.5848 +       <li>Consume a list of declarations, <a
  1.5849 +        href="#consume-a-list-of-declarations0"
  1.5850 +        title="section 5.4.4."><strong>5.4.4.</strong></a>
  1.5851 +
  1.5852 +       <li>Consume a list of rules, <a href="#consume-a-list-of-rules0"
  1.5853 +        title="section 5.4.1."><strong>5.4.1.</strong></a>
  1.5854 +
  1.5855 +       <li>Consume a name, <a href="#consume-a-name0"
  1.5856 +        title="section 4.3.10."><strong>4.3.10.</strong></a>
  1.5857 +
  1.5858 +       <li>Consume an at-rule, <a href="#consume-an-at-rule0"
  1.5859 +        title="section 5.4.2."><strong>5.4.2.</strong></a>
  1.5860 +
  1.5861 +       <li>Consume an escaped character, <a
  1.5862 +        href="#consume-an-escaped-character0"
  1.5863 +        title="section 4.3.6."><strong>4.3.6.</strong></a>
  1.5864 +
  1.5865 +       <li>Consume a number, <a href="#consume-a-number0"
  1.5866 +        title="section 4.3.11."><strong>4.3.11.</strong></a>
  1.5867 +
  1.5868 +       <li>Consume a numeric token, <a href="#consume-a-numeric-token0"
  1.5869 +        title="section 4.3.2."><strong>4.3.2.</strong></a>
  1.5870 +
  1.5871 +       <li>Consume a qualified rule, <a href="#consume-a-qualified-rule0"
  1.5872 +        title="section 5.4.3."><strong>5.4.3.</strong></a>
  1.5873 +
  1.5874 +       <li>Consume a simple block, <a href="#consume-a-simple-block0"
  1.5875 +        title="section 5.4.7."><strong>5.4.7.</strong></a>
  1.5876 +
  1.5877 +       <li>Consume a string token, <a href="#consume-a-string-token0"
  1.5878 +        title="section 4.3.3."><strong>4.3.3.</strong></a>
  1.5879 +
  1.5880 +       <li>Consume a token, <a href="#consume-a-token0"
  1.5881 +        title="section 4.3.1."><strong>4.3.1.</strong></a>
  1.5882 +
  1.5883 +       <li>Consume a unicode-range token, <a
  1.5884 +        href="#consume-a-unicode-range-token0"
  1.5885 +        title="section 4.3.5."><strong>4.3.5.</strong></a>
  1.5886 +
  1.5887 +       <li>Consume a url token, <a href="#consume-a-url-token"
  1.5888 +        title="section 4.3.4."><strong>4.3.4.</strong></a>
  1.5889 +
  1.5890 +       <li>Consume the remnants of a bad url, <a
  1.5891 +        href="#consume-the-remnants-of-a-bad-url0"
  1.5892 +        title="section 4.3.13."><strong>4.3.13.</strong></a>
  1.5893 +
  1.5894 +       <li>Convert a string to a number, <a
  1.5895 +        href="#convert-a-string-to-a-number0"
  1.5896 +        title="section 4.3.12."><strong>4.3.12.</strong></a>
  1.5897 +
  1.5898 +       <li>current input character, <a href="#current-input-character"
  1.5899 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5900 +
  1.5901 +       <li>current input token, <a href="#current-input-token"
  1.5902 +        title="section 5.2."><strong>5.2.</strong></a>
  1.5903 +
  1.5904 +       <li><code>&lt;dashndashdigit-ident></code>, <a
  1.5905 +        href="#ltdashndashdigit-ident"
  1.5906 +        title="section 6.2."><strong>6.2.</strong></a>
  1.5907 +
  1.5908 +       <li>declaration, <a href="#declaration"
  1.5909 +        title="section 5."><strong>5.</strong></a>
  1.5910 +
  1.5911 +       <li><var>&lt;declaration-list></var>, <a href="#ltdeclaration-list"
  1.5912 +        title="section 7.1."><strong>7.1.</strong></a>
  1.5913 +
  1.5914 +       <li>decode, <a href="#decode"
  1.5915 +        title="section 3.2."><strong>3.2.</strong></a>
  1.5916 +
  1.5917 +       <li>digit, <a href="#digit"
  1.5918 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5919 +
  1.5920 +       <li>ending token, <a href="#ending-token"
  1.5921 +        title="section 5.4.7."><strong>5.4.7.</strong></a>
  1.5922 +
  1.5923 +       <li>end of the range, <a href="#end-of-the-range"
  1.5924 +        title="section 4.3.14."><strong>4.3.14.</strong></a>
  1.5925 +
  1.5926 +       <li>〈EOF〉, <a href="#eof"
  1.5927 +        title="section 5.2."><strong>5.2.</strong></a>
  1.5928 +
  1.5929 +       <li>EOF character, <a href="#eof-character"
  1.5930 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5931 +
  1.5932 +       <li>function, <a href="#function"
  1.5933 +        title="section 5."><strong>5.</strong></a>
  1.5934 +
  1.5935 +       <li>get an encoding, <a href="#get-an-encoding"
  1.5936 +        title="section 3.2."><strong>3.2.</strong></a>
  1.5937 +
  1.5938 +       <li>hex digit, <a href="#hex-digit"
  1.5939 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5940 +
  1.5941 +       <li><code>&lt;integer></code>, <a href="#ltinteger"
  1.5942 +        title="section 6.2."><strong>6.2.</strong></a>
  1.5943 +
  1.5944 +       <li>letter, <a href="#letter"
  1.5945 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5946 +
  1.5947 +       <li>lowercase letter, <a href="#lowercase-letter"
  1.5948 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5949 +
  1.5950 +       <li>maximum allowed codepoint, <a href="#maximum-allowed-codepoint"
  1.5951 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5952 +
  1.5953 +       <li>name character, <a href="#name-character"
  1.5954 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5955 +
  1.5956 +       <li>name-start character, <a href="#name-start-character"
  1.5957 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5958 +
  1.5959 +       <li><code>&lt;ndashdigit-dimension></code>, <a
  1.5960 +        href="#ltndashdigit-dimension"
  1.5961 +        title="section 6.2."><strong>6.2.</strong></a>
  1.5962 +
  1.5963 +       <li><code>&lt;ndashdigit-ident></code>, <a href="#ltndashdigit-ident"
  1.5964 +        title="section 6.2."><strong>6.2.</strong></a>
  1.5965 +
  1.5966 +       <li><code>&lt;n-dimension></code>, <a href="#ltn-dimension"
  1.5967 +        title="section 6.2."><strong>6.2.</strong></a>
  1.5968 +
  1.5969 +       <li>newline, <a href="#newline"
  1.5970 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5971 +
  1.5972 +       <li>next input character, <a href="#next-input-character"
  1.5973 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5974 +
  1.5975 +       <li>next input token, <a href="#next-input-token"
  1.5976 +        title="section 5.2."><strong>5.2.</strong></a>
  1.5977 +
  1.5978 +       <li>non-ASCII character, <a href="#non-ascii-character"
  1.5979 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5980 +
  1.5981 +       <li>non-printable character, <a href="#non-printable-character"
  1.5982 +        title="section 4.2."><strong>4.2.</strong></a>
  1.5983 +
  1.5984 +       <li>Parse a component value, <a href="#parse-a-component-value0"
  1.5985 +        title="section 5.3.4."><strong>5.3.4.</strong></a>
  1.5986 +
  1.5987 +       <li>Parse a list of component values, <a
  1.5988 +        href="#parse-a-list-of-component-values0"
  1.5989 +        title="section 5.3.5."><strong>5.3.5.</strong></a>
  1.5990 +
  1.5991 +       <li>Parse a list of declarations, <a
  1.5992 +        href="#parse-a-list-of-declarations0"
  1.5993 +        title="section 5.3.3."><strong>5.3.3.</strong></a>
  1.5994 +
  1.5995 +       <li>Parse a rule, <a href="#parse-a-rule0"
  1.5996 +        title="section 5.3.2."><strong>5.3.2.</strong></a>
  1.5997 +
  1.5998 +       <li>Parse a stylesheet, <a href="#parse-a-stylesheet0"
  1.5999 +        title="section 5.3.1."><strong>5.3.1.</strong></a>
  1.6000 +
  1.6001 +       <li>parse error, <a href="#parse-errors"
  1.6002 +        title="section 3."><strong>3.</strong></a>
  1.6003 +
  1.6004 +       <li>preserved tokens, <a href="#preserved-tokens"
  1.6005 +        title="section 5."><strong>5.</strong></a>
  1.6006 +
  1.6007 +       <li>qualified rule, <a href="#qualified-rule"
  1.6008 +        title="section 2."><strong>2.</strong></a>, <a
  1.6009 +        href="#qualified-rule0" title="section 5."><strong>5.</strong></a>
  1.6010 +
  1.6011 +       <li>reconsume the current input character, <a
  1.6012 +        href="#reconsume-the-current-input-character"
  1.6013 +        title="section 4.2."><strong>4.2.</strong></a>
  1.6014 +
  1.6015 +       <li>reconsume the current input token, <a
  1.6016 +        href="#reconsume-the-current-input-token"
  1.6017 +        title="section 5.2."><strong>5.2.</strong></a>
  1.6018 +
  1.6019 +       <li>renderer, <a href="#renderer"
  1.6020 +        title="section 9.2."><strong>9.2.</strong></a>
  1.6021 +
  1.6022 +       <li><var>&lt;rule-list></var>, <a href="#ltrule-list"
  1.6023 +        title="section 7.1."><strong>7.1.</strong></a>
  1.6024 +
  1.6025 +       <li>Set the 〈unicode-range〉’s range, <a
  1.6026 +        href="#set-the-unicode-ranges-range0"
  1.6027 +        title="section 4.3.14."><strong>4.3.14.</strong></a>
  1.6028 +
  1.6029 +       <li><code>&lt;signed-integer></code>, <a href="#ltsigned-integer"
  1.6030 +        title="section 6.2."><strong>6.2.</strong></a>
  1.6031 +
  1.6032 +       <li><code>&lt;signless-integer></code>, <a href="#ltsignless-integer"
  1.6033 +        title="section 6.2."><strong>6.2.</strong></a>
  1.6034 +
  1.6035 +       <li>simple block, <a href="#simple-block"
  1.6036 +        title="section 5."><strong>5.</strong></a>
  1.6037 +
  1.6038 +       <li>start of the range, <a href="#start-of-the-range"
  1.6039 +        title="section 4.3.14."><strong>4.3.14.</strong></a>
  1.6040 +
  1.6041 +       <li>starts with an identifier, <a
  1.6042 +        href="#check-if-three-characters-would-start-an0"
  1.6043 +        title="section 4.3.8."><strong>4.3.8.</strong></a>
  1.6044 +
  1.6045 +       <li>starts with a number, <a
  1.6046 +        href="#check-if-three-characters-would-start-a-0"
  1.6047 +        title="section 4.3.9."><strong>4.3.9.</strong></a>
  1.6048 +
  1.6049 +       <li>starts with a valid escape, <a
  1.6050 +        href="#check-if-two-characters-are-a-valid-esca0"
  1.6051 +        title="section 4.3.7."><strong>4.3.7.</strong></a>
  1.6052 +
  1.6053 +       <li>start with an identifier, <a
  1.6054 +        href="#check-if-three-characters-would-start-an0"
  1.6055 +        title="section 4.3.8."><strong>4.3.8.</strong></a>
  1.6056 +
  1.6057 +       <li>start with a number, <a
  1.6058 +        href="#check-if-three-characters-would-start-a-0"
  1.6059 +        title="section 4.3.9."><strong>4.3.9.</strong></a>
  1.6060 +
  1.6061 +       <li><var>&lt;stylesheet></var>, <a href="#ltstylesheet"
  1.6062 +        title="section 7.1."><strong>7.1.</strong></a>
  1.6063 +
  1.6064 +       <li>style sheet
  1.6065 +        <ul>
  1.6066 +         <li>as conformance class, <a href="#style-sheet"
  1.6067 +          title="section 9.2."><strong>9.2.</strong></a>
  1.6068 +        </ul>
  1.6069 +
  1.6070 +       <li>uppercase letter, <a href="#uppercase-letter"
  1.6071 +        title="section 4.2."><strong>4.2.</strong></a>
  1.6072 +
  1.6073 +       <li>whitespace, <a href="#whitespace"
  1.6074 +        title="section 4.2."><strong>4.2.</strong></a>
  1.6075 +
  1.6076 +       <li>would start an identifier, <a
  1.6077 +        href="#check-if-three-characters-would-start-an0"
  1.6078 +        title="section 4.3.8."><strong>4.3.8.</strong></a>
  1.6079 +
  1.6080 +       <li>would start a number, <a
  1.6081 +        href="#check-if-three-characters-would-start-a-0"
  1.6082 +        title="section 4.3.9."><strong>4.3.9.</strong></a>
  1.6083 +      </ul>
  1.6084 +      <!--end-index-->
  1.6085 +      <h2 class=no-num id=property-index> Property index</h2>
  1.6086 +      <!--begin-properties-->
  1.6087 +      <table class=proptable>
  1.6088 +       <thead>
  1.6089 +        <tr>
  1.6090 +         <th>Property
  1.6091 +
  1.6092 +         <th>Values
  1.6093 +
  1.6094 +         <th>Initial
  1.6095 +
  1.6096 +         <th>Applies to
  1.6097 +
  1.6098 +         <th>Inh.
  1.6099 +
  1.6100 +         <th>Percentages
  1.6101 +
  1.6102 +         <th>Media
  1.6103 +
  1.6104 +       <tbody>
  1.6105 +      </table>
  1.6106 +      <!--end-properties-->
  1.6107 +    </ol>
  1.6108 +  </ol>
  1.6109  </html>
  1.6110  <!-- Keep this comment at the end of the file
  1.6111  Local variables:
     2.1 --- a/css-syntax/Overview.src.html	Fri May 31 01:53:00 2013 +0200
     2.2 +++ b/css-syntax/Overview.src.html	Thu May 30 17:11:17 2013 -0700
     2.3 @@ -416,17 +416,18 @@
     2.4  Tokenization</h2>
     2.5  
     2.6  	<p>
     2.7 -		Implementations must act as if they used the following state machine to tokenize CSS.
     2.8 -		The state machine must start in the <i>data state</i>.
     2.9 -		Most states consume a single character,
    2.10 -		which may have various side-effects,
    2.11 -		and either switches the state machine to a new state to reconsume the same character,
    2.12 -		or switches it to a new state to consume the next character,
    2.13 -		or stays in the same state to consume the next character.
    2.14 -		Some states have more complicated behavior and can consume several characters before switching to another state.
    2.15 +		Implementations must act as if they used the following algorithms to tokenize CSS.
    2.16 +		To transform a stream of characters into a stream of tokens,
    2.17 +		repeatedly <i>consume a token</i>
    2.18 +		until an 〈EOF〉 is encountered,
    2.19 +		collecting the returned tokens into a stream.
    2.20 +		Each call to the <i>consume a token</i> algorithm
    2.21 +		returns a single token,
    2.22 +		so it can also be used "on-demand" to tokenize a stream of characters <em>during</em> parsing,
    2.23 +		if so desired.
    2.24  
    2.25  	<p>
    2.26 -		The output of the tokenization step is a series of zero or more of the following tokens:
    2.27 +		The output of the tokenization step is a stream of zero or more of the following tokens:
    2.28  		〈ident〉,
    2.29  		〈function〉,
    2.30  		〈at-keyword〉, 
    2.31 @@ -459,21 +460,27 @@
    2.32  		〈{〉,
    2.33  		and 〈}〉.
    2.34  
    2.35 -	<p>
    2.36 -		〈ident〉, 〈function〉, 〈at-keyword〉, 〈hash〉, 〈string〉, and 〈url〉 tokens have a value composed of zero or more characters.
    2.37 -		Additionally, hash tokens have a type flag set to either "id" or "unrestricted".  The type flag defaults to "unrestricted" if not otherwise set.
    2.38 -		〈delim〉 tokens have a value composed of a single character.
    2.39 -		〈number〉, 〈percentage〉, and 〈dimension〉 tokens have a representation composed of one or more character, and a numeric value.
    2.40 -		〈number〉 and 〈dimension〉 tokens additionally have a type flag set to either "integer" or "number".  The type flag defaults to "integer" if not otherwise set.
    2.41 -		〈dimension〉 tokens additionally have a unit composed of one or more characters.
    2.42 -		〈unicode-range〉 tokens have a range of characters.
    2.43 +	<ul>
    2.44 +		<li>
    2.45 +			〈ident〉, 〈function〉, 〈at-keyword〉, 〈hash〉, 〈string〉, and 〈url〉 tokens have a value composed of zero or more characters.
    2.46 +			Additionally, hash tokens have a type flag set to either "id" or "unrestricted".  The type flag defaults to "unrestricted" if not otherwise set.
    2.47 +		
    2.48 +		<li>
    2.49 +			〈delim〉 tokens have a value composed of a single character.
    2.50 +
    2.51 +		<li>
    2.52 +			〈number〉, 〈percentage〉, and 〈dimension〉 tokens have a representation composed of one or more character, and a numeric value.
    2.53 +			〈number〉 and 〈dimension〉 tokens additionally have a type flag set to either "integer" or "number".  The type flag defaults to "integer" if not otherwise set.
    2.54 +			〈dimension〉 tokens additionally have a unit composed of one or more characters.
    2.55 +
    2.56 +		<li>
    2.57 +			〈unicode-range〉 tokens have a range of characters.
    2.58 +	</ul>
    2.59  
    2.60  	<p class='note'>
    2.61  		The type flag of hash tokens is used in the Selectors syntax [[SELECT]].
    2.62  		Only hash tokens with the "id" type are valid <a href="http://www.w3.org/TR/selectors/#id-selectors">ID selectors</a>.
    2.63  
    2.64 -	<p>
    2.65 -		The tokenizer state machine consists of the states defined in the following subsections.
    2.66  
    2.67  <h3 id='token-diagrams'>
    2.68  Token Railroad Diagrams</h3>
    2.69 @@ -484,8 +491,8 @@
    2.70  	<p>
    2.71  		This section presents an informative view of the tokenizer,
    2.72  		in the form of railroad diagrams.
    2.73 -		Railroad diagrams are more compact than a state-machine,
    2.74 -		but often easier to read than an explicit parser.
    2.75 +		Railroad diagrams are more compact than an explicit parser,
    2.76 +		but often easier to read than an regular expression.
    2.77  
    2.78  	<p>
    2.79  		These diagrams are <em>informative</em> and <em>incomplete</em>;
    2.80 @@ -668,10 +675,17 @@
    2.81  	</dl>
    2.82  
    2.83  <h3>
    2.84 -Tokenizer State Machine</h3>
    2.85 +Tokenizer Algorithms</h3>
    2.86 +
    2.87 +	<p>
    2.88 +		The algorithms defined in this section transform a stream of characters into a stream of tokens.
    2.89  
    2.90  <h4>
    2.91 -<dfn>Data state</dfn></h4>
    2.92 +<dfn>Consume a token</dfn></h4>
    2.93 +
    2.94 +	<p>
    2.95 +		This section describes how to <i>consume a token</i> from a stream of characters.
    2.96 +		It will return a single token of any type.
    2.97  
    2.98  	<p>
    2.99  		Consume the <i>next input character</i>.
   2.100 @@ -680,99 +694,96 @@
   2.101  		<dt><i>whitespace</i>
   2.102  		<dd>
   2.103  			Consume as much <i>whitespace</i> as possible.
   2.104 -			Emit a 〈whitespace〉.
   2.105 -			Remain in this state.
   2.106 +			Return a 〈whitespace〉.
   2.107  
   2.108  		<dt>U+0022 QUOTATION MARK (")
   2.109  		<dd>
   2.110 -			Switch to the <i>double-quote-string state</i>.
   2.111 +			<i>Consume a string token</i> with the ending character U+0022 QUOTATION MARK (")
   2.112 +			and return it.
   2.113  
   2.114  		<dt>U+0023 NUMBER SIGN (#)
   2.115  		<dd>
   2.116  			If the <i>next input character</i> is a <i>name character</i>
   2.117  			or the <i title="next input character">next two input characters</i>
   2.118  			<i>are a valid escape</i>,
   2.119 -			If the <i title="next input character">next three input characters</i>
   2.120 -			<i>would start an identifier</i>,
   2.121 -			set the 〈hash〉's type flag to "id".
   2.122 -			Switch to the <i>hash state</i>.
   2.123 +			<i>consume a name</i>.
   2.124 +			Create a 〈hash〉 with its value set to the returned string.
   2.125 +			If the first three characters of the 〈hash〉’s value <i>would start an identifier</i>,
   2.126 +			set the 〈hash〉’s type flag to "id".
   2.127 +			Return the 〈hash〉.
   2.128  
   2.129  			<p>
   2.130  				Otherwise,
   2.131 -				emit a 〈delim〉
   2.132 +				return a 〈delim〉
   2.133  				with its value set to the <i>current input character</i>.
   2.134 -				Remain in this state.
   2.135  
   2.136  		<dt>U+0024 DOLLAR SIGN ($)
   2.137  		<dd>
   2.138  			If the <i>next input character</i> is
   2.139  			U+003D EQUALS SIGN (=),
   2.140  			consume it
   2.141 -			and emit a 〈suffix-match〉.
   2.142 -			Remain in this state.
   2.143 +			and return a 〈suffix-match〉.
   2.144  
   2.145  			<p>
   2.146  				Otherwise,
   2.147  				emit a 〈delim〉
   2.148  				with its value set to the <i>current input character</i>.
   2.149 -				Remain in this state.
   2.150  
   2.151  		<dt>U+0027 APOSTROPHE (&apos;)
   2.152  		<dd>
   2.153 -			Switch to the <i>single-quote-string state</i>.
   2.154 +			<i>Consume a string token</i> with the ending character U+0027 APOSTROPHE (&apos;)
   2.155 +			and return it.
   2.156  
   2.157  		<dt>U+0028 LEFT PARENTHESIS (()
   2.158  		<dd>
   2.159 -			Emit a 〈(〉.
   2.160 -			Remain in this state.
   2.161 +			Return a 〈(〉.
   2.162  
   2.163  		<dt>U+0029 RIGHT PARENTHESIS ())
   2.164  		<dd>
   2.165 -			Emit a 〈)〉.
   2.166 -			Remain in this state.
   2.167 +			Return a 〈)〉.
   2.168  
   2.169  		<dt>U+002A ASTERISK (*)
   2.170  		<dd>
   2.171  			If the <i>next input character</i> is
   2.172  			U+003D EQUALS SIGN (=),
   2.173  			consume it
   2.174 -			and emit a 〈substring-match〉.
   2.175 -			Remain in this state.
   2.176 +			and return a 〈substring-match〉.
   2.177  
   2.178  			<p>
   2.179  				Otherwise,
   2.180 -				emit a 〈delim〉
   2.181 +				return a 〈delim〉
   2.182  				with its value set to the <i>current input character</i>.
   2.183 -				Remain in this state.
   2.184  
   2.185  		<dt>U+002B PLUS SIGN (+)
   2.186  		<dd>
   2.187  			If the input stream <i>starts with a number</i>,
   2.188 -			<i>reconsume the current input character</i>
   2.189 -			and switch to the <i>number state</i>.
   2.190 +			<i>reconsume the current input character</i>,
   2.191 +			<i>consume a numeric token</i>
   2.192 +			and return it.
   2.193  
   2.194  			<p>
   2.195  				Otherwise,
   2.196 -				emit a 〈delim〉
   2.197 +				return a 〈delim〉
   2.198  				with its value set to the <i>current input character</i>.
   2.199 -				Remain in this state.
   2.200  
   2.201  		<dt>U+002C COMMA (,)
   2.202  		<dd>
   2.203 -			Emit a 〈comma〉.
   2.204 -			Remain in this state.
   2.205 +			Return a 〈comma〉.
   2.206  
   2.207  		<dt>U+002D HYPHEN-MINUS (-)
   2.208  		<dd>
   2.209  			If the input stream <i>starts with a number</i>,
   2.210 -			<i>reconsume the current input character</i>
   2.211 -			and switch to the <i>number state</i>.
   2.212 +			<i>reconsume the current input character</i>,
   2.213 +			<i>consume a numeric token</i>,
   2.214 +			and return it.
   2.215  
   2.216  			<p>
   2.217  				Otherwise,
   2.218  				if the input stream <i>starts with an identifier</i>,
   2.219 -				switch to the <i>ident state</i>.
   2.220 -				<i>Reconsume the current input character</i>.
   2.221 +				<i>reconsume the current input character</i>,
   2.222 +				<i>consume a name</i>,
   2.223 +				create an 〈ident〉 with its value set to the returned value,
   2.224 +				and return it.
   2.225  
   2.226  			<p>
   2.227  				Otherwise,
   2.228 @@ -780,49 +791,48 @@
   2.229  				U+002D HYPHEN-MINUS
   2.230  				U+003E GREATER-THAN SIGN
   2.231  				(->),
   2.232 -				consume them,
   2.233 -				emit a 〈CDC〉,
   2.234 -				and remain in this state.
   2.235 +				consume them
   2.236 +				and return a 〈CDC〉.
   2.237  
   2.238  			<p>
   2.239  				Otherwise,
   2.240 -				emit a 〈delim〉
   2.241 +				return a 〈delim〉
   2.242  				with its value set to the <i>current input character</i>.
   2.243 -				Remain in this state.
   2.244  
   2.245  		<dt>U+002E FULL STOP (.)
   2.246  		<dd>
   2.247  			If the input stream <i>starts with a number</i>,
   2.248 -			<i>reconsume the current input character</i>
   2.249 -			and switch to the <i>number state</i>.
   2.250 +			<i>reconsume the current input character</i>,
   2.251 +			<i>consume a numeric token</i>,
   2.252 +			and return it.
   2.253  
   2.254  			<p>
   2.255  				Otherwise,
   2.256 -				emit a 〈delim〉
   2.257 +				return a 〈delim〉
   2.258  				with its value set to the <i>current input character</i>.
   2.259 -				Remain in this state.
   2.260  
   2.261  		<dt>U+002F SOLIDUS (/)
   2.262  		<dd>
   2.263  			If the <i>next input character</i> is U+002A ASTERISK (*),
   2.264  			consume it
   2.265 -			and switch to the <i>comment state</i>.
   2.266 +			and all following characters up to and including
   2.267 +			the first U+002A ASTERISK (*) followed by a U+002F SOLIDUS (/),
   2.268 +			or up to an EOF character.
   2.269 +			Then <i>consume a token</i>
   2.270 +			and return it.
   2.271  
   2.272  			<p>
   2.273  				Otherwise,
   2.274 -				emit a 〈delim〉
   2.275 -				with its value set to U+002F SOLIDUS (/).
   2.276 -				Remain in this state.
   2.277 +				return a 〈delim〉
   2.278 +				with its value set to the <i>current input character</i>.
   2.279  
   2.280  		<dt>U+003A COLON (:)
   2.281  		<dd>
   2.282 -			Emit a 〈colon〉.
   2.283 -			Remain in this state.
   2.284 +			Return a 〈colon〉.
   2.285  
   2.286  		<dt>U+003B SEMICOLON (;)
   2.287  		<dd>
   2.288 -			Emit a 〈semicolon〉.
   2.289 -			Remain in this state.
   2.290 +			Return a 〈semicolon〉.
   2.291  
   2.292  		<dt>U+003C LESS-THAN SIGN (&lt;)
   2.293  		<dd>
   2.294 @@ -832,78 +842,72 @@
   2.295  			U+002D HYPHEN-MINUS
   2.296  			(!--),
   2.297  			consume them
   2.298 -			and emit a 〈CDO〉.
   2.299 -			Remain in this state.
   2.300 +			and return a 〈CDO〉.
   2.301  
   2.302  			<p>
   2.303  				Otherwise,
   2.304 -				emit a 〈delim〉
   2.305 -				with its value set to U+003C LESS-THAN SIGN (&lt;).
   2.306 -				Remain in this state.
   2.307 +				return a 〈delim〉
   2.308 +				with its value set to the <i>current input character</i>.
   2.309  
   2.310  		<dt>U+0040 COMMERCIAL AT (@)
   2.311  		<dd>
   2.312  			If the <i title="next input character">next 3 input characters</i>
   2.313  			<i>would start an identifier</i>,
   2.314 -			switch to the <i>at-keyword state</i>.
   2.315 +			<i>consume a name</i>,
   2.316 +			create an 〈at-keyword〉 with its value set to the returned value,
   2.317 +			and return it.
   2.318  
   2.319  			<p>
   2.320  				Otherwise,
   2.321 -				emit a 〈delim〉
   2.322 +				return a 〈delim〉
   2.323  				with its value set to the <i>current input character</i>.
   2.324 -				Remain in this state.
   2.325  
   2.326  		<dt>U+005B LEFT SQUARE BRACKET ([)
   2.327  		<dd>
   2.328 -			Emit a 〈[〉.
   2.329 -			Remain in this state.
   2.330 +			Return a 〈[〉.
   2.331  
   2.332  		<dt>U+005C REVERSE SOLIDUS (\)
   2.333  		<dd>
   2.334  			If the input stream <i>starts with a valid escape</i>,
   2.335 -			switch to the <i>ident state</i>.
   2.336 -			<i>Reconsume the current input character</i>.
   2.337 +			<i>reconsume the current input character</i>,
   2.338 +			<i>consume a name</i>,
   2.339 +			create an 〈ident〉 with its value set to the returned value,
   2.340 +			and return it.
   2.341  
   2.342  			<p>
   2.343  				Otherwise,
   2.344  				this is a <i>parse error</i>.
   2.345 -				Emit a 〈delim〉
   2.346 +				Return a 〈delim〉
   2.347  				with its value set to the <i>current input character</i>.
   2.348 -				Remain in this state.
   2.349  
   2.350  		<dt>U+005D RIGHT SQUARE BRACKET (])
   2.351  		<dd>
   2.352 -			Emit a 〈]〉.
   2.353 -			Remain in this state.
   2.354 +			Return a 〈]〉.
   2.355  
   2.356  		<dt>U+005E CIRCUMFLEX ACCENT (^)
   2.357  		<dd>
   2.358  			If the <i>next input character</i> is
   2.359  			U+003D EQUALS SIGN (=),
   2.360  			consume it
   2.361 -			and emit a 〈prefix-match〉.
   2.362 -			Remain in this state.
   2.363 +			and return a 〈prefix-match〉.
   2.364  
   2.365  			<p>
   2.366  				Otherwise,
   2.367 -				emit a 〈delim〉
   2.368 +				return a 〈delim〉
   2.369  				with its value set to the <i>current input character</i>.
   2.370 -				Remain in this state.
   2.371  
   2.372  		<dt>U+007B LEFT CURLY BRACKET ({)
   2.373  		<dd>
   2.374 -			Emit a 〈{〉.
   2.375 -			Remain in this state.
   2.376 +			Return a 〈{〉.
   2.377  
   2.378  		<dt>U+007D RIGHT CURLY BRACKET (})
   2.379  		<dd>
   2.380 -			Emit a 〈}〉.
   2.381 -			Remain in this state.
   2.382 +			Return a 〈}〉.
   2.383  
   2.384  		<dt><i>digit</i>
   2.385  		<dd>
   2.386 -			Switch to the <i>number state</i>.
   2.387 -			<i>Reconsume the current input character</i>.
   2.388 +			<i>Consume a numeric token</i>,
   2.389 +			and return it.
   2.390  
   2.391  		<dt>U+0055 LATIN CAPITAL LETTER U (U)
   2.392  		<dt>U+0075 LATIN SMALL LETTER U (u)
   2.393 @@ -914,856 +918,333 @@
   2.394  			or U+003F QUESTION MARK (?),
   2.395  			consume the <i>next input character</i>.
   2.396  			<span class='note'>Note: don't consume both of them.</span>
   2.397 -			Switch to the <i>unicode-range state</i>.
   2.398 +			<i>Consume a unicode-range token</i>
   2.399 +			and return it.
   2.400 +
   2.401 +			<p>
   2.402 +				Otherwise, if the <i title="next input character">next 3 input characters</i> are
   2.403 +				an <i>ASCII case-insensitive match</i> for "url(",
   2.404 +				consume them,
   2.405 +				<i>consume a url token</i>,
   2.406 +				and return it.
   2.407  
   2.408  			<p>
   2.409  				Otherwise,
   2.410 -				switch to the <i>ident state</i>.
   2.411 -				<i>Reconsume the current input character</i>.
   2.412 +				<i>reconsume the current input character</i>,
   2.413 +				<i>consume a name</i>,
   2.414 +				create an 〈ident〉 with its value set to the returned value,
   2.415 +				and return it.
   2.416  
   2.417  		<dt><i>name-start character</i>
   2.418  		<dd>
   2.419 -			Switch to the <i>ident state</i>.
   2.420 -			<i>Reconsume the current input character</i>.
   2.421 +			<i>Reconsume the current input character</i>,
   2.422 +			<i>consume a name</i>,
   2.423 +			create an 〈ident〉 with its value set to the returned value,
   2.424 +			and return it.
   2.425  
   2.426  		<dt>U+007C VERTICAL LINE (|)
   2.427  		<dd>
   2.428  			If the <i>next input character</i> is
   2.429  			U+003D EQUALS SIGN (=),
   2.430  			consume it
   2.431 -			and emit a 〈dash-match〉.
   2.432 -			Remain in this state.
   2.433 +			and return a 〈dash-match〉.
   2.434  
   2.435  			<p>
   2.436  				Otherwise,
   2.437  				if the <i>next input character</i> is
   2.438  				U+0073 VERTICAL LINE (|),
   2.439  				consume it
   2.440 -				and emit a 〈column〉.
   2.441 -				Remain in this state.
   2.442 +				and return a 〈column〉.
   2.443  
   2.444  			<p>
   2.445  				Otherwise,
   2.446 -				emit a 〈delim〉
   2.447 +				return a 〈delim〉
   2.448  				with its value set to the <i>current input character</i>.
   2.449 -				Remain in this state.
   2.450  
   2.451  		<dt>U+007E TILDE (~)
   2.452  		<dd>
   2.453  			If the <i>next input character</i> is
   2.454  			U+003D EQUALS SIGN (=),
   2.455  			consume it
   2.456 -			and emit an 〈include-match〉.
   2.457 -			Remain in this state.
   2.458 +			and return an 〈include-match〉.
   2.459  
   2.460  			<p>
   2.461  				Otherwise,
   2.462 -				emit a 〈delim〉
   2.463 +				return a 〈delim〉
   2.464  				with its value set to the <i>current input character</i>.
   2.465 -				Remain in this state.
   2.466  
   2.467  		<dt>EOF
   2.468  		<dd>
   2.469 -			End this algorithm.
   2.470 +			Return an 〈EOF〉 token.
   2.471  
   2.472  		<dt>anything else
   2.473  		<dd>
   2.474 -			Emit a 〈delim〉
   2.475 +			Return a 〈delim〉
   2.476  			with its value set to the <i>current input character</i>.
   2.477 -			Remain in this state.
   2.478  	</dl>
   2.479  
   2.480 +
   2.481 +
   2.482 +
   2.483  <h4>
   2.484 -<dfn>Double-quote-string state</dfn></h4>
   2.485 +<dfn>Consume a numeric token</dfn></h4>
   2.486  
   2.487  	<p>
   2.488 -		When this state is first entered,
   2.489 -		create a 〈string〉
   2.490 -		with its value initially set to the empty string.
   2.491 +		This section describes how to <i>consume a numeric token</i> from a stream of characters.
   2.492 +		It returns either a 〈number〉, 〈percentage〉, or 〈dimension〉.
   2.493  
   2.494  	<p>
   2.495 -		Consume the <i>next input character</i>.
   2.496 +		<i>Consume a number</i>.
   2.497 +
   2.498 +	<p>
   2.499 +		If the <i title="next input character">next 3 input characters</i> <i>would start an identifier</i>,
   2.500 +		then:
   2.501 +
   2.502 +		<ol>
   2.503 +			<li>Create a 〈dimension〉 with the same representation, value, and type flag as the returned number,
   2.504 +				and a unit set initially to the empty string.
   2.505 +
   2.506 +			<li><i>Consume a name</i>.
   2.507 +				Set the 〈dimension〉’s unit to the returned value.
   2.508 +
   2.509 +			<li>Return the 〈dimension〉.
   2.510 +		</ol>
   2.511 +
   2.512 +	<p>
   2.513 +		Otherwise,
   2.514 +		if the <i>next input character</i> is U+0025 PERCENTAGE SIGN (%),
   2.515 +		consume it.
   2.516 +		Create a 〈percentage〉 with the same representation and value as the returned number,
   2.517 +		and return it.
   2.518 +
   2.519 +	<p>
   2.520 +		Otherwise,
   2.521 +		create a 〈number〉 with the same representation, value, and type flag as the returned number,
   2.522 +		and return it.
   2.523 +
   2.524 +
   2.525 +<h4>
   2.526 +<dfn>Consume a string token</dfn></h4>
   2.527 +
   2.528 +	<p>
   2.529 +		This section describes how to <i>consume a string token</i> from a stream of characters.
   2.530 +		It returns either a 〈string〉 or 〈bad-string〉.
   2.531 +
   2.532 +	<p>
   2.533 +		This algorithm must be called with an <var>ending character</var>,
   2.534 +		which denotes the character that ends the string.
   2.535 +
   2.536 +	<p>
   2.537 +		Initially create a 〈string〉 with its value set to the empty string.
   2.538 +
   2.539 +	<p>
   2.540 +		Repeatedly consume the <i>next input character</i> from the stream:
   2.541  
   2.542  	<dl>
   2.543 -		<dt>U+0022 QUOTATION MARK (")
   2.544 +		<dt><var>ending character</var>
   2.545  		<dt>EOF
   2.546  		<dd>
   2.547 -			Emit the 〈string〉.
   2.548 -			Switch to the <i>data state</i>.
   2.549 +			Return the 〈string〉.
   2.550  
   2.551  		<dt><i>newline</i>
   2.552  		<dd>
   2.553  			This is a <i>parse error</i>.
   2.554 -			Emit a 〈bad-string〉.
   2.555 -			Switch to the <i>data state</i>.
   2.556 -			<i>Reconsume the current input character</i>.
   2.557 +			Create a 〈bad-string〉 and return it.
   2.558  
   2.559  		<dt>U+005C REVERSE SOLIDUS (\)
   2.560  		<dd>
   2.561 -			If the current input stream <i>starts with a valid escape</i>,
   2.562 +			If the stream <i>starts with a valid escape</i>,
   2.563  			<i>consume an escaped character</i>
   2.564 -			and append the return value to the 〈string〉’s value.
   2.565 -			Remain in this state.
   2.566 +			and append the returned character to the 〈string〉’s value.
   2.567  
   2.568  			<p>
   2.569  				Otherwise,
   2.570 -				if the <i>next input character</i> is
   2.571 -				a <i>newline</i>,
   2.572 +				if the <i>next input character</i> is a newline,
   2.573  				consume it.
   2.574 -				Remain in this state.
   2.575  
   2.576  			<p>
   2.577  				Otherwise,
   2.578  				this is a <i>parse error</i>.
   2.579 -				Emit a 〈bad-string〉,
   2.580 -				then switch to the <i>data state</i>.
   2.581 +				Create a 〈bad-string〉 and return it.
   2.582  
   2.583  		<dt>anything else
   2.584  		<dd>
   2.585 -			Append the <i>current input character</i>
   2.586 -			to the 〈string〉’s value.
   2.587 -			Remain in this state.
   2.588 +			Append the <i>current input character</i> to the 〈string〉’s value.
   2.589  	</dl>
   2.590  
   2.591 +
   2.592  <h4>
   2.593 -<dfn>Single-quote-string state</dfn></h4>
   2.594 +<dfn>Consume a url token</dfn>
   2.595  
   2.596  	<p>
   2.597 -		When this state is first entered,
   2.598 -		create a 〈string〉
   2.599 -		with its value initially set to the empty string.
   2.600 +		This section describes how to <i>consume a url token</i> from a stream of characters.
   2.601 +		It returns either a 〈url〉 or a 〈bad-url〉.
   2.602 +
   2.603 +	<p class='note'>
   2.604 +		This algorithm assumes that the initial "url(" has already been consumed.
   2.605  
   2.606  	<p>
   2.607 -		Consume the <i>next input character</i>.
   2.608 -
   2.609 -	<dl>
   2.610 -		<dt>U+0027 APOSTROPHE (&apos;)
   2.611 -		<dt>EOF
   2.612 -		<dd>
   2.613 -			Emit the 〈string〉.
   2.614 -			Switch to the <i>data state</i>.
   2.615 -
   2.616 -		<dt><i>newline</i>
   2.617 -		<dd>
   2.618 -			This is a <i>parse error</i>.
   2.619 -			Emit a 〈bad-string〉.
   2.620 -			Switch to the <i>data state</i>.
   2.621 -			<i>Reconsume the current input character</i>.
   2.622 -
   2.623 -		<dt>U+005C REVERSE SOLIDUS (\)
   2.624 -		<dd>
   2.625 -			If the current input stream <i>starts with a valid escape</i>,
   2.626 -			<i>consume an escaped character</i>
   2.627 -			and append the return value to the 〈string〉’s value.
   2.628 -			Remain in this state.
   2.629 +		Execute the following steps in order:
   2.630 +
   2.631 +	<ol>
   2.632 +		<li>
   2.633 +			Initially create a 〈url〉 with its value set to the empty string.
   2.634 +
   2.635 +		<li>
   2.636 +			Consume as much <i>whitespace</i> as possible.
   2.637 +
   2.638 +		<li>
   2.639 +			If the <i>next input character</i> is EOF,
   2.640 +			create a 〈bad-url〉 and return it.
   2.641 +
   2.642 +		<li>
   2.643 +			If the <i>next input character</i> is a U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE (&apos;),
   2.644 +			then:
   2.645 +
   2.646 +			<ol>
   2.647 +				<li>
   2.648 +					<i>Consume a string token</i> with the <i>current input character</i> as the ending character.
   2.649 +
   2.650 +				<li>
   2.651 +					If a 〈bad-string〉 was returned,
   2.652 +					<i>consume the remnants of a bad url</i>,
   2.653 +					create a 〈bad-url〉,
   2.654 +					and return it.
   2.655 +
   2.656 +				<li>
   2.657 +					Set the 〈url〉’s value to the returned 〈string〉’s value.
   2.658 +
   2.659 +				<li>
   2.660 +					Consume as much <i>whitespace</i> as possible.
   2.661 +
   2.662 +				<li>
   2.663 +					If the <i>next input character</i> is U+0029 RIGHT PARENTHESIS ()) or EOF,
   2.664 +					consume it and return the 〈url〉;
   2.665 +					otherwise,
   2.666 +					<i>consume the remnants of a bad url</i>,
   2.667 +					create a 〈bad-url〉,
   2.668 +					and return it.
   2.669 +			</ol>
   2.670 +
   2.671 +		<li>
   2.672 +			Repeatedly consume the <i>next input character</i> from the stream:
   2.673 +
   2.674 +			<dl>
   2.675 +				<dt>U+0029 RIGHT PARENTHESIS ())
   2.676 +				<dt>EOF
   2.677 +				<dd>
   2.678 +					Return the 〈url〉.
   2.679 +
   2.680 +				<dt><i>whitespace</i>
   2.681 +				<dd>
   2.682 +					Consume as much <i>whitespace</i> as possible.
   2.683 +					If the <i>next input character</i> is U+0029 RIGHT PARENTHESIS ()) or EOF,
   2.684 +					consume it and return the 〈url〉;
   2.685 +					otherwise,
   2.686 +					<i>consume the remnants of a bad url</i>,
   2.687 +					create a 〈bad-url〉,
   2.688 +					and return it.
   2.689 +
   2.690 +				<dt>U+0022 QUOTATION MARK (")
   2.691 +				<dt>U+0027 APOSTROPHE (&apos;)
   2.692 +				<dt>U+0028 LEFT PARENTHESIS (()
   2.693 +				<dt><i>non-printable character</i>
   2.694 +				<dd>
   2.695 +					This is a <i>parse error</i>.
   2.696 +					<i>Consume the remnants of a bad url</i>,
   2.697 +					create a 〈bad-url〉,
   2.698 +					and return it.
   2.699 +
   2.700 +				<dt>U+005C REVERSE SOLIDUS
   2.701 +				<dd>
   2.702 +					If the stream <i>starts with a valid escape</i>,
   2.703 +					<i>consume an escaped character</i>
   2.704 +					and append the returned character to the 〈url〉’s value.
   2.705 +
   2.706 +					<p>
   2.707 +						Otherwise,
   2.708 +						this is a <i>parse error</i>.
   2.709 +						<i>Consume the remnants of a bad url</i>,
   2.710 +						create a 〈bad-url〉,
   2.711 +						and return it.
   2.712 +
   2.713 +				<dt>anything else
   2.714 +				<dd>
   2.715 +					Append the <i>current input character</i>
   2.716 +					to the 〈url〉’s value.
   2.717 +			</dl>
   2.718 +	</dl>
   2.719 +
   2.720 +
   2.721 +<h4>
   2.722 +<dfn>Consume a unicode-range token</dfn></h4>
   2.723 +
   2.724 +	<p>
   2.725 +		This section describes how to <i>consume a unicode-range token</i>.
   2.726 +		It returns a 〈unicode-range〉 token.
   2.727 +
   2.728 +	<p class='note'>
   2.729 +		This algorithm assumes that the initial "u+" has been consumed,
   2.730 +		and the next character verified to be a <i>hex digit</i> or a "?".
   2.731 +
   2.732 +	<p>
   2.733 +		Execute the following steps in order:
   2.734 +
   2.735 +	<ol>
   2.736 +		<li>
   2.737 +			Create a new 〈unicode-range〉
   2.738 +			with an empty range.
   2.739 +
   2.740 +		<li>
   2.741 +			Consume as many <i>hex digits</i> as possible, but no more than 6.
   2.742 +			If less than 6 <i>hex digits</i> were consumed,
   2.743 +			consume as many U+003F QUESTION MARK (?) characters as possible,
   2.744 +			but no more than enough to make the total of <i>hex digits</i> and U+003F QUESTION MARK (?) characters equal to 6.
   2.745 +
   2.746 +			<p>
   2.747 +				If any U+003F QUESTION MARK (?) characters were consumed,
   2.748 +				then:
   2.749 +
   2.750 +			<ol>
   2.751 +				<li>
   2.752 +					Interpret the consumed characters as a hexadecimal number,
   2.753 +					with the U+003F QUESTION MARK (?) characters replaced by U+0030 DIGIT ZERO (0) characters.
   2.754 +					This is the <i>start of the range</i>.
   2.755 +
   2.756 +				<li>
   2.757 +					Interpret the consumed characters as a hexadecimal number again,
   2.758 +					with the U+003F QUESTION MARK (?) character replaced by U+0046 LATIN CAPITAL LETTER F (F) characters.
   2.759 +					This is the <i>end of the range</i>.
   2.760 +
   2.761 +				<li>
   2.762 +					<i>Set the 〈unicode-range〉’s range</i>, then return it.
   2.763 +			</ol>
   2.764  
   2.765  			<p>
   2.766  				Otherwise,
   2.767 -				if the <i>next input character</i> is
   2.768 -				a <i>newline</i>,
   2.769 -				consume it.
   2.770 -				Remain in this state.
   2.771 -
   2.772 -			<p>
   2.773 -				Otherwise,
   2.774 -				this is a <i>parse error</i>.
   2.775 -				Emit a 〈bad-string〉,
   2.776 -				then switch to the <i>data state</i>.
   2.777 -
   2.778 -		<dt>anything else
   2.779 -		<dd>
   2.780 -			Append the <i>current input character</i>
   2.781 -			to the 〈string〉’s value.
   2.782 -			Remain in this state.
   2.783 -	</dl>
   2.784 -
   2.785 -<h4>
   2.786 -<dfn>Hash state</dfn></h4>
   2.787 -
   2.788 -	<p>
   2.789 -		Consume the <i>next input character</i>.
   2.790 -
   2.791 -	<dl>
   2.792 -		<dt><i>name character</i>
   2.793 -		<dd>
   2.794 -			Append the <i>current input character</i>
   2.795 -			to the 〈hash〉’s value.
   2.796 -			Remain in this state.
   2.797 -
   2.798 -		<dt>U+005C REVERSE SOLIDUS (\)
   2.799 -		<dd>
   2.800 -			If the input stream <i>starts with a valid escape</i>,
   2.801 -			<i>consume an escaped character</i>
   2.802 -			and append the returned character to the 〈hash〉’s value.
   2.803 -			Remain in this state.
   2.804 -
   2.805 -			<p>
   2.806 -				Otherwise,
   2.807 -				this is a <i>parse error</i>.
   2.808 -				Emit the 〈hash〉.
   2.809 -				Switch to the <i>data state</i>.
   2.810 -				<i>Reconsume the current input character</i>.
   2.811 -
   2.812 -		<dt>anything else
   2.813 -		<dd>
   2.814 -			Emit the 〈hash〉.
   2.815 -			Switch to the <i>data state</i>.
   2.816 -			<i>Reconsume the current input character</i>.
   2.817 -	</dl>
   2.818 -
   2.819 -	<p class='note'>
   2.820 -		If this state emits a 〈hash〉 whose value is the empty string,
   2.821 -		it's a spec or implementation error.
   2.822 -		The data validation performed in the <i>data state</i> should have guaranteed a non-empty value.
   2.823 -
   2.824 -<h4>
   2.825 -<dfn>Comment state</dfn></h4>
   2.826 -
   2.827 -	<p>
   2.828 -		Consume the <i>next input character</i>.
   2.829 -
   2.830 -	<dl>
   2.831 -		<dt>U+002A ASTERISK (*)
   2.832 -		<dd>
   2.833 -			If the <i>next input character</i> is
   2.834 -			U+002F SOLIDUS (/),
   2.835 -			consume it,
   2.836 -			and switch to the <i>data state</i>.
   2.837 -
   2.838 -			<p>
   2.839 -				Otherwise,
   2.840 -				do nothing
   2.841 -				and remain in this state.
   2.842 -
   2.843 -		<dt>EOF
   2.844 -		<dd>
   2.845 -			This is a <i>parse error</i>.
   2.846 -			Switch to the <i>data state</i>.
   2.847 -			<i>Reconsume the current input character</i>.
   2.848 -
   2.849 -		<dt>anything else
   2.850 -		<dd>
   2.851 -			Do nothing
   2.852 -			and remain in this state.
   2.853 -	</dl>
   2.854 -
   2.855 -<h4>
   2.856 -<dfn>At-keyword state</dfn></h4>
   2.857 -
   2.858 -	<p>
   2.859 -		When this state is first entered,
   2.860 -		create an 〈at-keyword〉
   2.861 -		with its value initially set to the empty string.
   2.862 -
   2.863 -	<p>
   2.864 -		Consume the <i>next input character</i>.
   2.865 -
   2.866 -	<dl>
   2.867 -		<dt><i>name character</i>
   2.868 -		<dd>
   2.869 -			Append the <i>current input character</i>
   2.870 -			to the 〈at-keyword〉’s value.
   2.871 -			Remain in this state.
   2.872 -
   2.873 -		<dt>U+005C REVERSE SOLIDUS (\)
   2.874 -		<dd>
   2.875 -			If the input stream <i>starts with a valid escape</i>,
   2.876 -			<i>consume an escaped character</i>.
   2.877 -			Append the returned character to the 〈at-keyword〉’s value.
   2.878 -			Remain in this state.
   2.879 -
   2.880 -			<p>
   2.881 -				Otherwise,
   2.882 -				emit the 〈at-keyword〉.
   2.883 -				Switch to the <i>data state</i>.
   2.884 -				<i>Reconsume the current input character</i>.
   2.885 -
   2.886 -		<dt>anything else
   2.887 -		<dd>
   2.888 -			Emit the 〈at-keyword〉.
   2.889 -			Switch to the <i>data state</i>.
   2.890 -			<i>Reconsume the current input character</i>.
   2.891 -	</dl>
   2.892 -
   2.893 -	<p class='note'>
   2.894 -		If this state emits an 〈at-keyword〉 whose value is the empty string,
   2.895 -		it's a spec or implementation error.
   2.896 -		The data validation performed in the <i>data state</i> should have guaranteed a non-empty value.
   2.897 -
   2.898 -<h4>
   2.899 -<dfn>Ident state</dfn></h4>
   2.900 -
   2.901 -	<p>
   2.902 -		When this state is first entered,
   2.903 -		create an 〈ident〉
   2.904 -		with its value initially set to the empty string.
   2.905 -
   2.906 -	<p>
   2.907 -		Consume the <i>next input character</i>.
   2.908 -
   2.909 -	<dl>
   2.910 -		<dt><i>name character</i>
   2.911 -		<dd>
   2.912 -			Append the <i>current input character</i>
   2.913 -			to the 〈ident〉’s value.
   2.914 -			Remain in this state.
   2.915 -
   2.916 -		<dt>U+005C REVERSE SOLIDUS (\)
   2.917 -		<dd>
   2.918 -			If the input stream <i>starts with a valid escape</i>,
   2.919 -			<i>consume an escaped character</i>.
   2.920 -			Append the returned character to the 〈ident〉’s value.
   2.921 -			Remain in this state.
   2.922 -
   2.923 -			<p>
   2.924 -				Otherwise,
   2.925 -				emit the 〈ident〉.
   2.926 -				Switch to the <i>data state</i>.
   2.927 -				<i>Reconsume the current input character</i>.
   2.928 -
   2.929 -		<dt>U+0028 LEFT PARENTHESIS (()
   2.930 -		<dd>
   2.931 -			If the 〈ident〉’s value is
   2.932 -			an <i>ASCII case-insensitive</i> match for "url",
   2.933 -			switch to the <i>url state</i>.
   2.934 -
   2.935 -			<p>
   2.936 -				Otherwise,
   2.937 -				emit a 〈function〉
   2.938 -				with its value set to the 〈ident〉’s value.
   2.939 -				Switch to the <i>data state</i>.
   2.940 -
   2.941 -		<dt>anything else
   2.942 -		<dd>
   2.943 -			Emit the 〈ident〉.
   2.944 -			Switch to the <i>data state</i>.
   2.945 -			<i>Reconsume the current input character</i>.
   2.946 -	</dl>
   2.947 -
   2.948 -
   2.949 -<h4>
   2.950 -<dfn>Number state</dfn></h4>
   2.951 -
   2.952 -	<p>
   2.953 -		Create a 〈number〉
   2.954 -		with its representation initially set to the empty string.
   2.955 -
   2.956 -	<p>
   2.957 -		Consume the <i>next input character</i>.
   2.958 -
   2.959 -	<dl>
   2.960 -		<dt>U+002B PLUS SIGN (+)
   2.961 -		<dt>U+002D HYPHEN-MINUS (-)
   2.962 -		<dd>
   2.963 -			Append the <i>current input character</i> to the 〈number〉’s representation.
   2.964 -
   2.965 -			<p>
   2.966 -				If the <i>next input character</i> is
   2.967 -				U+002E FULL STOP (.),
   2.968 -				consume the <i title="next input character">next two input characters</i>
   2.969 -				and append them to the 〈number〉’s representation.
   2.970 -				Set the 〈number〉’s type flag to "number".
   2.971 -				Switch to the <i>number-rest state</i>.
   2.972 -
   2.973 -			<p>
   2.974 -				Otherwise, 
   2.975 -				consume the <i>next input character</i> 
   2.976 -				and append it to the 〈number〉’s representation.
   2.977 -				Switch to the <i>number-rest state</i>.
   2.978 -
   2.979 -		<dt>U+002E FULL STOP (.)
   2.980 -		<dd>
   2.981 -			Append the <i>current input character</i> to the 〈number〉’s representation.
   2.982 -			Consume the <i>next input character</i>
   2.983 -			and append it to the 〈number〉’s representation.
   2.984 -			Set the 〈number〉’s type flag to "number".
   2.985 -			Switch to the <i>number-rest state</i>.
   2.986 -
   2.987 -		<dt><i>digit</i>
   2.988 -		<dd>
   2.989 -			Append the <i>current input character</i>
   2.990 -			to the 〈number〉’s representation.
   2.991 -			Switch to the <i>number-rest state</i>.
   2.992 -
   2.993 -		<dt>anything else
   2.994 -		<dd>
   2.995 -			<p class='note'>
   2.996 -				Reaching this state indicates an error
   2.997 -				either in the spec or the implementation.
   2.998 -	</dl>
   2.999 -
  2.1000 -<h4>
  2.1001 -<dfn>Number-rest state</dfn></h4>
  2.1002 -
  2.1003 -	<p>
  2.1004 -		Consume the <i>next input character</i>.
  2.1005 -
  2.1006 -	<dl>
  2.1007 -		<dt><i>digit</i>
  2.1008 -		<dd>
  2.1009 -			Append the <i>current input character</i>
  2.1010 -			to the 〈number〉’s representation.
  2.1011 -			Remain in this state.
  2.1012 -
  2.1013 -		<dt>U+002E FULL STOP (.)
  2.1014 -		<dd>
  2.1015 -			If the 〈number〉’s type flag is currently "integer"
  2.1016 -			and the <i>next input character</i> is
  2.1017 -			a <i>digit</i>,
  2.1018 -			consume it.
  2.1019 -			Append U+002E FULL STOP (.)
  2.1020 -			followed by the <i>digit</i>
  2.1021 -			to the 〈number〉’s representation.
  2.1022 -			Set the 〈number〉’s type flag to "number".
  2.1023 -			Remain in this state.
  2.1024 -
  2.1025 -			<p>
  2.1026 -				Otherwise,
  2.1027 -				set the 〈number〉’s value to the number
  2.1028 -				produced by interpreting the 〈number〉’s representation
  2.1029 -				as a base-10 number
  2.1030 -				and emit it.
  2.1031 -				Switch to the <i>data state</i>.
  2.1032 -				<i>Reconsume the current input character</i>.
  2.1033 -
  2.1034 -		<dt>U+0045 LATIN CAPITAL LETTER E (E)
  2.1035 -		<dt>U+0065 LATIN SMALL LETTER E (e)
  2.1036 -		<dd>
  2.1037 -			If the <i>next input character</i> is a <i>digit</i>,
  2.1038 -			or the <i title="next input character">next 2 input characters</i>
  2.1039 -			are U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-) followed by a <i>digit</i>,
  2.1040 -			consume them.
  2.1041 -			Append U+0065 LATIN SMALL LETTER E (e) and the consumed characters to the 〈number〉’s representation.
  2.1042 -			Switch to the <i>sci-notation state</i>.
  2.1043 -
  2.1044 -			<p>
  2.1045 -				Otherwise,
  2.1046 -				switch to the <i>number-end state</i>.
  2.1047 -				<i>Reconsume the current input character</i>.
  2.1048 -
  2.1049 -		<dt>anything else
  2.1050 -		<dd>
  2.1051 -			Set the 〈number〉’s value to the number
  2.1052 -			produced by interpreting the 〈number〉’s representation
  2.1053 -			as a base-10 number.
  2.1054 -			Switch to the <i>number-end state</i>.
  2.1055 -			<i>Reconsume the current input character</i>.
  2.1056 -	</dl>
  2.1057 -
  2.1058 -<h4>
  2.1059 -<dfn>Sci-notation state</dfn></h4>
  2.1060 -
  2.1061 -	<p>
  2.1062 -		Set the 〈number〉’s type flag to "number".
  2.1063 -
  2.1064 -	<p>
  2.1065 -		Consume the <i>next input character</i>.
  2.1066 -
  2.1067 -	<dl>
  2.1068 -		<dt><i>digit</i>
  2.1069 -		<dd>
  2.1070 -			Append the <i>current input character</i>
  2.1071 -			to the 〈number〉’s representation.
  2.1072 -			Remain in this state.
  2.1073 -
  2.1074 -		<dt>anything else
  2.1075 -		<dd>
  2.1076 -			Set the 〈number〉’s value to the number
  2.1077 -			produced by <i title="sci-not-to-value">converting the 〈number〉’s representation to a value</i>.
  2.1078 -			Switch to the <i>number-end state</i>.
  2.1079 -			<i>Reconsume the current input character</i>.
  2.1080 -	</dl>
  2.1081 -
  2.1082 -<h4>
  2.1083 -<dfn>Number-end state</dfn></h4>
  2.1084 -
  2.1085 -	<p class='note'>
  2.1086 -		This state is only ever entered with a 〈number〉 having been created by the previous state,
  2.1087 -		with its value already set up appropriately.
  2.1088 -
  2.1089 -	<p>
  2.1090 -		Consume the <i>next input character</i>.
  2.1091 -
  2.1092 -	<p>
  2.1093 -		If the input stream <i>starts with an identifier</i>,
  2.1094 -
  2.1095 -	<dl>
  2.1096 -		<dt>U+0025 PERCENT SIGN (%)
  2.1097 -		<dd>
  2.1098 -			Emit a percentage token
  2.1099 -			with its value set to the 〈number〉’s value.
  2.1100 -			Switch to the <i>data state</i>.
  2.1101 -
  2.1102 -		<dt>the input stream <i>starts with an identifier</i>
  2.1103 -		<dd>
  2.1104 -			Create a 〈dimension〉
  2.1105 -			with its representation set to the 〈number〉’s representation,
  2.1106 -			its value set to the 〈number〉’s value,
  2.1107 -			its type flag set to the 〈number〉’s type flag,
  2.1108 -			and a unit initially set to the empty string.
  2.1109 -			Switch to the <i>dimension state</i>.
  2.1110 -			<i>Reconsume the current input character</i>.
  2.1111 -
  2.1112 -		<dt>anything else
  2.1113 -		<dd>
  2.1114 -			Emit the 〈number〉.
  2.1115 -			Switch to the <i>data state</i>.
  2.1116 -			<i>Reconsume the current input character</i>.
  2.1117 -	</dl>
  2.1118 -
  2.1119 -<h4>
  2.1120 -<dfn>Dimension state</dfn></h4>
  2.1121 -
  2.1122 -	<!--
  2.1123 -		This state is currently always entered with a 〈dimension〉
  2.1124 -		having already been created and gotten over the "first valid character" hump,
  2.1125 -		so the 〈dimension〉 is already ready to emit.
  2.1126 -
  2.1127 -		If this ever becomes not true, make the necessary additions here
  2.1128 -		or things will break.
  2.1129 -	-->
  2.1130 -
  2.1131 -	<p>
  2.1132 -		Consume the <i>next input character</i>.
  2.1133 -
  2.1134 -	<dl>
  2.1135 -		<dt><i>name character</i>
  2.1136 -		<dd>
  2.1137 -			Append the <i>current input character</i>
  2.1138 -			to the 〈dimension〉’s unit.
  2.1139 -			Remain in this state.
  2.1140 -
  2.1141 -		<dt>U+005C REVERSE SOLIDUS (\)
  2.1142 -		<dd>
  2.1143 -			If the input stream <i>starts with a valid escape</i>,
  2.1144 -			<i>consume an escaped character</i>.
  2.1145 -			Append the returned character
  2.1146 -			to the 〈dimension〉’s unit.
  2.1147 -
  2.1148 -			<p>
  2.1149 -				Otherwise,
  2.1150 -				emit the 〈dimension〉.
  2.1151 -				Switch to the <i>data state</i>.
  2.1152 -				<i>Reconsume the current input character</i>.
  2.1153 -
  2.1154 -		<dt>anything else
  2.1155 -		<dd>
  2.1156 -			Emit the 〈dimension〉.
  2.1157 -			Switch to the <i>data state</i>.
  2.1158 -			<i>Reconsume the current input character</i>.
  2.1159 -	</dl>
  2.1160 -
  2.1161 -<h4>
  2.1162 -<dfn>URL state</dfn></h4>
  2.1163 -
  2.1164 -	<p>
  2.1165 -		Consume the <i>next input character</i>.
  2.1166 -
  2.1167 -	<dl>
  2.1168 -		<dt>EOF
  2.1169 -		<dd>
  2.1170 -			This is a <i>parse error</i>.
  2.1171 -			Emit a 〈bad-url〉.
  2.1172 -			Switch to the <i>data state</i>.
  2.1173 -
  2.1174 -		<dt>U+0022 QUOTATION MARK (")
  2.1175 -		<dd>
  2.1176 -			Create a 〈url〉
  2.1177 -			with its value initially set to the empty string.
  2.1178 -			Switch to the <i>url-double-quote state</i>.
  2.1179 -
  2.1180 -		<dt>U+0027 APOSTROPHE (&apos;)
  2.1181 -		<dd>
  2.1182 -			Create a 〈url〉
  2.1183 -			with its value initially set to the empty string.
  2.1184 -			Switch to the <i>url-single-quote state</i>.
  2.1185 -
  2.1186 -		<dt>U+0029 RIGHT PARENTHESIS ())
  2.1187 -		<dd>
  2.1188 -			Emit a 〈url〉
  2.1189 -			with its value set to the empty string.
  2.1190 -			Switch to the <i>data state</i>.
  2.1191 -
  2.1192 -		<dt><i>whitespace</i>
  2.1193 -		<dd>
  2.1194 -			Remain in this state.
  2.1195 -
  2.1196 -		<dt>anything else
  2.1197 -		<dd>
  2.1198 -			Create a 〈url〉
  2.1199 -			with its value initially set to the empty string.
  2.1200 -			Switch to the <i>url-unquoted state</i>.
  2.1201 -			<i>Reconsume the current input character</i>.
  2.1202 -	</dl>
  2.1203 -
  2.1204 -<h4>
  2.1205 -<dfn>URL-double-quote state</dfn></h4>
  2.1206 -
  2.1207 -	<p>
  2.1208 -		Consume the <i>next input character</i>.
  2.1209 -
  2.1210 -	<dl>
  2.1211 -		<dt>EOF
  2.1212 -		<dd>
  2.1213 -			Emit the 〈url〉.
  2.1214 -			Switch to the <i>data state</i>.
  2.1215 -
  2.1216 -		<dt>U+0022 QUOTATION MARK (")
  2.1217 -		<dd>
  2.1218 -			Switch to the <i>url-end state</i>.
  2.1219 -
  2.1220 -		<dt><i>newline</i>
  2.1221 -		<dd>
  2.1222 -			This is a <i>parse error</i>.
  2.1223 -			Switch to the <i>bad-url state</i>.
  2.1224 -
  2.1225 -		<dt>U+005C REVERSE SOLIDUS (\)
  2.1226 -		<dd>
  2.1227 -			If the <i>next input character</i> is
  2.1228 -			EOF,
  2.1229 -			this is a <i>parse error</i>.
  2.1230 -			Emit a 〈bad-url〉.
  2.1231 -			Switch to the <i>data state</i>.
  2.1232 -			<i>Reconsume the current input character</i>.
  2.1233 -
  2.1234 -			<p>
  2.1235 -				Otherwise, if the <i>next input character</i> is
  2.1236 -				a <i>newline</i>,
  2.1237 -				consume it
  2.1238 -				and remain in this state.
  2.1239 -
  2.1240 -			<p>
  2.1241 -				Otherwise,
  2.1242 -				<i>consume an escaped character</i>.
  2.1243 -				Append the returned character to the 〈url〉’s value.
  2.1244 -				Remain in this state.
  2.1245 -
  2.1246 -		<dt>anything else
  2.1247 -		<dd>
  2.1248 -			Append the <i>current input character</i>
  2.1249 -			to the 〈url〉’s value.
  2.1250 -			Remain in this state.
  2.1251 -	</dl>
  2.1252 -
  2.1253 -<h4>
  2.1254 -<dfn>URL-single-quote state</dfn></h4>
  2.1255 -
  2.1256 -	<p>
  2.1257 -		Consume the <i>next input character</i>.
  2.1258 -
  2.1259 -	<dl>
  2.1260 -		<dt>EOF
  2.1261 -		<dd>
  2.1262 -			Emit the 〈url〉.
  2.1263 -			Switch to the <i>data state</i>.
  2.1264 -
  2.1265 -		<dt>U+0027 APOSTROPHE (&apos;)
  2.1266 -		<dd>
  2.1267 -			Switch to the <i>url-end state</i>.
  2.1268 -
  2.1269 -		<dt><i>newline</i>
  2.1270 -		<dd>
  2.1271 -			This is a <i>parse error</i>.
  2.1272 -			Switch to the <i>bad-url state</i>.
  2.1273 -
  2.1274 -		<dt>U+005C REVERSE SOLIDUS (\)
  2.1275 -		<dd>
  2.1276 -			If the <i>next input character</i> is
  2.1277 -			EOF,
  2.1278 -			this is a <i>parse error</i>.
  2.1279 -			Emit a 〈bad-url〉.
  2.1280 -			Switch to the <i>data state</i>.
  2.1281 -			<i>Reconsume the current input character</i>.
  2.1282 -
  2.1283 -			<p>
  2.1284 -				Otherwise, if the <i>next input character</i> is
  2.1285 -				a <i>newline</i>,
  2.1286 -				consume it
  2.1287 -				and remain in this state.
  2.1288 -
  2.1289 -			<p>
  2.1290 -				Otherwise,
  2.1291 -				<i>consume an escaped character</i>.
  2.1292 -				Append the returned character to the 〈url〉’s value.
  2.1293 -				Remain in this state.
  2.1294 -
  2.1295 -		<dt>anything else
  2.1296 -		<dd>
  2.1297 -			Append the <i>current input character</i>
  2.1298 -			to the 〈url〉’s value.
  2.1299 -			Remain in this state.
  2.1300 -	</dl>
  2.1301 -
  2.1302 -<h4>
  2.1303 -<dfn>URL-unquoted state</dfn></h4>
  2.1304 -
  2.1305 -	<p>
  2.1306 -		Consume the <i>next input character</i>.
  2.1307 -
  2.1308 -	<dl>
  2.1309 -		<dt>U+0029 RIGHT PARENTHESIS ())
  2.1310 -		<dt>EOF
  2.1311 -		<dd>
  2.1312 -			Emit the 〈url〉.
  2.1313 -			Switch to the <i>data state</i>.
  2.1314 -
  2.1315 -		<dt><i>whitespace</i>
  2.1316 -		<dd>
  2.1317 -			Switch to the <i>url-end state</i>.
  2.1318 -
  2.1319 -		<dt>U+0022 QUOTATION MARK (")
  2.1320 -		<dt>U+0027 APOSTROPHE (&apos;)
  2.1321 -		<dt>U+0028 LEFT PARENTHESIS (()
  2.1322 -		<dt><i>non-printable character</i>
  2.1323 -		<dd>
  2.1324 -			This is a <i>parse error</i>.
  2.1325 -			Switch to the <i>bad-url state</i>.
  2.1326 -
  2.1327 -		<dt>U+005C REVERSE SOLIDUS
  2.1328 -		<dd>
  2.1329 -			If the <i>next input character</i>
  2.1330 -			is a <i>newline</i> or EOF,
  2.1331 -			this is a <i>parse error</i>.
  2.1332 -			Switch to the <i>bad-url state</i>.
  2.1333 -
  2.1334 -			<p>
  2.1335 -				Otherwise,
  2.1336 -				<i>consume an escaped character</i>.
  2.1337 -				Append the returned character
  2.1338 -				to the 〈url〉’s value.
  2.1339 -				Remain in this state.
  2.1340 -
  2.1341 -		<dt>anything else
  2.1342 -		<dd>
  2.1343 -			Append the <i>current input character</i>
  2.1344 -			to the 〈url〉’s value.
  2.1345 -			Remain in this state.
  2.1346 -	</dl>
  2.1347 -
  2.1348 -<h4>
  2.1349 -<dfn>URL-end state</dfn></h4>
  2.1350 -
  2.1351 -	<p>
  2.1352 -		Consume the <i>next input character</i>.
  2.1353 -
  2.1354 -	<dl>
  2.1355 -		<dt>U+0029 RIGHT PARENTHESIS ())
  2.1356 -		<dt>EOF
  2.1357 -		<dd>
  2.1358 -			Emit the 〈url〉.
  2.1359 -			Switch to the <i>data state</i>.
  2.1360 -
  2.1361 -		<dt><i>whitespace</i>
  2.1362 -		<dd>
  2.1363 -			Remain in this state.
  2.1364 -
  2.1365 -		<dt>anything else
  2.1366 -		<dd>
  2.1367 -			This is a <i>parse error</i>.
  2.1368 -			Switch to the <i>bad-url state</i>.
  2.1369 -			<i>Reconsume the current input character</i>.
  2.1370 -	</dl>
  2.1371 -
  2.1372 -
  2.1373 -<h4>
  2.1374 -<dfn>Bad-URL state</dfn></h4>
  2.1375 -
  2.1376 -	<p>
  2.1377 -		Consume the <i>next input character</i>.
  2.1378 -
  2.1379 -	<dl>
  2.1380 -		<dt>EOF
  2.1381 -		<dd>
  2.1382 -			Emit a 〈bad-url〉.
  2.1383 -			Switch to the <i>data state</i>.
  2.1384 -
  2.1385 -		<dt>U+0029 RIGHT PARENTHESIS ())
  2.1386 -		<dd>
  2.1387 -			Emit a 〈bad-url〉.
  2.1388 -			Switch to the <i>data state</i>.
  2.1389 -
  2.1390 -		<dt>U+005C REVERSE SOLIDUS
  2.1391 -		<dd>
  2.1392 -			If the <i>next input character</i>
  2.1393 -			is a <i>newline</i> or EOF,
  2.1394 -			do nothing
  2.1395 -			and remain in this state.
  2.1396 -
  2.1397 -			<p>
  2.1398 -				Otherwise,
  2.1399 -				<i>consume an escaped character</i>.
  2.1400 -				Remain in this state.
  2.1401 -
  2.1402 -		<dt>anything else
  2.1403 -		<dd>
  2.1404 -			Do nothing.
  2.1405 -			Remain in this state.
  2.1406 -	</dl>
  2.1407 -
  2.1408 -
  2.1409 -<h4>
  2.1410 -<dfn>Unicode-range state</dfn></h4>
  2.1411 -
  2.1412 -	<p>
  2.1413 -		Create a new 〈unicode-range〉
  2.1414 -		with an empty range.
  2.1415 -
  2.1416 -	<p>
  2.1417 -		Consume as many <i>hex digits</i> as possible, but no more than 6.
  2.1418 -		If less than 6 <i>hex digits</i> were consumed,
  2.1419 -		consume as many U+003F QUESTION MARK (?) characters as possible,
  2.1420 -		but no more than enough to make the total of <i>hex digits</i> and U+003F QUESTION MARK (?) characters equal to 6.
  2.1421 -
  2.1422 -		<p>
  2.1423 -			If any U+003F QUESTION MARK (?) characters were consumed,
  2.1424 -			first interpret the consumed characters as a hexadecimal number,
  2.1425 -			with the U+003F QUESTION MARK (?) characters replaced by U+0030 DIGIT ZERO (0) characters.
  2.1426 -			This is the <i>start of the range</i>.
  2.1427 -			Then interpret the consumed characters as a hexadecimal number again,
  2.1428 -			with the U+003F QUESTION MARK (?) character replaced by U+0046 LATIN CAPITAL LETTER F (F) characters.
  2.1429 -			This is the <i>end of the range</i>.
  2.1430 -			<i>Set the 〈unicode-range〉’s range</i>, then emit it.
  2.1431 -			Switch to the <i>data state</i>.
  2.1432 -
  2.1433 -		<p>
  2.1434 -			Otherwise,
  2.1435 -			interpret the digits as a hexadecimal number.
  2.1436 -			This is the <i>start of the range</i>.
  2.1437 -
  2.1438 -	<p>
  2.1439 -		Consume the <i>next input character</i>.
  2.1440 -
  2.1441 -	<dl>
  2.1442 -		<dt>U+002D HYPHEN-MINUS (-)
  2.1443 -		<dd>
  2.1444 -			If the <i>next input character</i> is a <i>hex digit</i>,
  2.1445 -			consume as many <i>hex digits</i> as possible, but no more than 6.
  2.1446 -			Interpret the digits as a hexadecimal number.
  2.1447 -			This is the <i>end of the range</i>.
  2.1448 -			<i>Set the 〈unicode-range〉’s range</i>, then emit it.
  2.1449 -			Switch to the <i>data state</i>.
  2.1450 -
  2.1451 -			<p>
  2.1452 -				Otherwise,
  2.1453 -				<i>set the 〈unicode-range〉’s range</i>
  2.1454 -				and emit it.
  2.1455 -				Switch to the <i>data state</i>.
  2.1456 -				<i>Reconsume the current input character</i>.
  2.1457 -
  2.1458 -		<dt>anything else
  2.1459 -		<dd>
  2.1460 +				interpret the digits as a hexadecimal number.
  2.1461 +				This is the <i>start of the range</i>.
  2.1462 +
  2.1463 +		<li>
  2.1464 +			If the <i title="next input character">next 2 input character</i> are 
  2.1465 +			U+002D HYPHEN-MINUS (-) followed by a <i>hex digit</i>,
  2.1466 +			then:
  2.1467 +
  2.1468 +			<ol>
  2.1469 +				<li>Consume the <i>next input character</i>.
  2.1470 +
  2.1471 +				<li>
  2.1472 +					Consume as many <i>hex digits</i> as possible, but no more than 6.
  2.1473 +					Interpret the digits as a hexadecimal number.
  2.1474 +					This is the <i>end of the range</i>.
  2.1475 +					<i>Set the 〈unicode-range〉’s range</i>, then return it.
  2.1476 +			</ol>
  2.1477 +
  2.1478 +		<li>
  2.1479  			<i>Set the 〈unicode-range〉’s range</i>
  2.1480 -			and emit it.
  2.1481 -			Switch to the <i>data state</i>.
  2.1482 -			<i>Reconsume the current input character</i>.
  2.1483 -	</dl>
  2.1484 -
  2.1485 -
  2.1486 -<h3>
  2.1487 -Tokenizer Algorithms</h3>
  2.1488 -
  2.1489 -	<p>
  2.1490 -		This section defines a number of specialized spec algorithms used by the tokenizer.
  2.1491 +			and return it.
  2.1492 +		</dl>
  2.1493 +
  2.1494  
  2.1495  <h4>
  2.1496  <dfn>Consume an escaped character</dfn></h4>
  2.1497 @@ -1797,6 +1278,319 @@
  2.1498  			Return the <i>current input character</i>.
  2.1499  	</dl>
  2.1500  
  2.1501 +
  2.1502 +<h4>
  2.1503 +<dfn title="check if two characters are a valid escape|are a valid escape|starts with a valid escape">Check if two characters are a valid escape</dfn></h4>
  2.1504 +
  2.1505 +	<p>
  2.1506 +		This section describes how to <i>check if two characters are a valid escape</i>.
  2.1507 +		The algorithm described here can be called explicitly with two characters,
  2.1508 +		or can be called with the input stream itself.
  2.1509 +		In the latter case, the two characters in question are 
  2.1510 +		the <i>current input character</i>
  2.1511 +		and the <i>next input character</i>,
  2.1512 +		in that order.
  2.1513 +
  2.1514 +	<p class='note'>
  2.1515 +		This algorithm will not consume any additional characters.
  2.1516 +
  2.1517 +	<p>
  2.1518 +		If the first character is not U+005D REVERSE SOLIDUS (\),
  2.1519 +		return false.
  2.1520 +
  2.1521 +	<p>
  2.1522 +		Otherwise,
  2.1523 +		if the second character is a <i>newline</i>
  2.1524 +		or EOF character,
  2.1525 +		return false.
  2.1526 +
  2.1527 +	<p>
  2.1528 +		Otherwise, return true.
  2.1529 +
  2.1530 +
  2.1531 +<h4>
  2.1532 +<dfn title="check if three characters would start an identifier|starts with an identifier|start with an identifier|would start an identifier">Check if three characters would start an identifier</dfn></h4>
  2.1533 +
  2.1534 +	<p>
  2.1535 +		This section describes how to <i>check if three characters would start an identifier</i>.
  2.1536 +		The algorithm described here can be called explicitly with three characters,
  2.1537 +		or can be called with the input stream itself.
  2.1538 +		In the latter case, the three characters in question are
  2.1539 +		the <i>current input character</i>
  2.1540 +		and the <i title="next input character">next two input characters</i>,
  2.1541 +		in that order.
  2.1542 +
  2.1543 +	<p class='note'>
  2.1544 +		This algorithm will not consume any additional characters.
  2.1545 +
  2.1546 +	<p>
  2.1547 +		Look at the first character:
  2.1548 +
  2.1549 +	<dl>
  2.1550 +		<dt>U+002D HYPHEN-MINUS
  2.1551 +		<dd>
  2.1552 +			If the second character is a <i>name-start character</i>
  2.1553 +			or the second and third characters <i>are a valid escape</i>,
  2.1554 +			return true.
  2.1555 +			Otherwise, return false.
  2.1556 +
  2.1557 +		<dt><i>name-start character</i>
  2.1558 +		<dd>
  2.1559 +			Return true.
  2.1560 +
  2.1561 +		<dt>U+005C REVERSE SOLIDUS (\)
  2.1562 +		<dd>
  2.1563 +			If the first and second characters <i>are a valid escape</i>,
  2.1564 +			return true.
  2.1565 +			Otherwise, return false.
  2.1566 +	</dl>
  2.1567 +
  2.1568 +<h4>
  2.1569 +<dfn title="check if three characters would start a number|starts with a number|start with a number|would start a number">Check if three characters would start a number</dfn></h4>
  2.1570 +
  2.1571 +	<p>
  2.1572 +		This section describes how to <i>check if three characters would start a number</i>.
  2.1573 +		The algorithm described here can be called explicitly with three characters,
  2.1574 +		or can be called with the input stream itself.
  2.1575 +		In the latter case, the three characters in question are
  2.1576 +		the <i>current input character</i>
  2.1577 +		and the <i title="next input character">next two input characters</i>,
  2.1578 +		in that order.
  2.1579 +
  2.1580 +	<p class='note'>
  2.1581 +		This algorithm will not consume any additional characters.
  2.1582 +
  2.1583 +	<p>
  2.1584 +		Look at the first character:
  2.1585 +
  2.1586 +	<dl>
  2.1587 +		<dt>U+002B PLUS SIGN (+)
  2.1588 +		<dt>U+002D HYPHEN-MINUS (-)
  2.1589 +		<dd>
  2.1590 +			If the second character
  2.1591 +			is a <i>digit</i>,
  2.1592 +			return true.
  2.1593 +
  2.1594 +			<p>
  2.1595 +				Otherwise,
  2.1596 +				if the second character
  2.1597 +				is a U+002E FULL STOP (.)
  2.1598 +				and the third character
  2.1599 +				is a <i>digit</i>,
  2.1600 +				return true.
  2.1601 +
  2.1602 +			<p>
  2.1603 +				Otherwise, return false.
  2.1604 +
  2.1605 +		<dt>U+002E FULL STOP (.)
  2.1606 +		<dd>
  2.1607 +			If the second character
  2.1608 +			is a <i>digit</i>,
  2.1609 +			return true.
  2.1610 +			Otherwise, return false.
  2.1611 +
  2.1612 +		<dt><i>digit</i>
  2.1613 +		<dd>
  2.1614 +			Return true.
  2.1615 +
  2.1616 +		<dt>anything else
  2.1617 +		<dd>
  2.1618 +			Return false.
  2.1619 +	</dl>
  2.1620 +
  2.1621 +
  2.1622 +<h4>
  2.1623 +<dfn>Consume a name</dfn></h4>
  2.1624 +
  2.1625 +	<p>
  2.1626 +		This section describes how to <i>consume a name</i> from a stream of characters.
  2.1627 +		It returns a string containing
  2.1628 +		the largest name that can be formed from adjacent characters in the stream, starting from the first.
  2.1629 +
  2.1630 +	<p class='note'>
  2.1631 +		This algorithm does not do the verification of the first few characters
  2.1632 +		that are necessary to ensure the returned characters would constitute an 〈ident〉.
  2.1633 +		If that is the intended use,
  2.1634 +		ensure that the stream <i>starts with an identifier</i>
  2.1635 +		before calling this algorithm.
  2.1636 +
  2.1637 +	<p>
  2.1638 +		Let <var>result</var> initially be an empty string.
  2.1639 +
  2.1640 +	<p>
  2.1641 +		Repeatedly consume the <i>next input character</i> from the stream:
  2.1642 +
  2.1643 +	<dl>
  2.1644 +		<dt><i>name character</i>
  2.1645 +		<dd>
  2.1646 +			Append the character to <var>result</var>.
  2.1647 +
  2.1648 +		<dt>the stream <i>starts with a valid escape</i>
  2.1649 +		<dd>
  2.1650 +			<i>Consume an escaped character</i>.
  2.1651 +			Append the returned character to <var>result</var>.
  2.1652 +
  2.1653 +		<dt>anything else
  2.1654 +		<dd>
  2.1655 +			Return <var>result</var>.
  2.1656 +	</dl>
  2.1657 +
  2.1658 +
  2.1659 +<h4>
  2.1660 +<dfn>Consume a number</dfn></h4>
  2.1661 +
  2.1662 +	<p>
  2.1663 +		This section describes how to <i>consume a number</i> from a stream of characters.
  2.1664 +		It returns a 3-tuple of
  2.1665 +		a string representation,
  2.1666 +		a numeric value,
  2.1667 +		and a type flag which is either "integer" or "number".
  2.1668 +
  2.1669 +	<p class='note'>
  2.1670 +		This algorithm does not do the verification of the first few characters
  2.1671 +		that are necessary to ensure a number can be obtained from the stream.
  2.1672 +		Ensure that the stream <i>starts with a number</i>
  2.1673 +		before calling this algorithm.
  2.1674 +
  2.1675 +	<p>
  2.1676 +		Execute the following steps in order:
  2.1677 +
  2.1678 +	<ol>
  2.1679 +		<li>
  2.1680 +			Initially set <var>repr</var> to the empty string
  2.1681 +			and <var>type</var> to "integer".
  2.1682 +
  2.1683 +		<li>
  2.1684 +			If the <i>next input character</i> is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), 
  2.1685 +			consume it and append it to <var>repr</var>.
  2.1686 +
  2.1687 +		<li>
  2.1688 +			While the <i>next input character</i> is a <i>digit</i>,
  2.1689 +			consume it and append it to <var>repr</var>.
  2.1690 +
  2.1691 +		<li>
  2.1692 +			If the <i title="next input character">next 2 input characters</i> are 
  2.1693 +			U+002E FULL STOP (.) followed by a <i>digit</i>,
  2.1694 +			then:
  2.1695 +
  2.1696 +			<ol>
  2.1697 +				<li>Consume them.
  2.1698 +				<li>Append them to <var>repr</var>.
  2.1699 +				<li>Set <var>type</var> to "number".
  2.1700 +				<li>While the <i>next input character</i> is a <i>digit</i>, consume it and append it to <var>repr</var>.
  2.1701 +			</ol>
  2.1702 +
  2.1703 +		<li>
  2.1704 +			If the <i title="next input character">next 2 input characters</i> are
  2.1705 +			U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e)
  2.1706 +			followed by a <i>digit</i>,
  2.1707 +			then:
  2.1708 +
  2.1709 +			<ol>
  2.1710 +				<li>Consume them.
  2.1711 +				<li>Append them to <var>repr</var>.
  2.1712 +				<li>Set <var>type</var> to "number".
  2.1713 +				<li>While the <i>next input character</i> is a <i>digit</i>, consume it and append it to <var>repr</var>.
  2.1714 +			</ol>
  2.1715 +
  2.1716 +		<li>
  2.1717 +			<i title="convert a string to a number">Convert <var>repr</var> to a number</i>,
  2.1718 +			and set the <var>value</var> to the returned value.
  2.1719 +
  2.1720 +		<li>
  2.1721 +			Return a 3-tuple of <var>repr</var>, <var>value</var>, and <var>type</var>.
  2.1722 +	</ol>
  2.1723 +
  2.1724 +
  2.1725 +<h4>
  2.1726 +<dfn>Convert a string to a number</dfn></h4>
  2.1727 +
  2.1728 +	<p>
  2.1729 +		This section describes how to <i>convert a string to a number</i>.
  2.1730 +		It returns a number.
  2.1731 +
  2.1732 +	<p class='note'>
  2.1733 +		This algorithm does not do any verification to ensure that the string contains only a number.
  2.1734 +		Ensure that the string contains only a valid CSS number
  2.1735 +		before calling this algorithm.
  2.1736 +
  2.1737 +	<p>
  2.1738 +		Divide the string into seven components,
  2.1739 +		in order from left to right:
  2.1740 +
  2.1741 +	<ol>
  2.1742 +		<li>A <b>sign</b>: 
  2.1743 +			a single U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  2.1744 +			or the empty string.
  2.1745 +			Let <var>s</var> be the number -1 if the sign is U+002D HYPHEN-MINUS (-);
  2.1746 +			otherwise, let <var>s</var> be the number 1.
  2.1747 +
  2.1748 +		<li>An <b>integer part</b>:
  2.1749 +			zero or more <i>digits</i>.
  2.1750 +			If there is at least one digit,
  2.1751 +			let <var>i</var> be the number formed by interpreting the digits as a base-10 integer;
  2.1752 +			otherwise, let <var>i</var> be the number 0.
  2.1753 +
  2.1754 +		<li>A <b>decimal point</b>:
  2.1755 +			a single U+002E FULL STOP (.),
  2.1756 +			or the empty string.
  2.1757 +
  2.1758 +		<li>A <b>fractional part</b>:
  2.1759 +			zero or more <i>digits</i>.
  2.1760 +			If there is at least one digit,
  2.1761 +			let <var>f</var> be the number formed by interpreting the digits as a base-10 integer
  2.1762 +			and <var>d</var> be the number of digits;
  2.1763 +			otherwise, let <var>f</var> and <var>d</var> be the number 0.
  2.1764 +
  2.1765 +		<li>An <b>exponent indicator</b>:
  2.1766 +			a single U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e),
  2.1767 +			or the empty string.
  2.1768 +
  2.1769 +		<li>An <b>exponent sign</b>:
  2.1770 +			a single U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
  2.1771 +			or the empty string.
  2.1772 +			Let <var>t</var> be the number -1 if the sign is U+002D HYPHEN-MINUS (-);
  2.1773 +			otherwise, let <var>t</var> be the number 1.
  2.1774 +
  2.1775 +		<li>An <b>exponent</b>:
  2.1776 +			zero or more <i>digits</i>.
  2.1777 +			If there is at least one digit,
  2.1778 +			let <var>i</var> be the number formed by interpreting the digits as a base-10 integer;
  2.1779 +			otherwise, let <var>i</var> be the number 0.
  2.1780 +	</ol>
  2.1781 +
  2.1782 +	<p>
  2.1783 +		Return the number <code>s × (i + f·10<sup>-d</sup>) × 10<sup>te</sup></code>.
  2.1784 +
  2.1785 +
  2.1786 +<h4>
  2.1787 +<dfn>Consume the remnants of a bad url</dfn></h4>
  2.1788 +
  2.1789 +	<p>
  2.1790 +		This section describes how to <i>consume the remnants of a bad url</i> from a stream of characters,
  2.1791 +		"cleaning up" after the tokenizer realizes that it's in the middle of a 〈bad-url〉 rather than a 〈url〉.
  2.1792 +		It returns nothing;
  2.1793 +		its sole use is to consume enough of the input stream to reach a recovery point
  2.1794 +		where normal tokenizing can resume.
  2.1795 +
  2.1796 +	<p>
  2.1797 +		Repeatedly consume the <i>next input character</i> from the stream:
  2.1798 +
  2.1799 +	<dl>
  2.1800 +		<dt>U+0029 RIGHT PARENTHESIS ())
  2.1801 +		<dt>EOF
  2.1802 +		<dd>
  2.1803 +			Return.
  2.1804 +
  2.1805 +		<dt>the input stream <i>starts with a valid escape</i>
  2.1806 +		<dd>
  2.1807 +			<i>Consume an escaped character</i>.
  2.1808 +
  2.1809 +		<dt>anything else
  2.1810 +		<dd>
  2.1811 +			Do nothing.
  2.1812 +	</dl>
  2.1813 +
  2.1814  <h4>
  2.1815  <dfn>Set the 〈unicode-range〉’s range</dfn></h4>
  2.1816  
  2.1817 @@ -1835,147 +1629,6 @@
  2.1818  		the character whose codepoint is the <i>start of the range</i>
  2.1819  		and the character whose codepoint is the <i>end of the range</i>.
  2.1820  
  2.1821 -<h4>
  2.1822 -<dfn title="convert a sci-notation representation into a value|sci-not-to-value">Convert a sci-notation representation into a value</dfn></h4>
  2.1823 -
  2.1824 -	<p>
  2.1825 -		This section describes how to turn a sci-notation representation
  2.1826 -		into a numeric value.
  2.1827 -
  2.1828 -	<p>
  2.1829 -		Let <var>base</var> be the result of interpreting the portion of the representation
  2.1830 -		preceding the U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e)
  2.1831 -		as a base-10 number.
  2.1832 -
  2.1833 -	<p>
  2.1834 -		Let <var>power</var> be the result of interpreting the portion of the representation
  2.1835 -		following the U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e)
  2.1836 -		as a base-10 number.
  2.1837 -
  2.1838 -	<p>
  2.1839 -		Return <code><var>base</var> * 10<sup><var>power</var></sup></code>.
  2.1840 -
  2.1841 -
  2.1842 -<h4>
  2.1843 -<dfn title="check if two characters are a valid escape|are a valid escape|starts with a valid escape">Check if two characters are a valid escape</dfn></h4>
  2.1844 -
  2.1845 -	<p>
  2.1846 -		This section describes how to <i>check if two characters are a valid escape</i>.
  2.1847 -		The algorithm described here can be called explicitly with two characters,
  2.1848 -		or can be called with the input stream itself.
  2.1849 -		In the latter case, the two characters in question are 
  2.1850 -		the <i>current input character</i>
  2.1851 -		and the <i>next input character</i>,
  2.1852 -		in that order.
  2.1853 -
  2.1854 -	<p class='note'>
  2.1855 -		This algorithm will not consume any additional characters.
  2.1856 -
  2.1857 -	<p>
  2.1858 -		If the first character is not U+005D REVERSE SOLIDUS (\),
  2.1859 -		return false.
  2.1860 -
  2.1861 -	<p>
  2.1862 -		Otherwise,
  2.1863 -		if the second character is a <i>newline</i>
  2.1864 -		or EOF character,
  2.1865 -		return false.
  2.1866 -
  2.1867 -	<p>
  2.1868 -		Otherwise, return true.
  2.1869 -
  2.1870 -
  2.1871 -<h4>
  2.1872 -<dfn title="check if three characters would start an identifier|starts with an identifier|start with an identifier|would start an identifier">Check if three characters would start an identifier</dfn></h4>
  2.1873 -
  2.1874 -	<p>
  2.1875 -		This section describes how to <i>check if three characters would start an identifier</i>.
  2.1876 -		The algorithm described here can be called explicitly with three characters,
  2.1877 -		or can be called with the input stream itself.
  2.1878 -		In the latter case, the three characters in question are
  2.1879 -		the <i>current input character</i>
  2.1880 -		and the <i title="next input character">next two input characters</i>,
  2.1881 -		in that order.
  2.1882 -
  2.1883 -	<p class='note'>
  2.1884 -		This algorithm will not consume any additional characters.
  2.1885 -
  2.1886 -	<p>
  2.1887 -		Look at the first character:
  2.1888 -
  2.1889 -	<dl>
  2.1890 -		<dt>U+002D HYPHEN-MINUS
  2.1891 -		<dd>
  2.1892 -			If the second character is a <i>name-start character</i>
  2.1893 -			or the second and third characters <i>are a valid escape</i>,
  2.1894 -			return true.
  2.1895 -			Otherwise, return false.
  2.1896 -
  2.1897 -		<dt><i>name-start character</i>
  2.1898 -		<dd>
  2.1899 -			Return true.
  2.1900 -
  2.1901 -		<dt>U+005C REVERSE SOLIDUS (\)
  2.1902 -		<dd>
  2.1903 -			If the first and second characters <i>are a valid escape</i>,
  2.1904 -			return true.
  2.1905 -			Otherwise, return false.
  2.1906 -	</dl>
  2.1907 -
  2.1908 -<h4>
  2.1909 -<dfn title="check if three characters would start a number|starts with a number|start with a number|would start a number">Check if three characters would start a number</dfn></h4>
  2.1910 -
  2.1911 -	<p>
  2.1912 -		This section describes how to <i>check if three characters would start a number</i>.
  2.1913 -		The algorithm described here can be called explicitly with three characters,
  2.1914 -		or can be called with the input stream itself.
  2.1915 -		In the latter case, the three characters in question are
  2.1916 -		the <i>current input character</i>
  2.1917 -		and the <i title="next input character">next two input characters</i>,
  2.1918 -		in that order.
  2.1919 -
  2.1920 -	<p class='note'>
  2.1921 -		This algorithm will not consume any additional characters.
  2.1922 -
  2.1923 -	<p>
  2.1924 -		Look at the first character:
  2.1925 -
  2.1926 -	<dl>
  2.1927 -		<dt>U+002B PLUS SIGN (+)
  2.1928 -		<dt>U+002D HYPHEN-MINUS (-)
  2.1929 -		<dd>
  2.1930 -			If the second character
  2.1931 -			is a <i>digit</i>,
  2.1932 -			return true.
  2.1933 -
  2.1934 -			<p>
  2.1935 -				Otherwise,
  2.1936 -				if the second character
  2.1937 -				is a U+002E FULL STOP (.)
  2.1938 -				and the third character
  2.1939 -				is a <i>digit</i>,
  2.1940 -				return true.
  2.1941 -
  2.1942 -			<p>
  2.1943 -				Otherwise, return false.
  2.1944 -
  2.1945 -		<dt>U+002E FULL STOP (.)
  2.1946 -		<dd>
  2.1947 -			If the second character
  2.1948 -			is a <i>digit</i>,
  2.1949 -			return true.
  2.1950 -			Otherwise, return false.
  2.1951 -
  2.1952 -		<dt><i>digit</i>
  2.1953 -		<dd>
  2.1954 -			Return true.
  2.1955 -
  2.1956 -		<dt>anything else
  2.1957 -		<dd>
  2.1958 -			Return false.
  2.1959 -	</dl>
  2.1960 -
  2.1961 -
  2.1962  
  2.1963  <h3>
  2.1964  Changes from CSS 2.1 Tokenizer</h3>
  2.1965 @@ -1985,7 +1638,7 @@
  2.1966  
  2.1967  	<p class='note'>
  2.1968  		Note that the point of this spec is to match reality;
  2.1969 -		changes from CSS2.1&apos;s tokenizer are nearly always because the tokenizer specified something that doesn't match actual browser behavior,
  2.1970 +		changes from CSS2.1’s tokenizer are nearly always because the tokenizer specified something that doesn't match actual browser behavior,
  2.1971  		or left something unspecified.
  2.1972  		If some detail doesn't match browsers,
  2.1973  		please let me know
  2.1974 @@ -2009,7 +1662,7 @@
  2.1975  			The 〈comma〉 has been added.
  2.1976  
  2.1977  		<li>
  2.1978 -			The number, percentage, and 〈dimension〉s have been changed
  2.1979 +			The 〈number〉, 〈number〉, and 〈dimension〉 tokens have been changed
  2.1980  			to include the preceding +/- sign as part of their value
  2.1981  			(rather than as a separate 〈delim〉 that needs to be manually handled every time the token is mentioned in other specs).
  2.1982  			The only consequence of this is that comments can no longer be inserted between the sign and the number.

mercurial