CINXE.COM
CSS Syntax Module Level 3
<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <title>CSS Syntax Module Level 3</title> <meta content="CRD" name="w3c-status"> <meta content="Bikeshed version 1f1661843, updated Wed Dec 15 11:50:57 2021 -0800" name="generator"> <link href="https://www.w3.org/TR/css-syntax-3/" rel="canonical"> <meta content="cd693364839444fba6d81caaee3cc9e39bbf467d" name="document-revision"> <script defer src="https://test.csswg.org/harness/annotate.js#!css-syntax-3_dev/css-syntax-3" type="text/javascript"></script> <style> #serialization-tables th, #serialization-tables td { font-size: 80%; line-height: normal; padding: 0.5em; text-align: center; } </style> <style>/* style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: var(--a-normal-text); font-size: inherit; font-family: inherit; } .css::before, .property::before, .descriptor::before { content: "‘"; } .css::after, .property::after, .descriptor::after { content: "’"; } .property, .descriptor { /* Don't wrap property and descriptor names */ white-space: nowrap; } .type { /* CSS value <type> */ font-style: italic; } pre .property::before, pre .property::after { content: ""; } [data-link-type="property"]::before, [data-link-type="propdesc"]::before, [data-link-type="descriptor"]::before, [data-link-type="value"]::before, [data-link-type="function"]::before, [data-link-type="at-rule"]::before, [data-link-type="selector"]::before, [data-link-type="maybe"]::before { content: "‘"; } [data-link-type="property"]::after, [data-link-type="propdesc"]::after, [data-link-type="descriptor"]::after, [data-link-type="value"]::after, [data-link-type="function"]::after, [data-link-type="at-rule"]::after, [data-link-type="selector"]::after, [data-link-type="maybe"]::after { content: "’"; } [data-link-type].production::before, [data-link-type].production::after, .prod [data-link-type]::before, .prod [data-link-type]::after { content: ""; } [data-link-type=element], [data-link-type=element-attr] { font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: .9em; } [data-link-type=element]::before { content: "<" } [data-link-type=element]::after { content: ">" } [data-link-type=biblio] { white-space: pre; }</style> <style>/* style-counters */ body { counter-reset: example figure issue; } .issue { counter-increment: issue; } .issue:not(.no-marker)::before { content: "Issue " counter(issue); } .example { counter-increment: example; } .example:not(.no-marker)::before { content: "Example " counter(example); } .invalid.example:not(.no-marker)::before, .illegal.example:not(.no-marker)::before { content: "Invalid Example" counter(example); } figcaption { counter-increment: figure; } figcaption:not(.no-marker)::before { content: "Figure " counter(figure) " "; }</style> <style>/* style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); } .dfn-panel { position: absolute; z-index: 35; height: auto; width: -webkit-fit-content; width: fit-content; max-width: 300px; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0; } .dfn-panel li { list-style: inside; } .dfn-panel.activated { display: inline-block; position: fixed; left: .5em; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; } .dfn-paneled { cursor: pointer; } </style> <style>/* style-issues */ a[href].issue-return { float: right; float: inline-end; color: var(--issueheading-text); font-weight: bold; text-decoration: none; } </style> <style>/* style-md-lists */ /* This is a weird hack for me not yet following the commonmark spec regarding paragraph and lists. */ [data-md] > :first-child { margin-top: 0; } [data-md] > :last-child { margin-bottom: 0; }</style> <style>/* style-railroad */ :root { --railroad-bg: hsl(30, 20%, 95%); --railroad-stroke: black; --railroad-fill: hsl(120,100%,90%); } svg.railroad-diagram { background-color: var(--railroad-bg); } svg.railroad-diagram path { stroke-width:3px; stroke: var(--railroad-stroke); fill:transparent; } svg.railroad-diagram text { font: bold 14px monospace; fill: var(--text, currentcolor); text-anchor:middle; } svg.railroad-diagram text.label { text-anchor:start; } svg.railroad-diagram text.comment { font:italic 12px monospace; } svg.railroad-diagram rect { stroke-width:3px; stroke: var(--railroad-stroke); fill: var(--railroad-fill); }</style> <style>/* style-selflinks */ :root { --selflink-text: white; --selflink-bg: gray; --selflink-hover-text: black; } .heading, .issue, .note, .example, li, dt { position: relative; } a.self-link { position: absolute; top: 0; left: calc(-1 * (3.5rem - 26px)); width: calc(3.5rem - 26px); height: 2em; text-align: center; border: none; transition: opacity .2s; opacity: .5; } a.self-link:hover { opacity: 1; } .heading > a.self-link { font-size: 83%; } li > a.self-link { left: calc(-1 * (3.5rem - 26px) - 2em); } dfn > a.self-link { top: auto; left: auto; opacity: 0; width: 1.5em; height: 1.5em; background: var(--selflink-bg); color: var(--selflink-text); font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: var(--selflink-hover-text); } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; } </style> <style>/* style-var-click-highlighting */ var { cursor: pointer; } var.selected0 { background-color: #F4D200; box-shadow: 0 0 0 2px #F4D200; } var.selected1 { background-color: #FF87A2; box-shadow: 0 0 0 2px #FF87A2; } var.selected2 { background-color: #96E885; box-shadow: 0 0 0 2px #96E885; } var.selected3 { background-color: #3EEED2; box-shadow: 0 0 0 2px #3EEED2; } var.selected4 { background-color: #EACFB6; box-shadow: 0 0 0 2px #EACFB6; } var.selected5 { background-color: #82DDFF; box-shadow: 0 0 0 2px #82DDFF; } var.selected6 { background-color: #FFBCF2; box-shadow: 0 0 0 2px #FFBCF2; } </style> <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-CRD" rel="stylesheet"> <body class="h-entry"> <div class="head"> <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">CSS Syntax Module Level 3</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types#CRD">W3C Candidate Recommendation Draft</a>, <time class="dt-updated" datetime="2021-12-24">24 December 2021</time></p> <details open> <summary>More details about this document</summary> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/">https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/css-syntax-3/">https://www.w3.org/TR/css-syntax-3/</a> <dt>Editor's Draft: <dd><a href="https://drafts.csswg.org/css-syntax/">https://drafts.csswg.org/css-syntax/</a> <dt>Previous Versions: <dd><a href="https://www.w3.org/TR/2019/CR-css-syntax-3-20190716/" rel="prev">https://www.w3.org/TR/2019/CR-css-syntax-3-20190716/</a> <dd><a href="https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/" rel="prev">https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/</a> <dd><a href="https://www.w3.org/TR/2013/WD-css-syntax-3-20131105/" rel="prev">https://www.w3.org/TR/2013/WD-css-syntax-3-20131105/</a> <dd><a href="https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/" rel="prev">https://www.w3.org/TR/2013/WD-css-syntax-3-20130919/</a> <dt>History: <dd><a class="u-url" href="https://www.w3.org/standards/history/css-syntax-3">https://www.w3.org/standards/history/css-syntax-3</a> <dt>Implementation Report: <dd><a href="https://wpt.fyi/css/css-syntax/">https://wpt.fyi/css/css-syntax/</a> <dt>Test Suite: <dd><a href="http://test.csswg.org/suites/css-syntax-3_dev/nightly-unstable/">http://test.csswg.org/suites/css-syntax-3_dev/nightly-unstable/</a> <dt>Feedback: <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-syntax-3">CSSWG Issues Repository</a> <dt class="editor">Editors: <dd class="editor p-author h-card vcard" data-editor-id="42199"><a class="p-name fn u-url url" href="http://xanthir.com/contact/">Tab Atkins Jr.</a> (<span class="p-org org">Google</span>) <dd class="editor p-author h-card vcard" data-editor-id="58001"><a class="p-name fn u-url url" href="http://exyr.org/about/">Simon Sapin</a> (<span class="p-org org">Mozilla</span>) <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/main/css-syntax-3/Overview.bs">GitHub Editor</a> </dl> </div> </details> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2021 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document" rel="license">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>This module describes, in general terms, the basic structure and syntax of CSS stylesheets. It defines, in detail, the syntax and parsing of CSS - how to turn a stream of bytes into a meaningful stylesheet.</p> <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. </div> <h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p><em>This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/">W3C technical reports index at https://www.w3.org/TR/.</a></em> </p> <p> This document was published by the <a href="https://www.w3.org/groups/wg/css">CSS Working Group</a> as a <strong>Candidate Recommendation Draft</strong> using the <a href="https://www.w3.org/2021/Process-20211102/#recs-and-notes">Recommendation track</a>. Publication as a Candidate Recommendation does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Recommendation Draft integrates changes from the previous Candidate Recommendation that the Working Group intends to include in a subsequent Candidate Recommendation Snapshot. </p> <p> This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p> <p>Please send feedback by <a href="https://github.com/w3c/csswg-drafts/issues">filing issues in GitHub</a> (preferred), including the spec code “css-syntax” in the title, like this: “[css-syntax] <i>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>. Alternately, feedback can be sent to the (<a href="https://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-syntax%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>. </p> <p>This document is governed by the <a href="https://www.w3.org/2021/Process-20211102/" id="w3c_process_revision">2 November 2021 W3C Process Document</a>. </p> <p>This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy-20200915/">W3C Patent Policy</a>. W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy-20200915/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy-20200915/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p> <p></p> </div> <div data-fill-with="at-risk"></div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li> <a href="#intro"><span class="secno">1</span> <span class="content"> Introduction</span></a> <ol class="toc"> <li><a href="#placement"><span class="secno">1.1</span> <span class="content"> Module interactions</span></a> </ol> <li> <a href="#syntax-description"><span class="secno">2</span> <span class="content"> Description of CSS’s Syntax</span></a> <ol class="toc"> <li><a href="#escaping"><span class="secno">2.1</span> <span class="content"> Escaping</span></a> <li><a href="#error-handling"><span class="secno">2.2</span> <span class="content"> Error Handling</span></a> </ol> <li> <a href="#tokenizing-and-parsing"><span class="secno">3</span> <span class="content"> Tokenizing and Parsing CSS</span></a> <ol class="toc"> <li><a href="#parsing-overview"><span class="secno">3.1</span> <span class="content"> Overview of the Parsing Model</span></a> <li><a href="#input-byte-stream"><span class="secno">3.2</span> <span class="content"> The input byte stream</span></a> <li><a href="#input-preprocessing"><span class="secno">3.3</span> <span class="content"> Preprocessing the input stream</span></a> </ol> <li> <a href="#tokenization"><span class="secno">4</span> <span class="content"> Tokenization</span></a> <ol class="toc"> <li><a href="#token-diagrams"><span class="secno">4.1</span> <span class="content"> Token Railroad Diagrams</span></a> <li><a href="#tokenizer-definitions"><span class="secno">4.2</span> <span class="content"> Definitions</span></a> <li> <a href="#tokenizer-algorithms"><span class="secno">4.3</span> <span class="content"> Tokenizer Algorithms</span></a> <ol class="toc"> <li><a href="#consume-token"><span class="secno">4.3.1</span> <span class="content"> Consume a token</span></a> <li><a href="#consume-comment"><span class="secno">4.3.2</span> <span class="content"> Consume comments</span></a> <li><a href="#consume-numeric-token"><span class="secno">4.3.3</span> <span class="content"> Consume a numeric token</span></a> <li><a href="#consume-ident-like-token"><span class="secno">4.3.4</span> <span class="content"> Consume an ident-like token</span></a> <li><a href="#consume-string-token"><span class="secno">4.3.5</span> <span class="content"> Consume a string token</span></a> <li><a href="#consume-url-token"><span class="secno">4.3.6</span> <span class="content"> Consume a url token</span></a> <li><a href="#consume-escaped-code-point"><span class="secno">4.3.7</span> <span class="content"> Consume an escaped code point</span></a> <li><a href="#starts-with-a-valid-escape"><span class="secno">4.3.8</span> <span class="content"> Check if two code points are a valid escape</span></a> <li><a href="#would-start-an-identifier"><span class="secno">4.3.9</span> <span class="content"> Check if three code points would start an ident sequence</span></a> <li><a href="#starts-with-a-number"><span class="secno">4.3.10</span> <span class="content"> Check if three code points would start a number</span></a> <li><a href="#consume-name"><span class="secno">4.3.11</span> <span class="content"> Consume an ident sequence</span></a> <li><a href="#consume-number"><span class="secno">4.3.12</span> <span class="content"> Consume a number</span></a> <li><a href="#convert-string-to-number"><span class="secno">4.3.13</span> <span class="content"> Convert a string to a number</span></a> <li><a href="#consume-remnants-of-bad-url"><span class="secno">4.3.14</span> <span class="content"> Consume the remnants of a bad url</span></a> </ol> </ol> <li> <a href="#parsing"><span class="secno">5</span> <span class="content"> Parsing</span></a> <ol class="toc"> <li><a href="#parser-diagrams"><span class="secno">5.1</span> <span class="content"> Parser Railroad Diagrams</span></a> <li><a href="#parser-definitions"><span class="secno">5.2</span> <span class="content"> Definitions</span></a> <li> <a href="#parser-entry-points"><span class="secno">5.3</span> <span class="content"> Parser Entry Points</span></a> <ol class="toc"> <li><a href="#parse-grammar"><span class="secno">5.3.1</span> <span class="content"> Parse something according to a CSS grammar</span></a> <li><a href="#parse-comma-list"><span class="secno">5.3.2</span> <span class="content"> Parse A Comma-Separated List According To A CSS Grammar</span></a> <li><a href="#parse-stylesheet"><span class="secno">5.3.3</span> <span class="content"> Parse a stylesheet</span></a> <li><a href="#parse-list-of-rules"><span class="secno">5.3.4</span> <span class="content"> Parse a list of rules</span></a> <li><a href="#parse-rule"><span class="secno">5.3.5</span> <span class="content"> Parse a rule</span></a> <li><a href="#parse-declaration"><span class="secno">5.3.6</span> <span class="content"> Parse a declaration</span></a> <li><a href="#parse-style-blocks-contents"><span class="secno">5.3.7</span> <span class="content"> Parse a style block’s contents</span></a> <li><a href="#parse-list-of-declarations"><span class="secno">5.3.8</span> <span class="content"> Parse a list of declarations</span></a> <li><a href="#parse-component-value"><span class="secno">5.3.9</span> <span class="content"> Parse a component value</span></a> <li><a href="#parse-list-of-component-values"><span class="secno">5.3.10</span> <span class="content"> Parse a list of component values</span></a> <li><a href="#parse-comma-separated-list-of-component-values"><span class="secno">5.3.11</span> <span class="content"> Parse a comma-separated list of component values</span></a> </ol> <li> <a href="#parser-algorithms"><span class="secno">5.4</span> <span class="content"> Parser Algorithms</span></a> <ol class="toc"> <li><a href="#consume-list-of-rules"><span class="secno">5.4.1</span> <span class="content"> Consume a list of rules</span></a> <li><a href="#consume-at-rule"><span class="secno">5.4.2</span> <span class="content"> Consume an at-rule</span></a> <li><a href="#consume-qualified-rule"><span class="secno">5.4.3</span> <span class="content"> Consume a qualified rule</span></a> <li><a href="#consume-style-block"><span class="secno">5.4.4</span> <span class="content"> Consume a style block’s contents</span></a> <li><a href="#consume-list-of-declarations"><span class="secno">5.4.5</span> <span class="content"> Consume a list of declarations</span></a> <li><a href="#consume-declaration"><span class="secno">5.4.6</span> <span class="content"> Consume a declaration</span></a> <li><a href="#consume-component-value"><span class="secno">5.4.7</span> <span class="content"> Consume a component value</span></a> <li><a href="#consume-simple-block"><span class="secno">5.4.8</span> <span class="content"> Consume a simple block</span></a> <li><a href="#consume-function"><span class="secno">5.4.9</span> <span class="content"> Consume a function</span></a> </ol> </ol> <li> <a href="#anb-microsyntax"><span class="secno">6</span> <span class="content"> The <var>An+B</var> microsyntax</span></a> <ol class="toc"> <li><a href="#anb-syntax"><span class="secno">6.1</span> <span class="content"> Informal Syntax Description</span></a> <li><a href="#the-anb-type"><span class="secno">6.2</span> <span class="content"> The <code><an+b></code> type</span></a> </ol> <li> <a href="#urange"><span class="secno">7</span> <span class="content"> The Unicode-Range microsyntax</span></a> <ol class="toc"> <li><a href="#urange-syntax"><span class="secno">7.1</span> <span class="content"> The <span class="production"><urange></span> type</span></a> </ol> <li> <a href="#rule-defs"><span class="secno">8</span> <span class="content"> Defining Grammars for Rules and Other Values</span></a> <ol class="toc"> <li><a href="#declaration-rule-list"><span class="secno">8.1</span> <span class="content"> Defining Block Contents: the <span class="production"><declaration-list></span>, <span class="production"><rule-list></span>, and <span class="production"><stylesheet></span> productions</span></a> <li><a href="#any-value"><span class="secno">8.2</span> <span class="content"> Defining Arbitrary Contents: the <span class="production"><declaration-value></span> and <span class="production"><any-value></span> productions</span></a> </ol> <li> <a href="#css-stylesheets"><span class="secno">9</span> <span class="content"> CSS stylesheets</span></a> <ol class="toc"> <li><a href="#style-rules"><span class="secno">9.1</span> <span class="content"> Style rules</span></a> <li><a href="#at-rules"><span class="secno">9.2</span> <span class="content"> At-rules</span></a> <li><a href="#charset-rule"><span class="secno">9.3</span> <span class="content"> The <span class="css">@charset</span> Rule</span></a> </ol> <li> <a href="#serialization"><span class="secno">10</span> <span class="content"> Serialization</span></a> <ol class="toc"> <li><a href="#serializing-anb"><span class="secno">10.1</span> <span class="content"> Serializing <var><an+b></var></span></a> </ol> <li><a href="#priv-sec"><span class="secno">11</span> <span class="content"> Privacy and Security Considerations</span></a> <li> <a href="#changes"><span class="secno">12</span> <span class="content"> Changes</span></a> <ol class="toc"> <li><a href="#changes-CR-20190716"><span class="secno">12.1</span> <span class="content"> Changes from the 16 August 2019 Candidate Recommendation</span></a> <li><a href="#changes-CR-20140220"><span class="secno">12.2</span> <span class="content"> Changes from the 20 February 2014 Candidate Recommendation</span></a> <li><a href="#changes-WD-20131105"><span class="secno">12.3</span> <span class="content"> Changes from the 5 November 2013 Last Call Working Draft</span></a> <li><a href="#changes-WD-20130919"><span class="secno">12.4</span> <span class="content"> Changes from the 19 September 2013 Working Draft</span></a> <li><a href="#changes-css21"><span class="secno">12.5</span> <span class="content"> Changes from CSS 2.1 and Selectors Level 3</span></a> </ol> <li><a href="#acknowledgments"><span class="secno"></span> <span class="content"> Acknowledgments</span></a> <li> <a href="#w3c-conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#w3c-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#w3c-conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#w3c-partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a> <ol class="toc"> <li><a href="#w3c-conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> </ol> <li><a href="#w3c-testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a> <li><a href="#w3c-cr-exit-criteria"><span class="secno"></span> <span class="content"> CR exit criteria</span></a> </ol> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#intro"></a></h2> <p><em>This section is not normative.</em></p> <p>This module defines the abstract syntax and parsing of CSS stylesheets and other things which use CSS syntax (such as the HTML <code>style</code> attribute).</p> <p>It defines algorithms for converting a stream of Unicode <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point">code points</a> (in other words, text) into a stream of CSS tokens, and then further into CSS objects such as stylesheets, rules, and declarations.</p> <h3 class="heading settled" data-level="1.1" id="placement"><span class="secno">1.1. </span><span class="content"> Module interactions</span><a class="self-link" href="#placement"></a></h3> <p>This module defines the syntax and parsing of CSS stylesheets. It supersedes the lexical scanner and grammar defined in CSS 2.1.</p> <h2 class="heading settled" data-level="2" id="syntax-description"><span class="secno">2. </span><span class="content"> Description of CSS’s Syntax</span><a class="self-link" href="#syntax-description"></a></h2> <p><em>This section is not normative.</em></p> <p>A CSS document is a series of <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule">style rules</a>—<wbr>which are <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule">qualified rules</a> that apply styles to elements in a document—<wbr>and <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule">at-rules</a>—<wbr>which define special processing rules or values for the CSS document.</p> <p>A <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule①">qualified rule</a> starts with a prelude then has a {}-wrapped block containing a sequence of declarations. The meaning of the prelude varies based on the context that the rule appears in—<wbr>for <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule①">style rules</a>, it’s a selector which specifies what elements the declarations will apply to. Each declaration has a name, followed by a colon and the declaration value. Declarations are separated by semicolons.</p> <div class="example" id="example-0ffd6a46"> <a class="self-link" href="#example-0ffd6a46"></a> <p>A typical rule might look something like this:</p> <pre>p > a { color: blue; text-decoration: underline; } </pre> <p>In the above rule, "<code>p > a</code>" is the selector, which, if the source document is HTML, selects any <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" id="ref-for-the-a-element">a</a></code> elements that are children of a <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" id="ref-for-the-p-element">p</a></code> element.</p> <p>"<code>color: blue</code>" is a declaration specifying that, for the elements that match the selector, their <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-color-4/#propdef-color" id="ref-for-propdef-color">color</a> property should have the value <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-color-4/#valdef-color-blue" id="ref-for-valdef-color-blue">blue</a>. Similarly, their <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-text-decor-3/#propdef-text-decoration" id="ref-for-propdef-text-decoration">text-decoration</a> property should have the value <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-text-decor-3/#valdef-text-decoration-line-underline" id="ref-for-valdef-text-decoration-line-underline">underline</a>.</p> </div> <p><a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①">At-rules</a> are all different, but they have a basic structure in common. They start with an "@" <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①">code point</a> followed by their name as a CSS keyword. Some <span id="ref-for-at-rule②">at-rules</span> are simple statements, with their name followed by more CSS values to specify their behavior, and finally ended by a semicolon. Others are blocks; they can have CSS values following their name, but they end with a {}-wrapped block, similar to a <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule②">qualified rule</a>. Even the contents of these blocks are specific to the given <span id="ref-for-at-rule③">at-rule</span>: sometimes they contain a sequence of declarations, like a <span id="ref-for-qualified-rule③">qualified rule</span>; other times, they may contain additional blocks, or at-rules, or other structures altogether.</p> <div class="example" id="example-42888746"> <a class="self-link" href="#example-42888746"></a> <p>Here are several examples of <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule④">at-rules</a> that illustrate the varied syntax they may contain.</p> <pre>@import "my-styles.css";</pre> <p>The <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-cascade-5/#at-ruledef-import" id="ref-for-at-ruledef-import">@import</a> <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule⑤">at-rule</a> is a simple statement. After its name, it takes a single string or <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-values-4/#funcdef-url" id="ref-for-funcdef-url">url()</a> function to indicate the stylesheet that it should import.</p> <pre>@page :left { margin-left: 4cm; margin-right: 3cm; } </pre> <p>The <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-page-3/#at-ruledef-page" id="ref-for-at-ruledef-page">@page</a> <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule⑥">at-rule</a> consists of an optional page selector (the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-page-3/#valdef-page-left" id="ref-for-valdef-page-left">:left</a> pseudoclass), followed by a block of properties that apply to the page when printed. In this way, it’s very similar to a normal style rule, except that its properties don’t apply to any "element", but rather the page itself.</p> <pre>@media print { body { font-size: 10pt } } </pre> <p>The <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-conditional/#at-ruledef-media" id="ref-for-at-ruledef-media">@media</a> <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule⑦">at-rule</a> begins with a media type and a list of optional media queries. Its block contains entire rules, which are only applied when the <span class="css" id="ref-for-at-ruledef-media①">@media</span>s conditions are fulfilled.</p> </div> <p>Property names and <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule⑧">at-rule</a> names are always <a data-link-type="dfn" href="#ident-sequence" id="ref-for-ident-sequence">ident sequences</a>, which have to start with an <a data-link-type="dfn" href="#ident-start-code-point" id="ref-for-ident-start-code-point">ident-start code point</a>, two hyphens, or a hyphen followed by an ident-start code point, and then can contain zero or more <a data-link-type="dfn" href="#ident-code-point" id="ref-for-ident-code-point">ident code points</a>. You can include any <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②">code point</a> at all, even ones that CSS uses in its syntax, by <a data-link-type="dfn" href="#escape-codepoint" id="ref-for-escape-codepoint">escaping</a> it.</p> <p>The syntax of selectors is defined in the <a href="https://www.w3.org/TR/selectors/">Selectors spec</a>. Similarly, the syntax of the wide variety of CSS values is defined in the <a href="https://www.w3.org/TR/css3-values/">Values & Units spec</a>. The special syntaxes of individual <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule⑨">at-rules</a> can be found in the specs that define them.</p> <h3 class="heading settled" data-level="2.1" id="escaping"><span class="secno">2.1. </span><span class="content"> Escaping</span><a class="self-link" href="#escaping"></a></h3> <p><em>This section is not normative.</em></p> <p>Any Unicode <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③">code point</a> can be included in an <a data-link-type="dfn" href="#ident-sequence" id="ref-for-ident-sequence①">ident sequence</a> or quoted string by <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="escape-codepoint">escaping</dfn> it. CSS escape sequences start with a backslash (\), and continue with:</p> <ul> <li> Any Unicode <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④">code point</a> that is not a <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit">hex digits</a> or a <a data-link-type="dfn" href="#newline" id="ref-for-newline">newline</a>. The escape sequence is replaced by that <span id="ref-for-code-point⑤">code point</span>. <li> Or one to six <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit①">hex digits</a>, followed by an optional <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace">whitespace</a>. The escape sequence is replaced by the Unicode <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥">code point</a> whose value is given by the hexadecimal digits. This optional whitespace allow hexadecimal escape sequences to be followed by "real" hex digits. <p class="example" id="example-cc2d6518"><a class="self-link" href="#example-cc2d6518"></a> An <a data-link-type="dfn" href="#ident-sequence" id="ref-for-ident-sequence②">ident sequence</a> with the value "&B" could be written as <span class="css">\26 B</span> or <span class="css">\000026B</span>. </p> <p class="note" role="note"> A "real" space after the escape sequence must be doubled. </p> </ul> <h3 class="heading settled" data-level="2.2" id="error-handling"><span class="secno">2.2. </span><span class="content"> Error Handling</span><a class="self-link" href="#error-handling"></a></h3> <p><em>This section is not normative.</em></p> <p>When errors occur in CSS, the parser attempts to recover gracefully, throwing away only the minimum amount of content before returning to parsing as normal. This is because errors aren’t always mistakes—<wbr>new syntax looks like an error to an old parser, and it’s useful to be able to add new syntax to the language without worrying about stylesheets that include it being completely broken in older UAs.</p> <p>The precise error-recovery behavior is detailed in the parser itself, but it’s simple enough that a short description is fairly accurate.</p> <ul> <li> At the "top level" of a stylesheet, an <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token"><at-keyword-token></a> starts an at-rule. Anything else starts a qualified rule, and is included in the rule’s prelude. This may produce an invalid selector, but that’s not the concern of the CSS parser—<wbr>at worst, it means the selector will match nothing. <li> Once an at-rule starts, nothing is invalid from the parser’s standpoint; it’s all part of the at-rule’s prelude. Encountering a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token"><semicolon-token></a> ends the at-rule immediately, while encountering an opening curly-brace <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly"><{-token></a> starts the at-rule’s body. The at-rule seeks forward, matching blocks (content surrounded by (), {}, or []) until it finds a closing curly-brace <a href="#tokendef-close-curly" id="ref-for-tokendef-close-curly"><}-token></a> that isn’t matched by anything else or inside of another block. The contents of the at-rule are then interpreted according to the at-rule’s own grammar. <li> Qualified rules work similarly, except that semicolons don’t end them; instead, they are just taken in as part of the rule’s prelude. When the first {} block is found, the contents are always interpreted as a list of declarations. <li> When interpreting a list of declarations, unknown syntax at any point causes the parser to throw away whatever declaration it’s currently building, and seek forward until it finds a semicolon (or the end of the block). It then starts fresh, trying to parse a declaration again. <li> If the stylesheet ends while any rule, declaration, function, string, etc. are still open, everything is automatically closed. This doesn’t make them invalid, though they may be incomplete and thus thrown away when they are verified against their grammar. </ul> <p>After each construct (declaration, style rule, at-rule) is parsed, the user agent checks it against its expected grammar. If it does not match the grammar, it’s <dfn class="dfn-paneled" data-dfn-for="css" data-dfn-type="dfn" data-export id="css-invalid">invalid</dfn>, and gets <dfn data-dfn-for="css" data-dfn-type="dfn" data-export id="css-ignored">ignored<a class="self-link" href="#css-ignored"></a></dfn> by the UA, which treats it as if it wasn’t there at all.</p> <h2 class="heading settled" data-level="3" id="tokenizing-and-parsing"><span class="secno">3. </span><span class="content"> Tokenizing and Parsing CSS</span><a class="self-link" href="#tokenizing-and-parsing"></a></h2> <p>User agents must use the parsing rules described in this specification to generate the <a data-link-type="biblio" href="#biblio-cssom">[CSSOM]</a> trees from text/css resources. Together, these rules define what is referred to as the CSS parser.</p> <p>This specification defines the parsing rules for CSS documents, whether they are syntactically correct or not. Certain points in the parsing algorithm are said to be <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="parse error" data-noexport id="parse-error">parse errors</dfn>. The error handling for parse errors is well-defined: user agents must either act as described below when encountering such problems, or must abort processing at the first error that they encounter for which they do not wish to apply the rules described below.</p> <p>Conformance checkers must report at least one parse error condition to the user if one or more parse error conditions exist in the document and must not report parse error conditions if none exist in the document. Conformance checkers may report more than one parse error condition if more than one parse error condition exists in the document. Conformance checkers are not required to recover from parse errors, but if they do, they must recover in the same way as user agents.</p> <h3 class="heading settled" data-level="3.1" id="parsing-overview"><span class="secno">3.1. </span><span class="content"> Overview of the Parsing Model</span><a class="self-link" href="#parsing-overview"></a></h3> <p>The input to the CSS parsing process consists of a stream of Unicode <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦">code points</a>, which is passed through a tokenization stage followed by a tree construction stage. The output is a CSSStyleSheet object.</p> <p class="note" role="note"><span>Note:</span> Implementations that do not support scripting do not have to actually create a CSSOM CSSStyleSheet object, but the CSSOM tree in such cases is still used as the model for the rest of the specification.</p> <h3 class="heading settled" data-level="3.2" id="input-byte-stream"><span class="secno">3.2. </span><span class="content"> The input byte stream</span><a class="self-link" href="#input-byte-stream"></a></h3> <p>When parsing a stylesheet, the stream of Unicode <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑧">code points</a> that comprises the input to the tokenization stage might be initially seen by the user agent as a stream of bytes (typically coming over the network or from the local file system). If so, the user agent must decode these bytes into <span id="ref-for-code-point⑨">code points</span> according to a particular character encoding.</p> <div class="algorithm" data-algorithm="decode bytes" data-algorithm-for="CSS"> To <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-lt="decode bytes" data-noexport id="css-decode-bytes">decode</dfn> a <var>stylesheet</var>’s stream of bytes into a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①⓪">code points</a>: <ol> <li data-md> <p><a data-link-type="dfn" href="#determine-the-fallback-encoding" id="ref-for-determine-the-fallback-encoding">Determine the fallback encoding</a> of <var>stylesheet</var>, and let <var>fallback</var> be the result.</p> <li data-md> <p><a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#decode" id="ref-for-decode">Decode</a> <var>stylesheet</var>’s stream of bytes with fallback encoding <var>fallback</var>, and return the result.</p> </ol> <p class="note" role="note"><span>Note:</span> The <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#decode" id="ref-for-decode①">decode</a> algorithm gives precedence to a byte order mark (BOM), and only uses the fallback when none is found.</p> </div> <div class="algorithm" data-algorithm="determine the fallback encoding"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="determine-the-fallback-encoding">determine the fallback encoding</dfn> of a <var>stylesheet</var>: <ol> <li> If HTTP or equivalent protocol provides an <var>encoding label</var> (e.g. via the charset parameter of the Content-Type header) for the <var>stylesheet</var>, <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#concept-encoding-get" id="ref-for-concept-encoding-get">get an encoding</a> from <var>encoding label</var>. If that does not return failure, return it. <li> Otherwise, check <var>stylesheet</var>’s byte stream. If the first 1024 bytes of the stream begin with the hex sequence <pre>40 63 68 61 72 73 65 74 20 22 XX* 22 3B</pre> <p>where each <code>XX</code> byte is a value between 0<sub>16</sub> and 21<sub>16</sub> inclusive or a value between 23<sub>16</sub> and 7F<sub>16</sub> inclusive, then <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#concept-encoding-get" id="ref-for-concept-encoding-get①">get an encoding</a> from a string formed out of the sequence of <code>XX</code> bytes, interpreted as <code>ASCII</code>.</p> <details class="note"> <summary>What does that byte sequence mean?</summary> <p>The byte sequence above, when decoded as ASCII, is the string "<code>@charset "…";</code>", where the "…" is the sequence of bytes corresponding to the encoding’s label.</p> </details> <p>If the return value was <code>utf-16be</code> or <code>utf-16le</code>, return <code>utf-8</code>; if it was anything else except failure, return it.</p> <details class="note"> <summary>Why use utf-8 when the declaration says utf-16?</summary> <p>The bytes of the encoding declaration spell out “<code>@charset "…";</code>” in ASCII, but UTF-16 is not ASCII-compatible. Either you’ve typed in complete gibberish (like <code>䁣桡牳整•utf-16be∻</code>) to get the right bytes in the document, which we don’t want to encourage, or your document is actually in an ASCII-compatible encoding and your encoding declaration is lying.</p> <p>Either way, defaulting to UTF-8 is a decent answer.</p> <p>As well, this mimics the behavior of HTML’s <code><meta charset></code> attribute.</p> </details> <p class="note" role="note"><span>Note:</span> Note that the syntax of an encoding declaration <em>looks like</em> the syntax of an <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①⓪">at-rule</a> named <a class="css" data-link-type="maybe" href="#at-ruledef-charset" id="ref-for-at-ruledef-charset">@charset</a>, but no such rule actually exists, and the rules for how you can write it are much more restrictive than they would normally be for recognizing such a rule. A number of things you can do in CSS that would produce a valid <span class="css" id="ref-for-at-ruledef-charset①">@charset</span> rule (if one existed), such as using multiple spaces, comments, or single quotes, will cause the encoding declaration to not be recognized. This behavior keeps the encoding declaration as simple as possible, and thus maximizes the likelihood of it being implemented correctly.</p> <li> Otherwise, if an <a data-link-type="dfn" href="#environment-encoding" id="ref-for-environment-encoding">environment encoding</a> is provided by the referring document, return it. <li> Otherwise, return <code>utf-8</code>. </ol> <div class="note" role="note"> <p>Though UTF-8 is the default encoding for the web, and many newer web-based file formats assume or require UTF-8 encoding, CSS was created before it was clear which encoding would win, and thus can’t automatically assume the stylesheet is UTF-8.</p> <p>Stylesheet authors <em>should</em> author their stylesheets in UTF-8, and ensure that either an HTTP header (or equivalent method) declares the encoding of the stylesheet to be UTF-8, or that the referring document declares its encoding to be UTF-8. (In HTML, this is done by adding a <code><meta charset=utf-8></code> element to the head of the document.)</p> <p>If neither of these options are available, authors should begin the stylesheet with a UTF-8 BOM or the exact characters</p> <pre>@charset "utf-8";</pre> </div> </div> <p>Document languages that refer to CSS stylesheets that are decoded from bytes may define an <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="environment-encoding">environment encoding</dfn> for each such stylesheet, which is used as a fallback when other encoding hints are not available or can not be used.</p> <p>The concept of <a data-link-type="dfn" href="#environment-encoding" id="ref-for-environment-encoding①">environment encoding</a> only exists for compatibility with legacy content. New formats and new linking mechanisms <b>should not</b> provide an <span id="ref-for-environment-encoding②">environment encoding</span>, so the stylesheet defaults to UTF-8 instead in the absence of more explicit information.</p> <p class="note" role="note"><span>Note:</span> <a data-link-type="biblio" href="#biblio-html">[HTML]</a> defines <a href="https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet">the environment encoding for <code><link rel=stylesheet></code></a>.</p> <p class="note" role="note"><span>Note:</span> <a data-link-type="biblio" href="#biblio-cssom">[CSSOM]</a> defines <a href="https://drafts.csswg.org/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction">the environment encoding for <code><xml-stylesheet?></code></a>.</p> <p class="note" role="note"><span>Note:</span> <a data-link-type="biblio" href="#biblio-css-cascade-3">[CSS-CASCADE-3]</a> defines <a class="css" data-link-type="at-rule" href="https://www.w3.org/TR/css-cascade-5/#at-ruledef-import" id="ref-for-at-ruledef-import①">the environment encoding for <code>@import</code></a>.</p> <h3 class="heading settled" data-level="3.3" id="input-preprocessing"><span class="secno">3.3. </span><span class="content"> Preprocessing the input stream</span><a class="self-link" href="#input-preprocessing"></a></h3> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="input-stream">input stream</dfn> consists of the <a data-link-type="dfn" href="#css-filter-code-points" id="ref-for-css-filter-code-points">filtered code points</a> pushed into it as the input byte stream is decoded.</p> <div class="algorithm" data-algorithm="filter code points" data-algorithm-for="CSS"> To <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-lt="filter code points|filtered code points" data-noexport id="css-filter-code-points">filter code points</dfn> from a stream of (unfiltered) <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①①">code points</a> <var>input</var>: <ul> <li> Replace any U+000D CARRIAGE RETURN (CR) <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①②">code points</a>, U+000C FORM FEED (FF) <span id="ref-for-code-point①③">code points</span>, or pairs of U+000D CARRIAGE RETURN (CR) followed by U+000A LINE FEED (LF) in <var>input</var> by a single U+000A LINE FEED (LF) <span id="ref-for-code-point①④">code point</span>. <li> Replace any U+0000 NULL or <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate">surrogate</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①⑤">code points</a> in <var>input</var> with U+FFFD REPLACEMENT CHARACTER (�). </ul> </div> <h2 class="heading settled" data-level="4" id="tokenization"><span class="secno">4. </span><span class="content"> Tokenization</span><a class="self-link" href="#tokenization"></a></h2> <p>To <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-lt="tokenize|tokenization" data-noexport id="css-tokenize">tokenize</dfn> a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①⑥">code points</a> into a stream of CSS tokens <var>input</var>, repeatedly <a data-link-type="dfn" href="#consume-a-token" id="ref-for-consume-a-token">consume a token</a> from <var>input</var> until an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token"><EOF-token></a> is reached, pushing each of the returned tokens into a stream.</p> <p class="note" role="note"><span>Note:</span> Each call to the <a data-link-type="dfn" href="#consume-a-token" id="ref-for-consume-a-token①">consume a token</a> algorithm returns a single token, so it can also be used "on-demand" to tokenize a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①⑦">code points</a> <em>during</em> parsing, if so desired.</p> <p>The output of tokenization step is a stream of zero or more of the following tokens: <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-ident-token"><ident-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-function-token"><function-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-at-keyword-token"><at-keyword-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-hash-token"><hash-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-string-token"><string-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-bad-string-token"><bad-string-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-url-token"><url-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-bad-url-token"><bad-url-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-delim-token"><delim-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-number-token"><number-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-percentage-token"><percentage-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-dimension-token"><dimension-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-whitespace-token"><whitespace-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-cdo-token"><CDO-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-cdc-token"><CDC-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-colon-token"><colon-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-semicolon-token"><semicolon-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-comma-token"><comma-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="tokendef-open-square"><[-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="tokendef-close-square"><]-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="tokendef-open-paren"><(-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="tokendef-close-paren"><)-token></dfn>, <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="tokendef-open-curly"><{-token></dfn>, and <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="tokendef-close-curly"><}-token></dfn>.</p> <ul> <li> <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token"><ident-token></a>, <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token"><function-token></a>, <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token①"><at-keyword-token></a>, <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token"><hash-token></a>, <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token"><string-token></a>, and <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token"><url-token></a> have a value composed of zero or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①⑧">code points</a>. Additionally, hash tokens have a type flag set to either "id" or "unrestricted". The type flag defaults to "unrestricted" if not otherwise set. <li> <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token"><delim-token></a> has a value composed of a single <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①⑨">code point</a>. <li> <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token"><number-token></a>, <a class="production css" data-link-type="type" href="#typedef-percentage-token" id="ref-for-typedef-percentage-token"><percentage-token></a>, and <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token"><dimension-token></a> have a numeric value. <span class="production" id="ref-for-typedef-number-token①"><number-token></span> and <span class="production" id="ref-for-typedef-dimension-token①"><dimension-token></span> additionally have a type flag set to either "integer" or "number". The type flag defaults to "integer" if not otherwise set. <span class="production" id="ref-for-typedef-dimension-token②"><dimension-token></span> additionally have a unit composed of one or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②⓪">code points</a>. </ul> <p class="note" role="note"><span>Note:</span> The type flag of hash tokens is used in the Selectors syntax <a data-link-type="biblio" href="#biblio-select">[SELECT]</a>. Only hash tokens with the "id" type are valid <a href="https://www.w3.org/TR/selectors/#id-selectors">ID selectors</a>.</p> <h3 class="heading settled" data-level="4.1" id="token-diagrams"><span class="secno">4.1. </span><span class="content"> Token Railroad Diagrams</span><a class="self-link" href="#token-diagrams"></a></h3> <p><em>This section is non-normative.</em></p> <p>This section presents an informative view of the tokenizer, in the form of railroad diagrams. Railroad diagrams are more compact than an explicit parser, but often easier to read than an regular expression.</p> <p>These diagrams are <em>informative</em> and <em>incomplete</em>; they describe the grammar of "correct" tokens, but do not describe error-handling at all. They are provided solely to make it easier to get an intuitive grasp of the syntax of each token.</p> <p>Diagrams with names such as <em><foo-token></em> represent tokens. The rest are productions referred to by other diagrams.</p> <dl> <dt id="comment-diagram"><a class="self-link" href="#comment-diagram"></a>comment <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 496 80" width="496"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="terminal"> <path d="M50 40h0"></path> <path d="M86 40h0"></path> <rect height="22" rx="10" ry="10" width="36" x="50" y="29"></rect> <text x="68" y="44">/*</text> </g> <path d="M86 40h10"></path> <g> <path d="M96 40h0"></path> <path d="M400 40h0"></path> <path d="M96 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M116 20h264"></path> </g> <path d="M380 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M96 40h20"></path> <g> <path d="M116 40h0"></path> <path d="M380 40h0"></path> <path d="M116 40h10"></path> <g class="non-terminal"> <path d="M126 40h0"></path> <path d="M370 40h0"></path> <rect height="22" width="244" x="126" y="29"></rect> <text x="248" y="44">anything but * followed by /</text> </g> <path d="M370 40h10"></path> <path d="M126 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M126 60h244"></path> </g> <path d="M370 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M380 40h20"></path> </g> <path d="M400 40h10"></path> <g class="terminal"> <path d="M410 40h0"></path> <path d="M446 40h0"></path> <rect height="22" rx="10" ry="10" width="36" x="410" y="29"></rect> <text x="428" y="44">*/</text> </g> <path d="M446 40h10"></path> <path d="M 456 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="newline-diagram"><a class="self-link" href="#newline-diagram"></a>newline <dd> <div class="railroad"> <svg class="railroad-diagram" height="152" viewBox="0 0 172 152" width="172"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 31h0"></path> <path d="M132 31h0"></path> <path d="M40 31h20"></path> <g class="terminal"> <path d="M60 31h8"></path> <path d="M104 31h8"></path> <rect height="22" rx="10" ry="10" width="36" x="68" y="20"></rect> <text x="86" y="35">\n</text> </g> <path d="M112 31h20"></path> <path d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M60 61h0"></path> <path d="M112 61h0"></path> <rect height="22" rx="10" ry="10" width="52" x="60" y="50"></rect> <text x="86" y="65">\r\n</text> </g> <path d="M112 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <path d="M40 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M60 91h8"></path> <path d="M104 91h8"></path> <rect height="22" rx="10" ry="10" width="36" x="68" y="80"></rect> <text x="86" y="95">\r</text> </g> <path d="M112 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path> <path d="M40 31a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M60 121h8"></path> <path d="M104 121h8"></path> <rect height="22" rx="10" ry="10" width="36" x="68" y="110"></rect> <text x="86" y="125">\f</text> </g> <path d="M112 121a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path> </g> <path d="M 132 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="whitespace-diagram"><a class="self-link" href="#whitespace-diagram"></a>whitespace <dd> <div class="railroad"> <svg class="railroad-diagram" height="122" viewBox="0 0 196 122" width="196"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 31h0"></path> <path d="M156 31h0"></path> <path d="M40 31h20"></path> <g class="terminal"> <path d="M60 31h8"></path> <path d="M128 31h8"></path> <rect height="22" rx="10" ry="10" width="60" x="68" y="20"></rect> <text x="98" y="35">space</text> </g> <path d="M136 31h20"></path> <path d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M60 61h20"></path> <path d="M116 61h20"></path> <rect height="22" rx="10" ry="10" width="36" x="80" y="50"></rect> <text x="98" y="65">\t</text> </g> <path d="M136 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <path d="M40 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M60 91h0"></path> <path d="M136 91h0"></path> <rect height="22" width="76" x="60" y="80"></rect> <text x="98" y="95">newline</text> </g> <path d="M136 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path> </g> <path d="M 156 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="hex-digit-diagram"><a class="self-link" href="#hex-digit-diagram"></a>hex digit <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 232 62" width="232"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="non-terminal"> <path d="M50 31h0"></path> <path d="M182 31h0"></path> <rect height="22" width="132" x="50" y="20"></rect> <text x="116" y="35">0-9 a-f or A-F</text> </g> <path d="M182 31h10"></path> <path d="M 192 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="escape-diagram"><a class="self-link" href="#escape-diagram"></a>escape <dd> <div class="railroad"> <svg class="railroad-diagram" height="122" viewBox="0 0 430 122" width="430"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="terminal"> <path d="M50 31h0"></path> <path d="M78 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="20"></rect> <text x="64" y="35">\</text> </g> <path d="M78 31h10"></path> <g> <path d="M88 31h0"></path> <path d="M390 31h0"></path> <path d="M88 31h20"></path> <g class="non-terminal"> <path d="M108 31h25"></path> <path d="M345 31h25"></path> <rect height="22" width="212" x="133" y="20"></rect> <text x="239" y="35">not newline or hex digit</text> </g> <path d="M370 31h20"></path> <path d="M88 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g> <path d="M108 61h0"></path> <path d="M370 61h0"></path> <g> <path d="M108 61h0"></path> <path d="M220 61h0"></path> <path d="M108 61h10"></path> <g class="non-terminal"> <path d="M118 61h0"></path> <path d="M210 61h0"></path> <rect height="22" width="92" x="118" y="50"></rect> <text x="164" y="65">hex digit</text> </g> <path d="M210 61h10"></path> <path d="M118 61a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path> <g> <path d="M118 91h9.5"></path> <path d="M200.5 91h9.5"></path> <text class="comment" x="164" y="96">1-6 times</text> </g> <path d="M210 91a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path> </g> <path d="M220 61h10"></path> <g> <path d="M230 61h0"></path> <path d="M370 61h0"></path> <path d="M230 61h20"></path> <g> <path d="M250 61h100"></path> </g> <path d="M350 61h20"></path> <path d="M230 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M250 81h0"></path> <path d="M350 81h0"></path> <rect height="22" width="100" x="250" y="70"></rect> <text x="300" y="85">whitespace</text> </g> <path d="M350 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> </g> </g> <path d="M370 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M 390 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="whitespace-token-diagram"><a class="self-link" href="#whitespace-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token"><whitespace-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="71" viewBox="0 0 220 71" width="220"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g> <path d="M50 31h0"></path> <path d="M170 31h0"></path> <path d="M50 31h10"></path> <g class="non-terminal"> <path d="M60 31h0"></path> <path d="M160 31h0"></path> <rect height="22" width="100" x="60" y="20"></rect> <text x="110" y="35">whitespace</text> </g> <path d="M160 31h10"></path> <path d="M60 31a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M60 51h100"></path> </g> <path d="M160 51a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M170 31h10"></path> <path d="M 180 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="ws*-diagram"><a class="self-link" href="#ws*-diagram"></a>ws* <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 304 80" width="304"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 40h0"></path> <path d="M264 40h0"></path> <path d="M40 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M60 20h184"></path> </g> <path d="M244 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M40 40h20"></path> <g> <path d="M60 40h0"></path> <path d="M244 40h0"></path> <path d="M60 40h10"></path> <g class="non-terminal"> <path d="M70 40h0"></path> <path d="M234 40h0"></path> <rect height="22" width="164" x="70" y="29"></rect> <text x="152" y="44"><whitespace-token></text> </g> <path d="M234 40h10"></path> <path d="M70 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M70 60h164"></path> </g> <path d="M234 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M244 40h20"></path> </g> <path d="M 264 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="ident-token-diagram"><a class="self-link" href="#ident-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①"><ident-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="130" viewBox="0 0 768 130" width="768"> <g transform="translate(.5 .5)"> <path d="M 20 51 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 61h0"></path> <path d="M384 61h0"></path> <path d="M40 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <g class="terminal"> <path d="M60 31h134"></path> <path d="M230 31h134"></path> <rect height="22" rx="10" ry="10" width="36" x="194" y="20"></rect> <text x="212" y="35">--</text> </g> <path d="M364 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <path d="M40 61h20"></path> <g> <path d="M60 61h0"></path> <path d="M364 61h0"></path> <g> <path d="M60 61h0"></path> <path d="M128 61h0"></path> <path d="M60 61h20"></path> <g> <path d="M80 61h28"></path> </g> <path d="M108 61h20"></path> <path d="M60 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M80 81h0"></path> <path d="M108 81h0"></path> <rect height="22" rx="10" ry="10" width="28" x="80" y="70"></rect> <text x="94" y="85">-</text> </g> <path d="M108 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> </g> <g> <path d="M128 61h0"></path> <path d="M364 61h0"></path> <path d="M128 61h20"></path> <g class="non-terminal"> <path d="M148 61h0"></path> <path d="M344 61h0"></path> <rect height="22" width="196" x="148" y="50"></rect> <text x="246" y="65">a-z A-Z _ or non-ASCII</text> </g> <path d="M344 61h20"></path> <path d="M128 61a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M148 91h64"></path> <path d="M280 91h64"></path> <rect height="22" width="68" x="212" y="80"></rect> <text x="246" y="95">escape</text> </g> <path d="M344 91a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> </g> <path d="M364 61h20"></path> </g> <g> <path d="M384 61h0"></path> <path d="M728 61h0"></path> <path d="M384 61a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M404 41h304"></path> </g> <path d="M708 41a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M384 61h20"></path> <g> <path d="M404 61h0"></path> <path d="M708 61h0"></path> <path d="M404 61h10"></path> <g> <path d="M414 61h0"></path> <path d="M698 61h0"></path> <path d="M414 61h20"></path> <g class="non-terminal"> <path d="M434 61h0"></path> <path d="M678 61h0"></path> <rect height="22" width="244" x="434" y="50"></rect> <text x="556" y="65">a-z A-Z 0-9 _ - or non-ASCII</text> </g> <path d="M678 61h20"></path> <path d="M414 61a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M434 91h88"></path> <path d="M590 91h88"></path> <rect height="22" width="68" x="522" y="80"></rect> <text x="556" y="95">escape</text> </g> <path d="M678 91a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M698 61h10"></path> <path d="M414 61a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path> <g> <path d="M414 110h284"></path> </g> <path d="M698 110a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path> </g> <path d="M708 61h20"></path> </g> <path d="M 728 61 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="function-token-diagram"><a class="self-link" href="#function-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token①"><function-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 272 62" width="272"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="non-terminal"> <path d="M50 31h0"></path> <path d="M174 31h0"></path> <rect height="22" width="124" x="50" y="20"></rect> <text x="112" y="35"><ident-token></text> </g> <path d="M174 31h10"></path> <path d="M184 31h10"></path> <g class="terminal"> <path d="M194 31h0"></path> <path d="M222 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="194" y="20"></rect> <text x="208" y="35">(</text> </g> <path d="M222 31h10"></path> <path d="M 232 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="at-keyword-token-diagram"><a class="self-link" href="#at-keyword-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token②"><at-keyword-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 272 62" width="272"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="terminal"> <path d="M50 31h0"></path> <path d="M78 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="20"></rect> <text x="64" y="35">@</text> </g> <path d="M78 31h10"></path> <path d="M88 31h10"></path> <g class="non-terminal"> <path d="M98 31h0"></path> <path d="M222 31h0"></path> <rect height="22" width="124" x="98" y="20"></rect> <text x="160" y="35"><ident-token></text> </g> <path d="M222 31h10"></path> <path d="M 232 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="hash-token-diagram"><a class="self-link" href="#hash-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token①"><hash-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="100" viewBox="0 0 452 100" width="452"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="terminal"> <path d="M50 31h0"></path> <path d="M78 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="20"></rect> <text x="64" y="35">#</text> </g> <path d="M78 31h10"></path> <path d="M88 31h10"></path> <g> <path d="M98 31h0"></path> <path d="M402 31h0"></path> <path d="M98 31h10"></path> <g> <path d="M108 31h0"></path> <path d="M392 31h0"></path> <path d="M108 31h20"></path> <g class="non-terminal"> <path d="M128 31h0"></path> <path d="M372 31h0"></path> <rect height="22" width="244" x="128" y="20"></rect> <text x="250" y="35">a-z A-Z 0-9 _ - or non-ASCII</text> </g> <path d="M372 31h20"></path> <path d="M108 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M128 61h88"></path> <path d="M284 61h88"></path> <rect height="22" width="68" x="216" y="50"></rect> <text x="250" y="65">escape</text> </g> <path d="M372 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M392 31h10"></path> <path d="M108 31a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path> <g> <path d="M108 80h284"></path> </g> <path d="M392 80a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path> </g> <path d="M402 31h10"></path> <path d="M 412 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="string-token-diagram"><a class="self-link" href="#string-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token①"><string-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="246" viewBox="0 0 460 246" width="460"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 40h0"></path> <path d="M420 40h0"></path> <path d="M40 40h20"></path> <g> <path d="M60 40h0"></path> <path d="M400 40h0"></path> <g class="terminal"> <path d="M60 40h0"></path> <path d="M88 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="60" y="29"></rect> <text x="74" y="44">"</text> </g> <path d="M88 40h10"></path> <g> <path d="M98 40h0"></path> <path d="M362 40h0"></path> <path d="M98 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M118 20h224"></path> </g> <path d="M342 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M98 40h20"></path> <g> <path d="M118 40h0"></path> <path d="M342 40h0"></path> <path d="M118 40h10"></path> <g> <path d="M128 40h0"></path> <path d="M332 40h0"></path> <path d="M128 40h20"></path> <g class="non-terminal"> <path d="M148 40h0"></path> <path d="M312 40h0"></path> <rect height="22" width="164" x="148" y="29"></rect> <text x="230" y="44">not " \ or newline</text> </g> <path d="M312 40h20"></path> <path d="M128 40a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M148 70h48"></path> <path d="M264 70h48"></path> <rect height="22" width="68" x="196" y="59"></rect> <text x="230" y="74">escape</text> </g> <path d="M312 70a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <path d="M128 40a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path> <g> <path d="M148 100h20"></path> <path d="M292 100h20"></path> <g class="terminal"> <path d="M168 100h0"></path> <path d="M196 100h0"></path> <rect height="22" rx="10" ry="10" width="28" x="168" y="89"></rect> <text x="182" y="104">\</text> </g> <path d="M196 100h10"></path> <path d="M206 100h10"></path> <g class="non-terminal"> <path d="M216 100h0"></path> <path d="M292 100h0"></path> <rect height="22" width="76" x="216" y="89"></rect> <text x="254" y="104">newline</text> </g> </g> <path d="M312 100a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path> </g> <path d="M332 40h10"></path> <path d="M128 40a10 10 0 0 0 -10 10v59a10 10 0 0 0 10 10"></path> <g> <path d="M128 119h204"></path> </g> <path d="M332 119a10 10 0 0 0 10 -10v-59a10 10 0 0 0 -10 -10"></path> </g> <path d="M342 40h20"></path> </g> <path d="M362 40h10"></path> <g class="terminal"> <path d="M372 40h0"></path> <path d="M400 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="372" y="29"></rect> <text x="386" y="44">"</text> </g> </g> <path d="M400 40h20"></path> <path d="M40 40a10 10 0 0 1 10 10v87a10 10 0 0 0 10 10"></path> <g> <path d="M60 147h0"></path> <path d="M400 147h0"></path> <g class="terminal"> <path d="M60 147h0"></path> <path d="M88 147h0"></path> <rect height="22" rx="10" ry="10" width="28" x="60" y="136"></rect> <text x="74" y="151">'</text> </g> <path d="M88 147h10"></path> <g> <path d="M98 147h0"></path> <path d="M362 147h0"></path> <path d="M98 147a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M118 127h224"></path> </g> <path d="M342 127a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M98 147h20"></path> <g> <path d="M118 147h0"></path> <path d="M342 147h0"></path> <path d="M118 147h10"></path> <g> <path d="M128 147h0"></path> <path d="M332 147h0"></path> <path d="M128 147h20"></path> <g class="non-terminal"> <path d="M148 147h0"></path> <path d="M312 147h0"></path> <rect height="22" width="164" x="148" y="136"></rect> <text x="230" y="151">not ' \ or newline</text> </g> <path d="M312 147h20"></path> <path d="M128 147a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M148 177h48"></path> <path d="M264 177h48"></path> <rect height="22" width="68" x="196" y="166"></rect> <text x="230" y="181">escape</text> </g> <path d="M312 177a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <path d="M128 147a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path> <g> <path d="M148 207h20"></path> <path d="M292 207h20"></path> <g class="terminal"> <path d="M168 207h0"></path> <path d="M196 207h0"></path> <rect height="22" rx="10" ry="10" width="28" x="168" y="196"></rect> <text x="182" y="211">\</text> </g> <path d="M196 207h10"></path> <path d="M206 207h10"></path> <g class="non-terminal"> <path d="M216 207h0"></path> <path d="M292 207h0"></path> <rect height="22" width="76" x="216" y="196"></rect> <text x="254" y="211">newline</text> </g> </g> <path d="M312 207a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path> </g> <path d="M332 147h10"></path> <path d="M128 147a10 10 0 0 0 -10 10v59a10 10 0 0 0 10 10"></path> <g> <path d="M128 226h204"></path> </g> <path d="M332 226a10 10 0 0 0 10 -10v-59a10 10 0 0 0 -10 -10"></path> </g> <path d="M342 147h20"></path> </g> <path d="M362 147h10"></path> <g class="terminal"> <path d="M372 147h0"></path> <path d="M400 147h0"></path> <rect height="22" rx="10" ry="10" width="28" x="372" y="136"></rect> <text x="386" y="151">'</text> </g> </g> <path d="M400 147a10 10 0 0 0 10 -10v-87a10 10 0 0 1 10 -10"></path> </g> <path d="M 420 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="url-token-diagram"><a class="self-link" href="#url-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token①"><url-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="109" viewBox="0 0 880 109" width="880"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="non-terminal"> <path d="M50 40h0"></path> <path d="M222 40h0"></path> <rect height="22" width="172" x="50" y="29"></rect> <text x="136" y="44"><ident-token "url"></text> </g> <path d="M222 40h10"></path> <path d="M232 40h10"></path> <g class="terminal"> <path d="M242 40h0"></path> <path d="M270 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="242" y="29"></rect> <text x="256" y="44">(</text> </g> <path d="M270 40h10"></path> <path d="M280 40h10"></path> <g class="non-terminal"> <path d="M290 40h0"></path> <path d="M334 40h0"></path> <rect height="22" width="44" x="290" y="29"></rect> <text x="312" y="44">ws*</text> </g> <path d="M334 40h10"></path> <g> <path d="M344 40h0"></path> <path d="M728 40h0"></path> <path d="M344 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M364 20h344"></path> </g> <path d="M708 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M344 40h20"></path> <g> <path d="M364 40h0"></path> <path d="M708 40h0"></path> <path d="M364 40h10"></path> <g> <path d="M374 40h0"></path> <path d="M698 40h0"></path> <path d="M374 40h20"></path> <g class="non-terminal"> <path d="M394 40h0"></path> <path d="M678 40h0"></path> <rect height="22" width="284" x="394" y="29"></rect> <text x="536" y="44">not " ' ( ) \ ws or non-printable</text> </g> <path d="M678 40h20"></path> <path d="M374 40a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M394 70h108"></path> <path d="M570 70h108"></path> <rect height="22" width="68" x="502" y="59"></rect> <text x="536" y="74">escape</text> </g> <path d="M678 70a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M698 40h10"></path> <path d="M374 40a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path> <g> <path d="M374 89h324"></path> </g> <path d="M698 89a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path> </g> <path d="M708 40h20"></path> </g> <path d="M728 40h10"></path> <g class="non-terminal"> <path d="M738 40h0"></path> <path d="M782 40h0"></path> <rect height="22" width="44" x="738" y="29"></rect> <text x="760" y="44">ws*</text> </g> <path d="M782 40h10"></path> <path d="M792 40h10"></path> <g class="terminal"> <path d="M802 40h0"></path> <path d="M830 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="802" y="29"></rect> <text x="816" y="44">)</text> </g> <path d="M830 40h10"></path> <path d="M 840 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="number-token-diagram"><a class="self-link" href="#number-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token②"><number-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="169" viewBox="0 0 682 169" width="682"> <g transform="translate(.5 .5)"> <path d="M 20 41 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 51h0"></path> <path d="M108 51h0"></path> <path d="M40 51a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g class="terminal"> <path d="M60 31h0"></path> <path d="M88 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="60" y="20"></rect> <text x="74" y="35">+</text> </g> <path d="M88 31a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M40 51h20"></path> <g> <path d="M60 51h28"></path> </g> <path d="M88 51h20"></path> <path d="M40 51a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M60 71h0"></path> <path d="M88 71h0"></path> <rect height="22" rx="10" ry="10" width="28" x="60" y="60"></rect> <text x="74" y="75">-</text> </g> <path d="M88 71a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> </g> <g> <path d="M108 51h0"></path> <path d="M376 51h0"></path> <path d="M108 51h20"></path> <g> <path d="M128 51h0"></path> <path d="M356 51h0"></path> <g> <path d="M128 51h0"></path> <path d="M208 51h0"></path> <path d="M128 51h10"></path> <g class="non-terminal"> <path d="M138 51h0"></path> <path d="M198 51h0"></path> <rect height="22" width="60" x="138" y="40"></rect> <text x="168" y="55">digit</text> </g> <path d="M198 51h10"></path> <path d="M138 51a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M138 71h60"></path> </g> <path d="M198 71a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M208 51h10"></path> <path d="M218 51h10"></path> <g class="terminal"> <path d="M228 51h0"></path> <path d="M256 51h0"></path> <rect height="22" rx="10" ry="10" width="28" x="228" y="40"></rect> <text x="242" y="55">.</text> </g> <path d="M256 51h10"></path> <path d="M266 51h10"></path> <g> <path d="M276 51h0"></path> <path d="M356 51h0"></path> <path d="M276 51h10"></path> <g class="non-terminal"> <path d="M286 51h0"></path> <path d="M346 51h0"></path> <rect height="22" width="60" x="286" y="40"></rect> <text x="316" y="55">digit</text> </g> <path d="M346 51h10"></path> <path d="M286 51a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M286 71h60"></path> </g> <path d="M346 71a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> </g> <path d="M356 51h20"></path> <path d="M108 51a10 10 0 0 1 10 10v19a10 10 0 0 0 10 10"></path> <g> <path d="M128 90h74"></path> <path d="M282 90h74"></path> <path d="M202 90h10"></path> <g class="non-terminal"> <path d="M212 90h0"></path> <path d="M272 90h0"></path> <rect height="22" width="60" x="212" y="79"></rect> <text x="242" y="94">digit</text> </g> <path d="M272 90h10"></path> <path d="M212 90a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M212 110h60"></path> </g> <path d="M272 110a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M356 90a10 10 0 0 0 10 -10v-19a10 10 0 0 1 10 -10"></path> <path d="M108 51a10 10 0 0 1 10 10v58a10 10 0 0 0 10 10"></path> <g> <path d="M128 129h50"></path> <path d="M306 129h50"></path> <g class="terminal"> <path d="M178 129h0"></path> <path d="M206 129h0"></path> <rect height="22" rx="10" ry="10" width="28" x="178" y="118"></rect> <text x="192" y="133">.</text> </g> <path d="M206 129h10"></path> <path d="M216 129h10"></path> <g> <path d="M226 129h0"></path> <path d="M306 129h0"></path> <path d="M226 129h10"></path> <g class="non-terminal"> <path d="M236 129h0"></path> <path d="M296 129h0"></path> <rect height="22" width="60" x="236" y="118"></rect> <text x="266" y="133">digit</text> </g> <path d="M296 129h10"></path> <path d="M236 129a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M236 149h60"></path> </g> <path d="M296 149a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> </g> <path d="M356 129a10 10 0 0 0 10 -10v-58a10 10 0 0 1 10 -10"></path> </g> <g> <path d="M376 51h0"></path> <path d="M642 51h0"></path> <path d="M376 51h20"></path> <g> <path d="M396 51h226"></path> </g> <path d="M622 51h20"></path> <path d="M376 51a10 10 0 0 1 10 10v19a10 10 0 0 0 10 10"></path> <g> <path d="M396 90h0"></path> <path d="M622 90h0"></path> <g> <path d="M396 90h0"></path> <path d="M464 90h0"></path> <path d="M396 90h20"></path> <g class="terminal"> <path d="M416 90h0"></path> <path d="M444 90h0"></path> <rect height="22" rx="10" ry="10" width="28" x="416" y="79"></rect> <text x="430" y="94">e</text> </g> <path d="M444 90h20"></path> <path d="M396 90a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M416 120h0"></path> <path d="M444 120h0"></path> <rect height="22" rx="10" ry="10" width="28" x="416" y="109"></rect> <text x="430" y="124">E</text> </g> <path d="M444 120a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <g> <path d="M464 90h0"></path> <path d="M532 90h0"></path> <path d="M464 90a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g class="terminal"> <path d="M484 70h0"></path> <path d="M512 70h0"></path> <rect height="22" rx="10" ry="10" width="28" x="484" y="59"></rect> <text x="498" y="74">+</text> </g> <path d="M512 70a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M464 90h20"></path> <g> <path d="M484 90h28"></path> </g> <path d="M512 90h20"></path> <path d="M464 90a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M484 110h0"></path> <path d="M512 110h0"></path> <rect height="22" rx="10" ry="10" width="28" x="484" y="99"></rect> <text x="498" y="114">-</text> </g> <path d="M512 110a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> </g> <path d="M532 90h10"></path> <g> <path d="M542 90h0"></path> <path d="M622 90h0"></path> <path d="M542 90h10"></path> <g class="non-terminal"> <path d="M552 90h0"></path> <path d="M612 90h0"></path> <rect height="22" width="60" x="552" y="79"></rect> <text x="582" y="94">digit</text> </g> <path d="M612 90h10"></path> <path d="M552 90a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M552 110h60"></path> </g> <path d="M612 110a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> </g> <path d="M622 90a10 10 0 0 0 10 -10v-19a10 10 0 0 1 10 -10"></path> </g> <path d="M 642 51 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="dimension-token-diagram"><a class="self-link" href="#dimension-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token③"><dimension-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 376 62" width="376"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="non-terminal"> <path d="M50 31h0"></path> <path d="M182 31h0"></path> <rect height="22" width="132" x="50" y="20"></rect> <text x="116" y="35"><number-token></text> </g> <path d="M182 31h10"></path> <path d="M192 31h10"></path> <g class="non-terminal"> <path d="M202 31h0"></path> <path d="M326 31h0"></path> <rect height="22" width="124" x="202" y="20"></rect> <text x="264" y="35"><ident-token></text> </g> <path d="M326 31h10"></path> <path d="M 336 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="percentage-token-diagram"><a class="self-link" href="#percentage-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-percentage-token" id="ref-for-typedef-percentage-token①"><percentage-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 280 62" width="280"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="non-terminal"> <path d="M50 31h0"></path> <path d="M182 31h0"></path> <rect height="22" width="132" x="50" y="20"></rect> <text x="116" y="35"><number-token></text> </g> <path d="M182 31h10"></path> <path d="M192 31h10"></path> <g class="terminal"> <path d="M202 31h0"></path> <path d="M230 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="202" y="20"></rect> <text x="216" y="35">%</text> </g> <path d="M230 31h10"></path> <path d="M 240 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="CDO-token-diagram"><a class="self-link" href="#CDO-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-cdo-token" id="ref-for-typedef-cdo-token"><CDO-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 152 62" width="152"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="terminal"> <path d="M50 31h0"></path> <path d="M102 31h0"></path> <rect height="22" rx="10" ry="10" width="52" x="50" y="20"></rect> <text x="76" y="35"><!--</text> </g> <path d="M102 31h10"></path> <path d="M 112 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="CDC-token-diagram"><a class="self-link" href="#CDC-token-diagram"></a><a class="production css" data-link-type="type" href="#typedef-cdc-token" id="ref-for-typedef-cdc-token"><CDC-token></a> <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 144 62" width="144"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="terminal"> <path d="M50 31h0"></path> <path d="M94 31h0"></path> <rect height="22" rx="10" ry="10" width="44" x="50" y="20"></rect> <text x="72" y="35">--></text> </g> <path d="M94 31h10"></path> <path d="M 104 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> </dl> <h3 class="heading settled" data-level="4.2" id="tokenizer-definitions"><span class="secno">4.2. </span><span class="content"> Definitions</span><a class="self-link" href="#tokenizer-definitions"></a></h3> <p>This section defines several terms used during the tokenization phase.</p> <dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="next-input-code-point">next input code point</dfn> <dd> The first <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②①">code point</a> in the <a data-link-type="dfn" href="#input-stream" id="ref-for-input-stream">input stream</a> that has not yet been consumed. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="current-input-code-point">current input code point</dfn> <dd> The last <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②②">code point</a> to have been consumed. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="reconsume-the-current-input-code-point">reconsume the current input code point</dfn> <dd> Push the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point">current input code point</a> back onto the front of the <a data-link-type="dfn" href="#input-stream" id="ref-for-input-stream①">input stream</a>, so that the next time you are instructed to consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point">next input code point</a>, it will instead reconsume the <span id="ref-for-current-input-code-point①">current input code point</span>. <dt><dfn data-dfn-type="dfn" data-export id="eof-code-point">EOF code point<a class="self-link" href="#eof-code-point"></a></dfn> <dd> A conceptual <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②③">code point</a> representing the end of the <a data-link-type="dfn" href="#input-stream" id="ref-for-input-stream②">input stream</a>. Whenever the <span id="ref-for-input-stream③">input stream</span> is empty, the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①">next input code point</a> is always an EOF code point. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="digit">digit</dfn> <dd> A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②④">code point</a> between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9) inclusive. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="hex-digit">hex digit</dfn> <dd> A <a data-link-type="dfn" href="#digit" id="ref-for-digit">digit</a>, or a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②⑤">code point</a> between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F) inclusive, or a <span id="ref-for-code-point②⑥">code point</span> between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f) inclusive. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="uppercase-letter">uppercase letter</dfn> <dd> A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②⑦">code point</a> between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z) inclusive. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="lowercase-letter">lowercase letter</dfn> <dd> A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②⑧">code point</a> between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z) inclusive. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="letter">letter</dfn> <dd> An <a data-link-type="dfn" href="#uppercase-letter" id="ref-for-uppercase-letter">uppercase letter</a> or a <a data-link-type="dfn" href="#lowercase-letter" id="ref-for-lowercase-letter">lowercase letter</a>. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="non-ascii-code-point">non-ASCII code point</dfn> <dd> A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②⑨">code point</a> with a value equal to or greater than U+0080 <control>. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="ident-start code point | name-start code point" id="ident-start-code-point">ident-start code point<span id="name-start-code-point"></span><span id="identifier-start-code-point"></span></dfn> <dd> A <a data-link-type="dfn" href="#letter" id="ref-for-letter">letter</a>, a <a data-link-type="dfn" href="#non-ascii-code-point" id="ref-for-non-ascii-code-point">non-ASCII code point</a>, or U+005F LOW LINE (_). <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ident-code-point">ident code point<span id="name-code-point"></span><span id="identifier-code-point"></span></dfn> <dd> An <a data-link-type="dfn" href="#ident-start-code-point" id="ref-for-ident-start-code-point①">ident-start code point</a>, a <a data-link-type="dfn" href="#digit" id="ref-for-digit①">digit</a>, or U+002D HYPHEN-MINUS (-). <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="non-printable-code-point">non-printable code point</dfn> <dd> A <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③⓪">code point</a> between U+0000 NULL and U+0008 BACKSPACE inclusive, or U+000B LINE TABULATION, or a <span id="ref-for-code-point③①">code point</span> between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE inclusive, or U+007F DELETE. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="newline">newline</dfn> <dd> U+000A LINE FEED. <span class="note"> Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition, as they are converted to U+000A LINE FEED during <a href="#input-preprocessing">preprocessing</a>. </span> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="whitespace">whitespace</dfn> <dd>A <a data-link-type="dfn" href="#newline" id="ref-for-newline①">newline</a>, U+0009 CHARACTER TABULATION, or U+0020 SPACE. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="maximum-allowed-code-point">maximum allowed code point</dfn> <dd>The greatest <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③②">code point</a> defined by Unicode: U+10FFFF. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="ident sequence | CSS ident sequence" id="ident-sequence">ident sequence<span id="css-identifier"></span><span id="identifier"></span></dfn> <dd> A sequence of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③③">code points</a> that has the same syntax as an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token②"><ident-token></a>. <p class="note" role="note"><span>Note:</span> The part of an <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token③"><at-keyword-token></a> after the "@", the part of a <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token②"><hash-token></a> (with the "id" type flag) after the "#", the part of a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token②"><function-token></a> before the "(", and the unit of a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token④"><dimension-token></a> are all <a data-link-type="dfn" href="#ident-sequence" id="ref-for-ident-sequence③">ident sequences</a>.</p> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="representation">representation</dfn> <dd> The <a data-link-type="dfn" href="#representation" id="ref-for-representation">representation</a> of a token is the subsequence of the <a data-link-type="dfn" href="#input-stream" id="ref-for-input-stream④">input stream</a> consumed by the invocation of the <a data-link-type="dfn" href="#consume-a-token" id="ref-for-consume-a-token②">consume a token</a> algorithm that produced it. This is preserved for a few algorithms that rely on subtle details of the input text, which a simple "re-serialization" of the tokens might disturb. <p>The <a data-link-type="dfn" href="#representation" id="ref-for-representation①">representation</a> is only consumed by internal algorithms, and never directly exposed, so it’s not actually required to preserve the exact text; equivalent methods, such as associating each token with offsets into the source text, also suffice.</p> <p class="note" role="note"><span>Note:</span> In particular, the <a data-link-type="dfn" href="#representation" id="ref-for-representation②">representation</a> preserves details such as whether .009 was written as <span class="css">.009</span> or <span class="css">9e-3</span>, and whether a character was written literally or as a CSS escape. The former is necessary to properly parse <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange"><urange></a> productions; the latter is basically an accidental leak of the tokenizing abstraction, but allowed because it makes the impl easier to define.</p> <p>If a token is ever produced by an algorithm directly, rather than thru the tokenization algorithm in this specification, its representation is the empty string.</p> </dl> <h3 class="heading settled" data-level="4.3" id="tokenizer-algorithms"><span class="secno">4.3. </span><span class="content"> Tokenizer Algorithms</span><a class="self-link" href="#tokenizer-algorithms"></a></h3> <p>The algorithms defined in this section transform a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③④">code points</a> into a stream of tokens.</p> <h4 class="heading settled" data-level="4.3.1" id="consume-token"><span class="secno">4.3.1. </span><span class="content"> Consume a token</span><a class="self-link" href="#consume-token"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-token">consume a token</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③⑤">code points</a>. It will return a single token of any type.</p> <p><a data-link-type="dfn" href="#consume-comments" id="ref-for-consume-comments">Consume comments</a>.</p> <p>Consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②">next input code point</a>.</p> <dl> <dt><a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace①">whitespace</a> <dd> Consume as much <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace②">whitespace</a> as possible. Return a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①"><whitespace-token></a>. <dt>U+0022 QUOTATION MARK (") <dd> <a data-link-type="dfn" href="#consume-a-string-token" id="ref-for-consume-a-string-token">Consume a string token</a> and return it. <dt>U+0023 NUMBER SIGN (#) <dd> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point③">next input code point</a> is an <a data-link-type="dfn" href="#ident-code-point" id="ref-for-ident-code-point①">ident code point</a> or the <span id="ref-for-next-input-code-point④">next two input code points</span> <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape">are a valid escape</a>, then: <ol> <li> Create a <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token③"><hash-token></a>. <li> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point⑤">next 3 input code points</a> <a data-link-type="dfn" href="#check-if-three-code-points-would-start-an-ident-sequence" id="ref-for-check-if-three-code-points-would-start-an-ident-sequence">would start an ident sequence</a>, set the <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token④"><hash-token></a>’s type flag to "id". <li> <a data-link-type="dfn" href="#consume-an-ident-sequence" id="ref-for-consume-an-ident-sequence">Consume an ident sequence</a>, and set the <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token⑤"><hash-token></a>’s value to the returned string. <li> Return the <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token⑥"><hash-token></a>. </ol> <p>Otherwise, return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point②">current input code point</a>.</p> <dt>U+0027 APOSTROPHE (') <dd> <a data-link-type="dfn" href="#consume-a-string-token" id="ref-for-consume-a-string-token①">Consume a string token</a> and return it. <dt>U+0028 LEFT PARENTHESIS (() <dd> Return a <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren"><(-token></a>. <dt>U+0029 RIGHT PARENTHESIS ()) <dd> Return a <a href="#tokendef-close-paren" id="ref-for-tokendef-close-paren"><)-token></a>. <dt>U+002B PLUS SIGN (+) <dd> If the input stream <a data-link-type="dfn" href="#check-if-three-code-points-would-start-a-number" id="ref-for-check-if-three-code-points-would-start-a-number">starts with a number</a>, <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point">reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-a-numeric-token" id="ref-for-consume-a-numeric-token">consume a numeric token</a>, and return it. <p>Otherwise, return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token②"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point③">current input code point</a>.</p> <dt>U+002C COMMA (,) <dd> Return a <a class="production css" data-link-type="type" href="#typedef-comma-token" id="ref-for-typedef-comma-token"><comma-token></a>. <dt>U+002D HYPHEN-MINUS (-) <dd> If the input stream <a data-link-type="dfn" href="#check-if-three-code-points-would-start-a-number" id="ref-for-check-if-three-code-points-would-start-a-number①">starts with a number</a>, <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point①">reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-a-numeric-token" id="ref-for-consume-a-numeric-token①">consume a numeric token</a>, and return it. <p>Otherwise, if the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point⑥">next 2 input code points</a> are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a <a class="production css" data-link-type="type" href="#typedef-cdc-token" id="ref-for-typedef-cdc-token①"><CDC-token></a>.</p> <p>Otherwise, if the input stream <a data-link-type="dfn" href="#check-if-three-code-points-would-start-an-ident-sequence" id="ref-for-check-if-three-code-points-would-start-an-ident-sequence①">starts with an ident sequence</a>, <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point②">reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-an-ident-like-token" id="ref-for-consume-an-ident-like-token">consume an ident-like token</a>, and return it.</p> <p>Otherwise, return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token③"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point④">current input code point</a>.</p> <dt>U+002E FULL STOP (.) <dd> If the input stream <a data-link-type="dfn" href="#check-if-three-code-points-would-start-a-number" id="ref-for-check-if-three-code-points-would-start-a-number②">starts with a number</a>, <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point③">reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-a-numeric-token" id="ref-for-consume-a-numeric-token②">consume a numeric token</a>, and return it. <p>Otherwise, return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token④"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point⑤">current input code point</a>.</p> <dt>U+003A COLON (:) <dd> Return a <a class="production css" data-link-type="type" href="#typedef-colon-token" id="ref-for-typedef-colon-token"><colon-token></a>. <dt>U+003B SEMICOLON (;) <dd> Return a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token①"><semicolon-token></a>. <dt>U+003C LESS-THAN SIGN (<) <dd> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point⑦">next 3 input code points</a> are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), consume them and return a <a class="production css" data-link-type="type" href="#typedef-cdo-token" id="ref-for-typedef-cdo-token①"><CDO-token></a>. <p>Otherwise, return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token⑤"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point⑥">current input code point</a>.</p> <dt>U+0040 COMMERCIAL AT (@) <dd> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point⑧">next 3 input code points</a> <a data-link-type="dfn" href="#check-if-three-code-points-would-start-an-ident-sequence" id="ref-for-check-if-three-code-points-would-start-an-ident-sequence②">would start an ident sequence</a>, <a data-link-type="dfn" href="#consume-an-ident-sequence" id="ref-for-consume-an-ident-sequence①">consume an ident sequence</a>, create an <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token④"><at-keyword-token></a> with its value set to the returned value, and return it. <p>Otherwise, return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token⑥"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point⑦">current input code point</a>.</p> <dt>U+005B LEFT SQUARE BRACKET ([) <dd> Return a <a href="#tokendef-open-square" id="ref-for-tokendef-open-square"><[-token></a>. <dt>U+005C REVERSE SOLIDUS (\) <dd> If the input stream <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape①">starts with a valid escape</a>, <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point④">reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-an-ident-like-token" id="ref-for-consume-an-ident-like-token①">consume an ident-like token</a>, and return it. <p>Otherwise, this is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error">parse error</a>. Return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token⑦"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point⑧">current input code point</a>.</p> <dt>U+005D RIGHT SQUARE BRACKET (]) <dd> Return a <a href="#tokendef-close-square" id="ref-for-tokendef-close-square"><]-token></a>. <dt>U+007B LEFT CURLY BRACKET ({) <dd> Return a <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly①"><{-token></a>. <dt>U+007D RIGHT CURLY BRACKET (}) <dd> Return a <a href="#tokendef-close-curly" id="ref-for-tokendef-close-curly①"><}-token></a>. <dt><a data-link-type="dfn" href="#digit" id="ref-for-digit②">digit</a> <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point⑤">Reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-a-numeric-token" id="ref-for-consume-a-numeric-token③">consume a numeric token</a>, and return it. <dt><a data-link-type="dfn" href="#ident-start-code-point" id="ref-for-ident-start-code-point②">ident-start code point</a> <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point⑥">Reconsume the current input code point</a>, <a data-link-type="dfn" href="#consume-an-ident-like-token" id="ref-for-consume-an-ident-like-token②">consume an ident-like token</a>, and return it. <dt>EOF <dd> Return an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①"><EOF-token></a>. <dt>anything else <dd> Return a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token⑧"><delim-token></a> with its value set to the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point⑨">current input code point</a>. </dl> <h4 class="heading settled" data-level="4.3.2" id="consume-comment"><span class="secno">4.3.2. </span><span class="content"> Consume comments</span><a class="self-link" href="#consume-comment"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-comments">consume comments</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③⑥">code points</a>. It returns nothing.</p> <p>If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point⑨">next two input code point</a> are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*), consume them and all following <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③⑦">code points</a> up to and including the first U+002A ASTERISK (*) followed by a U+002F SOLIDUS (/), or up to an EOF code point. Return to the start of this step.</p> <p>If the preceding paragraph ended by consuming an EOF code point, this is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①">parse error</a>.</p> <p>Return nothing.</p> <h4 class="heading settled" data-level="4.3.3" id="consume-numeric-token"><span class="secno">4.3.3. </span><span class="content"> Consume a numeric token</span><a class="self-link" href="#consume-numeric-token"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-numeric-token">consume a numeric token</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③⑧">code points</a>. It returns either a <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token③"><number-token></a>, <a class="production css" data-link-type="type" href="#typedef-percentage-token" id="ref-for-typedef-percentage-token②"><percentage-token></a>, or <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token⑤"><dimension-token></a>.</p> <p><a data-link-type="dfn" href="#consume-a-number" id="ref-for-consume-a-number">Consume a number</a> and let <var>number</var> be the result.</p> <p>If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①⓪">next 3 input code points</a> <a data-link-type="dfn" href="#check-if-three-code-points-would-start-an-ident-sequence" id="ref-for-check-if-three-code-points-would-start-an-ident-sequence③">would start an ident sequence</a>, then:</p> <ol> <li>Create a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token⑥"><dimension-token></a> with the same value and type flag as <var>number</var>, and a unit set initially to the empty string. <li><a data-link-type="dfn" href="#consume-an-ident-sequence" id="ref-for-consume-an-ident-sequence②">Consume an ident sequence</a>. Set the <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token⑦"><dimension-token></a>’s unit to the returned value. <li>Return the <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token⑧"><dimension-token></a>. </ol> <p>Otherwise, if the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①①">next input code point</a> is U+0025 PERCENTAGE SIGN (%), consume it. Create a <a class="production css" data-link-type="type" href="#typedef-percentage-token" id="ref-for-typedef-percentage-token③"><percentage-token></a> with the same value as <var>number</var>, and return it.</p> <p>Otherwise, create a <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token④"><number-token></a> with the same value and type flag as <var>number</var>, and return it.</p> <h4 class="heading settled" data-level="4.3.4" id="consume-ident-like-token"><span class="secno">4.3.4. </span><span class="content"> Consume an ident-like token</span><a class="self-link" href="#consume-ident-like-token"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-an-ident-like-token">consume an ident-like token</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③⑨">code points</a>. It returns an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token③"><ident-token></a>, <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token③"><function-token></a>, <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token②"><url-token></a>, or <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token"><bad-url-token></a>.</p> <p><a data-link-type="dfn" href="#consume-an-ident-sequence" id="ref-for-consume-an-ident-sequence③">Consume an ident sequence</a>, and let <var>string</var> be the result.</p> <p>If <var>string</var>’s value is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive">ASCII case-insensitive</a> match for "url", and the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①②">next input code point</a> is U+0028 LEFT PARENTHESIS ((), consume it. While the <span id="ref-for-next-input-code-point①③">next two input code points</span> are <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace③">whitespace</a>, consume the <span id="ref-for-next-input-code-point①④">next input code point</span>. If the <span id="ref-for-next-input-code-point①⑤">next one or two input code points</span> are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), or <span id="ref-for-whitespace④">whitespace</span> followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('), then create a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token④"><function-token></a> with its value set to <var>string</var> and return it. Otherwise, <a data-link-type="dfn" href="#consume-a-url-token" id="ref-for-consume-a-url-token">consume a url token</a>, and return it.</p> <p>Otherwise, if the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①⑥">next input code point</a> is U+0028 LEFT PARENTHESIS ((), consume it. Create a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token⑤"><function-token></a> with its value set to <var>string</var> and return it.</p> <p>Otherwise, create an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token④"><ident-token></a> with its value set to <var>string</var> and return it.</p> <h4 class="heading settled" data-level="4.3.5" id="consume-string-token"><span class="secno">4.3.5. </span><span class="content"> Consume a string token</span><a class="self-link" href="#consume-string-token"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-string-token">consume a string token</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④⓪">code points</a>. It returns either a <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token②"><string-token></a> or <a class="production css" data-link-type="type" href="#typedef-bad-string-token" id="ref-for-typedef-bad-string-token"><bad-string-token></a>.</p> <p>This algorithm may be called with an <var>ending code point</var>, which denotes the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④①">code point</a> that ends the string. If an <var>ending code point</var> is not specified, the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①⓪">current input code point</a> is used.</p> <p>Initially create a <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token③"><string-token></a> with its value set to the empty string.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①⑦">next input code point</a> from the stream:</p> <dl> <dt><var>ending code point</var> <dd> Return the <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token④"><string-token></a>. <dt>EOF <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error②">parse error</a>. Return the <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token⑤"><string-token></a>. <dt><a data-link-type="dfn" href="#newline" id="ref-for-newline②">newline</a> <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error③">parse error</a>. <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point⑦">Reconsume the current input code point</a>, create a <a class="production css" data-link-type="type" href="#typedef-bad-string-token" id="ref-for-typedef-bad-string-token①"><bad-string-token></a>, and return it. <dt>U+005C REVERSE SOLIDUS (\) <dd> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①⑧">next input code point</a> is EOF, do nothing. <p>Otherwise, if the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point①⑨">next input code point</a> is a newline, consume it.</p> <p>Otherwise, <span class="note">(the stream <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape②">starts with a valid escape</a>)</span> <a data-link-type="dfn" href="#consume-an-escaped-code-point" id="ref-for-consume-an-escaped-code-point">consume an escaped code point</a> and append the returned <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④②">code point</a> to the <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token⑥"><string-token></a>’s value.</p> <dt>anything else <dd> Append the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①①">current input code point</a> to the <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token⑦"><string-token></a>’s value. </dl> <h4 class="heading settled" data-level="4.3.6" id="consume-url-token"><span class="secno">4.3.6. </span><span class="content"> Consume a url token</span><a class="self-link" href="#consume-url-token"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-url-token">consume a url token</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④③">code points</a>. It returns either a <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token③"><url-token></a> or a <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token①"><bad-url-token></a>.</p> <p class="note" role="note"><span>Note:</span> This algorithm assumes that the initial "url(" has already been consumed. This algorithm also assumes that it’s being called to consume an "unquoted" value, like <span class="css">url(foo)</span>. A quoted value, like <span class="css">url("foo")</span>, is parsed as a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token⑥"><function-token></a>. <a data-link-type="dfn" href="#consume-an-ident-like-token" id="ref-for-consume-an-ident-like-token③">Consume an ident-like token</a> automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.</p> <ol> <li> Initially create a <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token④"><url-token></a> with its value set to the empty string. <li> Consume as much <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace⑤">whitespace</a> as possible. <li> Repeatedly consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②⓪">next input code point</a> from the stream: <dl> <dt>U+0029 RIGHT PARENTHESIS ()) <dd> Return the <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token⑤"><url-token></a>. <dt>EOF <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error④">parse error</a>. Return the <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token⑥"><url-token></a>. <dt><a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace⑥">whitespace</a> <dd> Consume as much <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace⑦">whitespace</a> as possible. If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②①">next input code point</a> is U+0029 RIGHT PARENTHESIS ()) or EOF, consume it and return the <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token⑦"><url-token></a> (if EOF was encountered, this is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error⑤">parse error</a>); otherwise, <a data-link-type="dfn" href="#consume-the-remnants-of-a-bad-url" id="ref-for-consume-the-remnants-of-a-bad-url">consume the remnants of a bad url</a>, create a <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token②"><bad-url-token></a>, and return it. <dt>U+0022 QUOTATION MARK (") <dt>U+0027 APOSTROPHE (') <dt>U+0028 LEFT PARENTHESIS (() <dt><a data-link-type="dfn" href="#non-printable-code-point" id="ref-for-non-printable-code-point">non-printable code point</a> <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error⑥">parse error</a>. <a data-link-type="dfn" href="#consume-the-remnants-of-a-bad-url" id="ref-for-consume-the-remnants-of-a-bad-url①">Consume the remnants of a bad url</a>, create a <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token③"><bad-url-token></a>, and return it. <dt>U+005C REVERSE SOLIDUS (\) <dd> If the stream <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape③">starts with a valid escape</a>, <a data-link-type="dfn" href="#consume-an-escaped-code-point" id="ref-for-consume-an-escaped-code-point①">consume an escaped code point</a> and append the returned <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④④">code point</a> to the <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token⑧"><url-token></a>’s value. <p>Otherwise, this is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error⑦">parse error</a>. <a data-link-type="dfn" href="#consume-the-remnants-of-a-bad-url" id="ref-for-consume-the-remnants-of-a-bad-url②">Consume the remnants of a bad url</a>, create a <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token④"><bad-url-token></a>, and return it.</p> <dt>anything else <dd> Append the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①②">current input code point</a> to the <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token⑨"><url-token></a>’s value. </dl> </ol> <h4 class="heading settled" data-level="4.3.7" id="consume-escaped-code-point"><span class="secno">4.3.7. </span><span class="content"> Consume an escaped code point</span><a class="self-link" href="#consume-escaped-code-point"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-an-escaped-code-point">consume an escaped code point</dfn>. It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and that the next input code point has already been verified to be part of a valid escape. It will return a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④⑤">code point</a>.</p> <p>Consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②②">next input code point</a>.</p> <dl> <dt><a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit②">hex digit</a> <dd> Consume as many <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit③">hex digits</a> as possible, but no more than 5. <span class="note">Note that this means 1-6 hex digits have been consumed in total.</span> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②③">next input code point</a> is <a data-link-type="dfn" href="#whitespace" id="ref-for-whitespace⑧">whitespace</a>, consume it as well. Interpret the <span id="ref-for-hex-digit④">hex digits</span> as a hexadecimal number. If this number is zero, or is for a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate①">surrogate</a>, or is greater than the <a data-link-type="dfn" href="#maximum-allowed-code-point" id="ref-for-maximum-allowed-code-point">maximum allowed code point</a>, return U+FFFD REPLACEMENT CHARACTER (�). Otherwise, return the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④⑥">code point</a> with that value. <dt>EOF <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error⑧">parse error</a>. Return U+FFFD REPLACEMENT CHARACTER (�). <dt>anything else <dd> Return the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①③">current input code point</a>. </dl> <h4 class="heading settled" data-level="4.3.8" id="starts-with-a-valid-escape"><span class="secno">4.3.8. </span><span class="content"> Check if two code points are a valid escape</span><a class="self-link" href="#starts-with-a-valid-escape"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="check if two code points are a valid escape|are a valid escape|starts with a valid escape" data-noexport id="check-if-two-code-points-are-a-valid-escape">check if two code points are a valid escape</dfn>. The algorithm described here can be called explicitly with two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④⑦">code points</a>, or can be called with the input stream itself. In the latter case, the two <span id="ref-for-code-point④⑧">code points</span> in question are the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①④">current input code point</a> and the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②④">next input code point</a>, in that order.</p> <p class="note" role="note"><span>Note:</span> This algorithm will not consume any additional <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point④⑨">code point</a>.</p> <p>If the first <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤⓪">code point</a> is not U+005C REVERSE SOLIDUS (\), return false.</p> <p>Otherwise, if the second <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤①">code point</a> is a <a data-link-type="dfn" href="#newline" id="ref-for-newline③">newline</a>, return false.</p> <p>Otherwise, return true.</p> <h4 class="heading settled" data-level="4.3.9" id="would-start-an-identifier"><span class="secno">4.3.9. </span><span class="content"> Check if three code points would start an ident sequence</span><a class="self-link" href="#would-start-an-identifier"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="check if three code points would start an ident sequence|starts with an ident sequence|start with an ident sequence|would start an ident sequence" data-noexport id="check-if-three-code-points-would-start-an-ident-sequence">check if three code points would start an <a data-link-type="dfn" href="#ident-sequence" id="ref-for-ident-sequence④">ident sequence</a><span id="check-if-three-code-points-would-start-an-identifier"></span></dfn>. The algorithm described here can be called explicitly with three <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤②">code points</a>, or can be called with the input stream itself. In the latter case, the three <span id="ref-for-code-point⑤③">code points</span> in question are the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①⑤">current input code point</a> and the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②⑤">next two input code points</a>, in that order.</p> <p class="note" role="note"><span>Note:</span> This algorithm will not consume any additional <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤④">code points</a>.</p> <p>Look at the first <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤⑤">code point</a>:</p> <dl> <dt>U+002D HYPHEN-MINUS <dd> If the second <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤⑥">code point</a> is an <a data-link-type="dfn" href="#ident-start-code-point" id="ref-for-ident-start-code-point③">ident-start code point</a> or a U+002D HYPHEN-MINUS, or the second and third <span id="ref-for-code-point⑤⑦">code points</span> <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape④">are a valid escape</a>, return true. Otherwise, return false. <dt><a data-link-type="dfn" href="#ident-start-code-point" id="ref-for-ident-start-code-point④">ident-start code point</a> <dd> Return true. <dt>U+005C REVERSE SOLIDUS (\) <dd> If the first and second <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤⑧">code points</a> <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape⑤">are a valid escape</a>, return true. Otherwise, return false. <dt>anything else <dd> Return false. </dl> <h4 class="heading settled" data-level="4.3.10" id="starts-with-a-number"><span class="secno">4.3.10. </span><span class="content"> Check if three code points would start a number</span><a class="self-link" href="#starts-with-a-number"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="check if three code points would start a number|starts with a number|start with a number|would start a number" data-noexport id="check-if-three-code-points-would-start-a-number">check if three code points would start a number</dfn>. The algorithm described here can be called explicitly with three <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑤⑨">code points</a>, or can be called with the input stream itself. In the latter case, the three <span id="ref-for-code-point⑥⓪">code points</span> in question are the <a data-link-type="dfn" href="#current-input-code-point" id="ref-for-current-input-code-point①⑥">current input code point</a> and the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②⑥">next two input code points</a>, in that order.</p> <p class="note" role="note"><span>Note:</span> This algorithm will not consume any additional <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥①">code points</a>.</p> <p>Look at the first <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥②">code point</a>:</p> <dl> <dt>U+002B PLUS SIGN (+) <dt>U+002D HYPHEN-MINUS (-) <dd> If the second <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥③">code point</a> is a <a data-link-type="dfn" href="#digit" id="ref-for-digit③">digit</a>, return true. <p>Otherwise, if the second <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥④">code point</a> is a U+002E FULL STOP (.) and the third <span id="ref-for-code-point⑥⑤">code point</span> is a <a data-link-type="dfn" href="#digit" id="ref-for-digit④">digit</a>, return true.</p> <p>Otherwise, return false.</p> <dt>U+002E FULL STOP (.) <dd> If the second <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥⑥">code point</a> is a <a data-link-type="dfn" href="#digit" id="ref-for-digit⑤">digit</a>, return true. Otherwise, return false. <dt><a data-link-type="dfn" href="#digit" id="ref-for-digit⑥">digit</a> <dd> Return true. <dt>anything else <dd> Return false. </dl> <h4 class="heading settled" data-level="4.3.11" id="consume-name"><span class="secno">4.3.11. </span><span class="content"> Consume an ident sequence</span><a class="self-link" href="#consume-name"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-an-ident-sequence">consume an ident sequence<span id="consume-an-identifier"></span></dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥⑦">code points</a>. It returns a string containing the largest name that can be formed from adjacent <span id="ref-for-code-point⑥⑧">code points</span> in the stream, starting from the first.</p> <p class="note" role="note"><span>Note:</span> This algorithm does not do the verification of the first few <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑥⑨">code points</a> that are necessary to ensure the returned <span id="ref-for-code-point⑦⓪">code points</span> would constitute an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token⑤"><ident-token></a>. If that is the intended use, ensure that the stream <a data-link-type="dfn" href="#check-if-three-code-points-would-start-an-ident-sequence" id="ref-for-check-if-three-code-points-would-start-an-ident-sequence④">starts with an ident sequence</a> before calling this algorithm.</p> <p>Let <var>result</var> initially be an empty string.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②⑦">next input code point</a> from the stream:</p> <dl> <dt><a data-link-type="dfn" href="#ident-code-point" id="ref-for-ident-code-point②">ident code point</a> <dd> Append the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦①">code point</a> to <var>result</var>. <dt>the stream <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape⑥">starts with a valid escape</a> <dd> <a data-link-type="dfn" href="#consume-an-escaped-code-point" id="ref-for-consume-an-escaped-code-point②">Consume an escaped code point</a>. Append the returned <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦②">code point</a> to <var>result</var>. <dt>anything else <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-code-point" id="ref-for-reconsume-the-current-input-code-point⑧">Reconsume the current input code point</a>. Return <var>result</var>. </dl> <h4 class="heading settled" data-level="4.3.12" id="consume-number"><span class="secno">4.3.12. </span><span class="content"> Consume a number</span><a class="self-link" href="#consume-number"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-number">consume a number</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦③">code points</a>. It returns a numeric <var>value</var>, and a <var>type</var> which is either "integer" or "number".</p> <p class="note" role="note"><span>Note:</span> This algorithm does not do the verification of the first few <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦④">code points</a> that are necessary to ensure a number can be obtained from the stream. Ensure that the stream <a data-link-type="dfn" href="#check-if-three-code-points-would-start-a-number" id="ref-for-check-if-three-code-points-would-start-a-number③">starts with a number</a> before calling this algorithm.</p> <p>Execute the following steps in order:</p> <ol> <li> Initially set <var>type</var> to "integer". Let <var>repr</var> be the empty string. <li> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②⑧">next input code point</a> is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), consume it and append it to <var>repr</var>. <li> While the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point②⑨">next input code point</a> is a <a data-link-type="dfn" href="#digit" id="ref-for-digit⑦">digit</a>, consume it and append it to <var>repr</var>. <li> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point③⓪">next 2 input code points</a> are U+002E FULL STOP (.) followed by a <a data-link-type="dfn" href="#digit" id="ref-for-digit⑧">digit</a>, then: <ol> <li>Consume them. <li>Append them to <var>repr</var>. <li>Set <var>type</var> to "number". <li>While the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point③①">next input code point</a> is a <a data-link-type="dfn" href="#digit" id="ref-for-digit⑨">digit</a>, consume it and append it to <var>repr</var>. </ol> <li> If the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point③②">next 2 or 3 input code points</a> are U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e), optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+), followed by a <a data-link-type="dfn" href="#digit" id="ref-for-digit①⓪">digit</a>, then: <ol> <li>Consume them. <li>Append them to <var>repr</var>. <li>Set <var>type</var> to "number". <li>While the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point③③">next input code point</a> is a <a data-link-type="dfn" href="#digit" id="ref-for-digit①①">digit</a>, consume it and append it to <var>repr</var>. </ol> <li> <a data-link-type="dfn" href="#convert-a-string-to-a-number" id="ref-for-convert-a-string-to-a-number">Convert <var>repr</var> to a number</a>, and set the <var>value</var> to the returned value. <li> Return <var>value</var> and <var>type</var>. </ol> <h4 class="heading settled" data-level="4.3.13" id="convert-string-to-number"><span class="secno">4.3.13. </span><span class="content"> Convert a string to a number</span><a class="self-link" href="#convert-string-to-number"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="convert-a-string-to-a-number">convert a string to a number</dfn>. It returns a number.</p> <p class="note" role="note"><span>Note:</span> This algorithm does not do any verification to ensure that the string contains only a number. Ensure that the string contains only a valid CSS number before calling this algorithm.</p> <p>Divide the string into seven components, in order from left to right:</p> <ol> <li>A <b>sign</b>: a single U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), or the empty string. Let <var>s</var> be the number -1 if the sign is U+002D HYPHEN-MINUS (-); otherwise, let <var>s</var> be the number 1. <li>An <b>integer part</b>: zero or more <a data-link-type="dfn" href="#digit" id="ref-for-digit①②">digits</a>. If there is at least one digit, let <var>i</var> be the number formed by interpreting the digits as a base-10 integer; otherwise, let <var>i</var> be the number 0. <li>A <b>decimal point</b>: a single U+002E FULL STOP (.), or the empty string. <li>A <b>fractional part</b>: zero or more <a data-link-type="dfn" href="#digit" id="ref-for-digit①③">digits</a>. If there is at least one digit, let <var>f</var> be the number formed by interpreting the digits as a base-10 integer and <var>d</var> be the number of digits; otherwise, let <var>f</var> and <var>d</var> be the number 0. <li>An <b>exponent indicator</b>: a single U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e), or the empty string. <li>An <b>exponent sign</b>: a single U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), or the empty string. Let <var>t</var> be the number -1 if the sign is U+002D HYPHEN-MINUS (-); otherwise, let <var>t</var> be the number 1. <li>An <b>exponent</b>: zero or more <a data-link-type="dfn" href="#digit" id="ref-for-digit①④">digits</a>. If there is at least one digit, let <var>e</var> be the number formed by interpreting the digits as a base-10 integer; otherwise, let <var>e</var> be the number 0. </ol> <p>Return the number <code>s·(i + f·10<sup>-d</sup>)·10<sup>te</sup></code>.</p> <h4 class="heading settled" data-level="4.3.14" id="consume-remnants-of-bad-url"><span class="secno">4.3.14. </span><span class="content"> Consume the remnants of a bad url</span><a class="self-link" href="#consume-remnants-of-bad-url"></a></h4> <p>This section describes how to <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-the-remnants-of-a-bad-url">consume the remnants of a bad url</dfn> from a stream of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦⑤">code points</a>, "cleaning up" after the tokenizer realizes that it’s in the middle of a <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token⑤"><bad-url-token></a> rather than a <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token①⓪"><url-token></a>. It returns nothing; its sole use is to consume enough of the input stream to reach a recovery point where normal tokenizing can resume.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-code-point" id="ref-for-next-input-code-point③④">next input code point</a> from the stream:</p> <dl> <dt>U+0029 RIGHT PARENTHESIS ()) <dt>EOF <dd> Return. <dt>the input stream <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape⑦">starts with a valid escape</a> <dd> <a data-link-type="dfn" href="#consume-an-escaped-code-point" id="ref-for-consume-an-escaped-code-point③">Consume an escaped code point</a>. <span class="note">This allows an escaped right parenthesis ("\)") to be encountered without ending the <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token⑥"><bad-url-token></a>. This is otherwise identical to the "anything else" clause.</span> <dt>anything else <dd> Do nothing. </dl> <h2 class="heading settled" data-level="5" id="parsing"><span class="secno">5. </span><span class="content"> Parsing</span><a class="self-link" href="#parsing"></a></h2> <p>The input to the parsing stage is a stream or list of tokens from the tokenization stage. The output depends on how the parser is invoked, as defined by the entry points listed later in this section. The parser output can consist of at-rules, qualified rules, and/or declarations.</p> <p>The parser’s output is constructed according to the fundamental syntax of CSS, without regards for the validity of any specific item. Implementations may check the validity of items as they are returned by the various parser algorithms and treat the algorithm as returning nothing if the item was invalid according to the implementation’s own grammar knowledge, or may construct a full tree as specified and "clean up" afterwards by removing any invalid items.</p> <p>The items that can appear in the tree are:</p> <dl> <dt><a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①①">at-rule</a> <dd> An <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①②">at-rule</a> has a name, a prelude consisting of a list of component values, and an optional block consisting of a simple {} block. <p class="note" role="note"><span>Note:</span> This specification places no limits on what an at-rule’s block may contain. Individual at-rules must define whether they accept a block, and if so, how to parse it (preferably using one of the parser algorithms or entry points defined in this specification).</p> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="qualified-rule">qualified rule</dfn> <dd> A qualified rule has a prelude consisting of a list of component values, and a block consisting of a simple {} block. <p class="note" role="note"><span>Note:</span> Most qualified rules will be style rules, where the prelude is a selector <a data-link-type="biblio" href="#biblio-select">[SELECT]</a> and the block a <a data-link-type="dfn" href="#parse-a-list-of-declarations" id="ref-for-parse-a-list-of-declarations">list of declarations</a>.</p> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="declaration">declaration</dfn> <dd> Conceptually, declarations are a particular instance of associating a property or descriptor name with a value. Syntactically, a declaration has a name, a value consisting of a list of component values, and an <var>important</var> flag which is initially unset. <p>Declarations are further categorized as <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="css-property-declarations">property declarations</dfn> or <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="css-descriptor-declarations">descriptor declarations</dfn>, with the former setting CSS <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-5/#css-property" id="ref-for-css-property">properties</a> and appearing most often in <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule④">qualified rules</a> and the latter setting CSS <a data-link-type="dfn" href="#css-descriptor" id="ref-for-css-descriptor">descriptors</a>, which appear only in <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①③">at-rules</a>. (This categorization does not occur at the Syntax level; instead, it is a product of where the declaration appears, and is defined by the respective specifications defining the given rule.)</p> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="component-value">component value</dfn> <dd> A component value is one of the <a data-link-type="dfn" href="#preserved-tokens" id="ref-for-preserved-tokens">preserved tokens</a>, a <a data-link-type="dfn" href="#function" id="ref-for-function">function</a>, or a <a data-link-type="dfn" href="#simple-block" id="ref-for-simple-block">simple block</a>. <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="preserved-tokens">preserved tokens</dfn> <dd> Any token produced by the tokenizer except for <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token⑦"><function-token></a>s, <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly②"><{-token></a>s, <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren①"><(-token></a>s, and <a href="#tokendef-open-square" id="ref-for-tokendef-open-square①"><[-token></a>s. <p class="note" role="note"><span>Note:</span> The non-<a data-link-type="dfn" href="#preserved-tokens" id="ref-for-preserved-tokens①">preserved tokens</a> listed above are always consumed into higher-level objects, either functions or simple blocks, and so never appear in any parser output themselves.</p> <p class="note" role="note"><span>Note:</span> The tokens <a href="#tokendef-close-curly" id="ref-for-tokendef-close-curly②"><}-token></a>s, <a href="#tokendef-close-paren" id="ref-for-tokendef-close-paren①"><)-token></a>s, <a href="#tokendef-close-square" id="ref-for-tokendef-close-square①"><]-token></a>, <a class="production css" data-link-type="type" href="#typedef-bad-string-token" id="ref-for-typedef-bad-string-token②"><bad-string-token></a>, and <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token⑦"><bad-url-token></a> are always parse errors, but they are preserved in the token stream by this specification to allow other specs, such as Media Queries, to define more fine-grained error-handling than just dropping an entire declaration or block.</p> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="function">function</dfn> <dd> A function has a name and a value consisting of a list of component values. <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="simple-block">simple block</dfn> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="curly-block">{}-block</dfn> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="square-block">[]-block</dfn> <dt><dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export id="paren-block">()-block</dfn> <dd> A simple block has an associated token (either a <a href="#tokendef-open-square" id="ref-for-tokendef-open-square②"><[-token></a>, <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren②"><(-token></a>, or <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly③"><{-token></a>) and a value consisting of a list of component values. <p><a data-link-type="dfn" href="#curly-block" id="ref-for-curly-block">{}-block</a>, <a data-link-type="dfn" href="#square-block" id="ref-for-square-block">[]-block</a>, and <a data-link-type="dfn" href="#paren-block" id="ref-for-paren-block">()-block</a> refer specifically to a <a data-link-type="dfn" href="#simple-block" id="ref-for-simple-block①">simple block</a> with that corresponding associated token.</p> </dl> <h3 class="heading settled" data-level="5.1" id="parser-diagrams"><span class="secno">5.1. </span><span class="content"> Parser Railroad Diagrams</span><a class="self-link" href="#parser-diagrams"></a></h3> <p><em>This section is non-normative.</em></p> <p>This section presents an informative view of the parser, in the form of railroad diagrams.</p> <p>These diagrams are <em>informative</em> and <em>incomplete</em>; they describe the grammar of "correct" stylesheets, but do not describe error-handling at all. They are provided solely to make it easier to get an intuitive grasp of the syntax.</p> <dl> <dt id="stylesheet-diagram"><a class="self-link" href="#stylesheet-diagram"></a>Stylesheet <dd> <div class="railroad"> <svg class="railroad-diagram" height="198" viewBox="0 0 344 198" width="344"> <g transform="translate(.5 .5)"> <path d="M 20 119 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 129h0"></path> <path d="M304 129h0"></path> <path d="M40 129a10 10 0 0 0 10 -10v-89a10 10 0 0 1 10 -10"></path> <g> <path d="M60 20h224"></path> </g> <path d="M284 20a10 10 0 0 1 10 10v89a10 10 0 0 0 10 10"></path> <path d="M40 129h20"></path> <g> <path d="M60 129h0"></path> <path d="M284 129h0"></path> <path d="M60 129h10"></path> <g> <path d="M70 129h0"></path> <path d="M274 129h0"></path> <path d="M70 129a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <g class="non-terminal"> <path d="M90 99h0"></path> <path d="M254 99h0"></path> <rect height="22" width="164" x="90" y="88"></rect> <text x="172" y="103"><whitespace-token></text> </g> <path d="M254 99a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <path d="M70 129a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path> <g class="non-terminal"> <path d="M90 69h28"></path> <path d="M226 69h28"></path> <rect height="22" width="108" x="118" y="58"></rect> <text x="172" y="73"><CDC-token></text> </g> <path d="M254 69a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path> <path d="M70 129a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path> <g class="non-terminal"> <path d="M90 39h28"></path> <path d="M226 39h28"></path> <rect height="22" width="108" x="118" y="28"></rect> <text x="172" y="43"><CDO-token></text> </g> <path d="M254 39a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path> <path d="M70 129h20"></path> <g class="non-terminal"> <path d="M90 129h16"></path> <path d="M238 129h16"></path> <rect height="22" width="132" x="106" y="118"></rect> <text x="172" y="133">Qualified rule</text> </g> <path d="M254 129h20"></path> <path d="M70 129a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M90 159h44"></path> <path d="M210 159h44"></path> <rect height="22" width="76" x="134" y="148"></rect> <text x="172" y="163">At-rule</text> </g> <path d="M254 159a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M274 129h10"></path> <path d="M70 129a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path> <g> <path d="M70 178h204"></path> </g> <path d="M274 178a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path> </g> <path d="M284 129h20"></path> </g> <path d="M 304 129 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="rule-list-diagram"><a class="self-link" href="#rule-list-diagram"></a>Rule list <dd> <div class="railroad"> <svg class="railroad-diagram" height="138" viewBox="0 0 344 138" width="344"> <g transform="translate(.5 .5)"> <path d="M 20 59 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 69h0"></path> <path d="M304 69h0"></path> <path d="M40 69a10 10 0 0 0 10 -10v-29a10 10 0 0 1 10 -10"></path> <g> <path d="M60 20h224"></path> </g> <path d="M284 20a10 10 0 0 1 10 10v29a10 10 0 0 0 10 10"></path> <path d="M40 69h20"></path> <g> <path d="M60 69h0"></path> <path d="M284 69h0"></path> <path d="M60 69h10"></path> <g> <path d="M70 69h0"></path> <path d="M274 69h0"></path> <path d="M70 69a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <g class="non-terminal"> <path d="M90 39h0"></path> <path d="M254 39h0"></path> <rect height="22" width="164" x="90" y="28"></rect> <text x="172" y="43"><whitespace-token></text> </g> <path d="M254 39a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <path d="M70 69h20"></path> <g class="non-terminal"> <path d="M90 69h16"></path> <path d="M238 69h16"></path> <rect height="22" width="132" x="106" y="58"></rect> <text x="172" y="73">Qualified rule</text> </g> <path d="M254 69h20"></path> <path d="M70 69a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M90 99h44"></path> <path d="M210 99h44"></path> <rect height="22" width="76" x="134" y="88"></rect> <text x="172" y="103">At-rule</text> </g> <path d="M254 99a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M274 69h10"></path> <path d="M70 69a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path> <g> <path d="M70 118h204"></path> </g> <path d="M274 118a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path> </g> <path d="M284 69h20"></path> </g> <path d="M 304 69 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="at-rule-diagram"><a class="self-link" href="#at-rule-diagram"></a>At-rule <dd> <div class="railroad"> <svg class="railroad-diagram" height="101" viewBox="0 0 588 101" width="588"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="non-terminal"> <path d="M50 40h0"></path> <path d="M214 40h0"></path> <rect height="22" width="164" x="50" y="29"></rect> <text x="132" y="44"><at-keyword-token></text> </g> <path d="M214 40h10"></path> <g> <path d="M224 40h0"></path> <path d="M424 40h0"></path> <path d="M224 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M244 20h160"></path> </g> <path d="M404 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M224 40h20"></path> <g> <path d="M244 40h0"></path> <path d="M404 40h0"></path> <path d="M244 40h10"></path> <g class="non-terminal"> <path d="M254 40h0"></path> <path d="M394 40h0"></path> <rect height="22" width="140" x="254" y="29"></rect> <text x="324" y="44">Component value</text> </g> <path d="M394 40h10"></path> <path d="M254 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M254 60h140"></path> </g> <path d="M394 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M404 40h20"></path> </g> <g> <path d="M424 40h0"></path> <path d="M548 40h0"></path> <path d="M424 40h20"></path> <g class="non-terminal"> <path d="M444 40h0"></path> <path d="M528 40h0"></path> <rect height="22" width="84" x="444" y="29"></rect> <text x="486" y="44">{} block</text> </g> <path d="M528 40h20"></path> <path d="M424 40a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="terminal"> <path d="M444 70h28"></path> <path d="M500 70h28"></path> <rect height="22" rx="10" ry="10" width="28" x="472" y="59"></rect> <text x="486" y="74">;</text> </g> <path d="M528 70a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M 548 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="qualified-rule-diagram"><a class="self-link" href="#qualified-rule-diagram"></a>Qualified rule <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 384 80" width="384"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 40h0"></path> <path d="M240 40h0"></path> <path d="M40 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M60 20h160"></path> </g> <path d="M220 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M40 40h20"></path> <g> <path d="M60 40h0"></path> <path d="M220 40h0"></path> <path d="M60 40h10"></path> <g class="non-terminal"> <path d="M70 40h0"></path> <path d="M210 40h0"></path> <rect height="22" width="140" x="70" y="29"></rect> <text x="140" y="44">Component value</text> </g> <path d="M210 40h10"></path> <path d="M70 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M70 60h140"></path> </g> <path d="M210 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M220 40h20"></path> </g> <path d="M240 40h10"></path> <g class="non-terminal"> <path d="M250 40h0"></path> <path d="M334 40h0"></path> <rect height="22" width="84" x="250" y="29"></rect> <text x="292" y="44">{} block</text> </g> <path d="M334 40h10"></path> <path d="M 344 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="declaration-list-diagram"><a class="self-link" href="#declaration-list-diagram"></a>Declaration list <dd> <div class="railroad"> <svg class="railroad-diagram" height="101" viewBox="0 0 568 101" width="568"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="non-terminal"> <path d="M50 40h0"></path> <path d="M94 40h0"></path> <rect height="22" width="44" x="50" y="29"></rect> <text x="72" y="44">ws*</text> </g> <path d="M94 40h10"></path> <g> <path d="M104 40h0"></path> <path d="M528 40h0"></path> <path d="M104 40h20"></path> <g> <path d="M124 40h0"></path> <path d="M508 40h0"></path> <g> <path d="M124 40h0"></path> <path d="M272 40h0"></path> <path d="M124 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M144 20h108"></path> </g> <path d="M252 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M124 40h20"></path> <g class="non-terminal"> <path d="M144 40h0"></path> <path d="M252 40h0"></path> <rect height="22" width="108" x="144" y="29"></rect> <text x="198" y="44">Declaration</text> </g> <path d="M252 40h20"></path> </g> <g> <path d="M272 40h0"></path> <path d="M508 40h0"></path> <path d="M272 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M292 20h196"></path> </g> <path d="M488 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M272 40h20"></path> <g> <path d="M292 40h0"></path> <path d="M488 40h0"></path> <g class="terminal"> <path d="M292 40h0"></path> <path d="M320 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="292" y="29"></rect> <text x="306" y="44">;</text> </g> <path d="M320 40h10"></path> <path d="M330 40h10"></path> <g class="non-terminal"> <path d="M340 40h0"></path> <path d="M488 40h0"></path> <rect height="22" width="148" x="340" y="29"></rect> <text x="414" y="44">Declaration list</text> </g> </g> <path d="M488 40h20"></path> </g> </g> <path d="M508 40h20"></path> <path d="M104 40a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g> <path d="M124 70h70"></path> <path d="M438 70h70"></path> <g class="non-terminal"> <path d="M194 70h0"></path> <path d="M270 70h0"></path> <rect height="22" width="76" x="194" y="59"></rect> <text x="232" y="74">At-rule</text> </g> <path d="M270 70h10"></path> <path d="M280 70h10"></path> <g class="non-terminal"> <path d="M290 70h0"></path> <path d="M438 70h0"></path> <rect height="22" width="148" x="290" y="59"></rect> <text x="364" y="74">Declaration list</text> </g> </g> <path d="M508 70a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> </g> <path d="M 528 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="declaration-diagram"><a class="self-link" href="#declaration-diagram"></a>Declaration <dd> <div class="railroad"> <svg class="railroad-diagram" height="91" viewBox="0 0 676 91" width="676"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="non-terminal"> <path d="M50 40h0"></path> <path d="M174 40h0"></path> <rect height="22" width="124" x="50" y="29"></rect> <text x="112" y="44"><ident-token></text> </g> <path d="M174 40h10"></path> <path d="M184 40h10"></path> <g class="non-terminal"> <path d="M194 40h0"></path> <path d="M238 40h0"></path> <rect height="22" width="44" x="194" y="29"></rect> <text x="216" y="44">ws*</text> </g> <path d="M238 40h10"></path> <path d="M248 40h10"></path> <g class="terminal"> <path d="M258 40h0"></path> <path d="M286 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="258" y="29"></rect> <text x="272" y="44">:</text> </g> <path d="M286 40h10"></path> <g> <path d="M296 40h0"></path> <path d="M496 40h0"></path> <path d="M296 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M316 20h160"></path> </g> <path d="M476 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M296 40h20"></path> <g> <path d="M316 40h0"></path> <path d="M476 40h0"></path> <path d="M316 40h10"></path> <g class="non-terminal"> <path d="M326 40h0"></path> <path d="M466 40h0"></path> <rect height="22" width="140" x="326" y="29"></rect> <text x="396" y="44">Component value</text> </g> <path d="M466 40h10"></path> <path d="M326 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M326 60h140"></path> </g> <path d="M466 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M476 40h20"></path> </g> <g> <path d="M496 40h0"></path> <path d="M636 40h0"></path> <path d="M496 40h20"></path> <g> <path d="M516 40h100"></path> </g> <path d="M616 40h20"></path> <path d="M496 40a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M516 60h0"></path> <path d="M616 60h0"></path> <rect height="22" width="100" x="516" y="49"></rect> <text x="566" y="64">!important</text> </g> <path d="M616 60a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> </g> <path d="M 636 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="!important-diagram"><a class="self-link" href="#!important-diagram"></a>!important <dd> <div class="railroad"> <svg class="railroad-diagram" height="62" viewBox="0 0 496 62" width="496"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 31h10"></path> <g class="terminal"> <path d="M50 31h0"></path> <path d="M78 31h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="20"></rect> <text x="64" y="35">!</text> </g> <path d="M78 31h10"></path> <path d="M88 31h10"></path> <g class="non-terminal"> <path d="M98 31h0"></path> <path d="M142 31h0"></path> <rect height="22" width="44" x="98" y="20"></rect> <text x="120" y="35">ws*</text> </g> <path d="M142 31h10"></path> <path d="M152 31h10"></path> <g class="non-terminal"> <path d="M162 31h0"></path> <path d="M382 31h0"></path> <rect height="22" width="220" x="162" y="20"></rect> <text x="272" y="35"><ident-token "important"></text> </g> <path d="M382 31h10"></path> <path d="M392 31h10"></path> <g class="non-terminal"> <path d="M402 31h0"></path> <path d="M446 31h0"></path> <rect height="22" width="44" x="402" y="20"></rect> <text x="424" y="35">ws*</text> </g> <path d="M446 31h10"></path> <path d="M 456 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="component-value-diagram"><a class="self-link" href="#component-value-diagram"></a>Component value <dd> <div class="railroad"> <svg class="railroad-diagram" height="182" viewBox="0 0 260 182" width="260"> <g transform="translate(.5 .5)"> <path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <g> <path d="M40 31h0"></path> <path d="M220 31h0"></path> <path d="M40 31h20"></path> <g class="non-terminal"> <path d="M60 31h0"></path> <path d="M200 31h0"></path> <rect height="22" width="140" x="60" y="20"></rect> <text x="130" y="35">Preserved token</text> </g> <path d="M200 31h20"></path> <path d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M60 61h28"></path> <path d="M172 61h28"></path> <rect height="22" width="84" x="88" y="50"></rect> <text x="130" y="65">{} block</text> </g> <path d="M200 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path> <path d="M40 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M60 91h28"></path> <path d="M172 91h28"></path> <rect height="22" width="84" x="88" y="80"></rect> <text x="130" y="95">() block</text> </g> <path d="M200 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path> <path d="M40 31a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M60 121h28"></path> <path d="M172 121h28"></path> <rect height="22" width="84" x="88" y="110"></rect> <text x="130" y="125">[] block</text> </g> <path d="M200 121a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path> <path d="M40 31a10 10 0 0 1 10 10v100a10 10 0 0 0 10 10"></path> <g class="non-terminal"> <path d="M60 151h4"></path> <path d="M196 151h4"></path> <rect height="22" width="132" x="64" y="140"></rect> <text x="130" y="155">Function block</text> </g> <path d="M200 151a10 10 0 0 0 10 -10v-100a10 10 0 0 1 10 -10"></path> </g> <path d="M 220 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="{}-block-diagram"><a class="self-link" href="#%7b%7d-block-diagram"></a>{} block <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 376 80" width="376"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="terminal"> <path d="M50 40h0"></path> <path d="M78 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="29"></rect> <text x="64" y="44">{</text> </g> <path d="M78 40h10"></path> <g> <path d="M88 40h0"></path> <path d="M288 40h0"></path> <path d="M88 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M108 20h160"></path> </g> <path d="M268 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M88 40h20"></path> <g> <path d="M108 40h0"></path> <path d="M268 40h0"></path> <path d="M108 40h10"></path> <g class="non-terminal"> <path d="M118 40h0"></path> <path d="M258 40h0"></path> <rect height="22" width="140" x="118" y="29"></rect> <text x="188" y="44">Component value</text> </g> <path d="M258 40h10"></path> <path d="M118 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M118 60h140"></path> </g> <path d="M258 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M268 40h20"></path> </g> <path d="M288 40h10"></path> <g class="terminal"> <path d="M298 40h0"></path> <path d="M326 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="298" y="29"></rect> <text x="312" y="44">}</text> </g> <path d="M326 40h10"></path> <path d="M 336 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="()-block-diagram"><a class="self-link" href="#()-block-diagram"></a>() block <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 376 80" width="376"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="terminal"> <path d="M50 40h0"></path> <path d="M78 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="29"></rect> <text x="64" y="44">(</text> </g> <path d="M78 40h10"></path> <g> <path d="M88 40h0"></path> <path d="M288 40h0"></path> <path d="M88 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M108 20h160"></path> </g> <path d="M268 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M88 40h20"></path> <g> <path d="M108 40h0"></path> <path d="M268 40h0"></path> <path d="M108 40h10"></path> <g class="non-terminal"> <path d="M118 40h0"></path> <path d="M258 40h0"></path> <rect height="22" width="140" x="118" y="29"></rect> <text x="188" y="44">Component value</text> </g> <path d="M258 40h10"></path> <path d="M118 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M118 60h140"></path> </g> <path d="M258 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M268 40h20"></path> </g> <path d="M288 40h10"></path> <g class="terminal"> <path d="M298 40h0"></path> <path d="M326 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="298" y="29"></rect> <text x="312" y="44">)</text> </g> <path d="M326 40h10"></path> <path d="M 336 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="[]-block-diagram"><a class="self-link" href="#%5b%5d-block-diagram"></a>[] block <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 376 80" width="376"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="terminal"> <path d="M50 40h0"></path> <path d="M78 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="50" y="29"></rect> <text x="64" y="44">[</text> </g> <path d="M78 40h10"></path> <g> <path d="M88 40h0"></path> <path d="M288 40h0"></path> <path d="M88 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M108 20h160"></path> </g> <path d="M268 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M88 40h20"></path> <g> <path d="M108 40h0"></path> <path d="M268 40h0"></path> <path d="M108 40h10"></path> <g class="non-terminal"> <path d="M118 40h0"></path> <path d="M258 40h0"></path> <rect height="22" width="140" x="118" y="29"></rect> <text x="188" y="44">Component value</text> </g> <path d="M258 40h10"></path> <path d="M118 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M118 60h140"></path> </g> <path d="M258 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M268 40h20"></path> </g> <path d="M288 40h10"></path> <g class="terminal"> <path d="M298 40h0"></path> <path d="M326 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="298" y="29"></rect> <text x="312" y="44">]</text> </g> <path d="M326 40h10"></path> <path d="M 336 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> <dt id="function-block-diagram"><a class="self-link" href="#function-block-diagram"></a>Function block <dd> <div class="railroad"> <svg class="railroad-diagram" height="80" viewBox="0 0 496 80" width="496"> <g transform="translate(.5 .5)"> <path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path> <path d="M40 40h10"></path> <g class="non-terminal"> <path d="M50 40h0"></path> <path d="M198 40h0"></path> <rect height="22" width="148" x="50" y="29"></rect> <text x="124" y="44"><function-token></text> </g> <path d="M198 40h10"></path> <g> <path d="M208 40h0"></path> <path d="M408 40h0"></path> <path d="M208 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path> <g> <path d="M228 20h160"></path> </g> <path d="M388 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path> <path d="M208 40h20"></path> <g> <path d="M228 40h0"></path> <path d="M388 40h0"></path> <path d="M228 40h10"></path> <g class="non-terminal"> <path d="M238 40h0"></path> <path d="M378 40h0"></path> <rect height="22" width="140" x="238" y="29"></rect> <text x="308" y="44">Component value</text> </g> <path d="M378 40h10"></path> <path d="M238 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path> <g> <path d="M238 60h140"></path> </g> <path d="M378 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path> </g> <path d="M388 40h20"></path> </g> <path d="M408 40h10"></path> <g class="terminal"> <path d="M418 40h0"></path> <path d="M446 40h0"></path> <rect height="22" rx="10" ry="10" width="28" x="418" y="29"></rect> <text x="432" y="44">)</text> </g> <path d="M446 40h10"></path> <path d="M 456 40 h 20 m -10 -10 v 20 m 10 -20 v 20"></path> </g> </svg> </div> </dl> <h3 class="heading settled" data-level="5.2" id="parser-definitions"><span class="secno">5.2. </span><span class="content"> Definitions</span><a class="self-link" href="#parser-definitions"></a></h3> <dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="current-input-token">current input token</dfn> <dd> The token or <a data-link-type="dfn" href="#component-value" id="ref-for-component-value">component value</a> currently being operated on, from the list of tokens produced by the tokenizer. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="next-input-token">next input token</dfn> <dd> The token or <a data-link-type="dfn" href="#component-value" id="ref-for-component-value①">component value</a> following the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token">current input token</a> in the list of tokens produced by the tokenizer. If there isn’t a token following the <span id="ref-for-current-input-token①">current input token</span>, the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token">next input token</a> is an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②"><EOF-token></a>. <dt><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-eof-token"><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token③"><EOF-token></a></dfn> <dd> A conceptual token representing the end of the list of tokens. Whenever the list of tokens is empty, the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①">next input token</a> is always an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token④"><EOF-token></a>. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-the-next-input-token">consume the next input token</dfn> <dd> Let the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token②">current input token</a> be the current <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②">next input token</a>, adjusting the <span id="ref-for-next-input-token③">next input token</span> accordingly. <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="reconsume-the-current-input-token">reconsume the current input token</dfn> <dd> The next time an algorithm instructs you to <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token">consume the next input token</a>, instead do nothing (retain the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token③">current input token</a> unchanged). </dl> <h3 class="heading settled" data-level="5.3" id="parser-entry-points"><span class="secno">5.3. </span><span class="content"> Parser Entry Points</span><a class="self-link" href="#parser-entry-points"></a></h3> <p>The algorithms defined in this section produce high-level CSS objects from lists of CSS tokens.</p> <div class="algorithm" data-algorithm="normalize into a list of tokens"> The algorithms here are operate on a token stream as input, but for convenience can also be invoked with a number of other value types. <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-local-lt="normalize" id="normalize-into-a-token-stream">normalize into a token stream</dfn> a given <var>input</var>:</p> <ol> <li data-md> <p>If <var>input</var> is a list of CSS tokens, return <var>input</var>.</p> <li data-md> <p>If <var>input</var> is a list of CSS component values, return <var>input</var>.</p> <p class="note" role="note"><span>Note:</span> The only difference between a list of tokens and a list of component values is that some objects that "contain" things, like functions or blocks, are a single entity in the component-value list, but are multiple entities in a token list. This makes no difference to any of the algorithms in this specification.</p> <li data-md> <p>If <var>input</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string">string</a>, then <a data-link-type="dfn" href="#css-filter-code-points" id="ref-for-css-filter-code-points①">filter code points</a> from <var>input</var>, <a data-link-type="dfn" href="#css-tokenize" id="ref-for-css-tokenize">tokenize</a> the result, and return the final result.</p> <li data-md> <p class="assertion">Assert: Only the preceding types should be passed as <var>input</var>.</p> </ol> </div> <p class="note" role="note"><span>Note:</span> Other specs can define additional entry points for their own purposes.</p> <div class="note" role="note"> The following notes should probably be translated into normative text in the relevant specs, hooking this spec’s terms: <ul> <li> "<a data-link-type="dfn" href="#parse-a-stylesheet" id="ref-for-parse-a-stylesheet">Parse a stylesheet</a>" is intended to be the normal parser entry point, for parsing stylesheets. <li> "<a data-link-type="dfn" href="#parse-a-list-of-rules" id="ref-for-parse-a-list-of-rules">Parse a list of rules</a>" is intended for the content of at-rules such as <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-conditional/#at-ruledef-media" id="ref-for-at-ruledef-media②">@media</a>. It differs from "<a data-link-type="dfn" href="#parse-a-stylesheet" id="ref-for-parse-a-stylesheet①">Parse a stylesheet</a>" in the handling of <a class="production css" data-link-type="type" href="#typedef-cdo-token" id="ref-for-typedef-cdo-token②"><CDO-token></a> and <a class="production css" data-link-type="type" href="#typedef-cdc-token" id="ref-for-typedef-cdc-token②"><CDC-token></a>. <li> "<a data-link-type="dfn" href="#parse-a-rule" id="ref-for-parse-a-rule">Parse a rule</a>" is intended for use by the <code>CSSStyleSheet#insertRule</code> method, and similar functions which might exist, which parse text into a single rule. <li> "<a data-link-type="dfn" href="#parse-a-declaration" id="ref-for-parse-a-declaration">Parse a declaration</a>" is used in <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-conditional/#at-ruledef-supports" id="ref-for-at-ruledef-supports">@supports</a> conditions. <a data-link-type="biblio" href="#biblio-css3-conditional">[CSS3-CONDITIONAL]</a> <li> "<a data-link-type="dfn" href="#parse-a-list-of-declarations" id="ref-for-parse-a-list-of-declarations①">Parse a list of declarations</a>" is for the contents of a <code>style</code> attribute, which parses text into the contents of a single style rule. <li> "<a data-link-type="dfn" href="#parse-a-component-value" id="ref-for-parse-a-component-value">Parse a component value</a>" is for things that need to consume a single value, like the parsing rules for <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-values-3/#funcdef-attr" id="ref-for-funcdef-attr">attr()</a>. <li> "<a data-link-type="dfn" href="#parse-a-list-of-component-values" id="ref-for-parse-a-list-of-component-values">Parse a list of component values</a>" is for the contents of presentational attributes, which parse text into a single declaration’s value, or for parsing a stand-alone selector <a data-link-type="biblio" href="#biblio-select">[SELECT]</a> or list of Media Queries <a data-link-type="biblio" href="#biblio-mediaq">[MEDIAQ]</a>, as in <a href="https://www.w3.org/TR/selectors-api/">Selectors API</a> or the <code>media</code> HTML attribute. </ul> </div> <h4 class="heading settled" data-level="5.3.1" id="parse-grammar"><span class="secno">5.3.1. </span><span class="content"> Parse something according to a CSS grammar</span><a class="self-link" href="#parse-grammar"></a></h4> <p>It is often desirable to parse a string or token list to see if it matches some CSS grammar, and if it does, to destructure it according to the grammar. This section provides a generic hook for this kind of operation. It should be invoked like <span class="informative">"parse <var>foo</var> as a CSS <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-color-4/#typedef-color" id="ref-for-typedef-color" title="Expands to: aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | currentcolor | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | none | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | transparent | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen"><color></a>"</span>, or similar.</p> <p>This algorithm returns either failure, if the input does not match the provided grammar, or the result of parsing the input according to the grammar, which is an unspecified structure corresponding to the provided grammar specification. The return value must only be interacted with by specification prose, where the representation ambiguity is not problematic. If it is meant to be exposed outside of spec language, the spec using the result must explicitly translate it into a well-specified representation, such as, for example, by invoking a CSS serialization algorithm <span class="informative">(like "serialize as a CSS <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value"><string></a> value").</span></p> <p class="note" role="note"><span>Note:</span> This algorithm, and <a data-link-type="dfn" href="#css-parse-a-comma-separated-list-according-to-a-css-grammar" id="ref-for-css-parse-a-comma-separated-list-according-to-a-css-grammar">parse a comma-separated list according to a CSS grammar</a>, are <em>usually</em> the only parsing algorithms other specs will want to call. The remaining parsing algorithms are meant mostly for <a data-link-type="biblio" href="#biblio-cssom">[CSSOM]</a> and related "explicitly constructing CSS structures" cases. Consult the CSSWG for guidance first if you think you need to use one of the other algorithms.</p> <div class="algorithm" data-algorithm="parse something according to a CSS grammar" data-algorithm-for="CSS"> To <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export data-lt="parse something according to a CSS grammar|parse" id="css-parse-something-according-to-a-css-grammar">parse something according to a CSS grammar</dfn> (aka simply <a data-link-type="dfn" href="#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar">parse</a>) given an <var>input</var> and a CSS <var>grammar</var> production: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> <a data-link-type="dfn" href="#parse-a-list-of-component-values" id="ref-for-parse-a-list-of-component-values①">Parse a list of component values</a> from <var>input</var>, and let <var>result</var> be the return value. <li> Attempt to match <var>result</var> against <var>grammar</var>. If this is successful, return the matched result; otherwise, return failure. </ol> </div> <h4 class="heading settled" data-level="5.3.2" id="parse-comma-list"><span class="secno">5.3.2. </span><span class="content"> Parse A Comma-Separated List According To A CSS Grammar</span><a class="self-link" href="#parse-comma-list"></a></h4> <p>While one can definitely <a data-link-type="dfn" href="#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar①">parse</a> a value according to a grammar with commas in it, if <em>any</em> part of the value fails to parse, the entire thing doesn’t parse, and returns failure.</p> <p>Sometimes that’s what’s desired (such as in list-valued CSS properties); other times, it’s better to let each comma-separated sub-part of the value parse separately, dealing with the parts that parse successfully one way, and the parts that fail to parse another way (typically ignoring them, such as in <code><a data-link-type="element-sub" href="https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-sizes" id="ref-for-attr-img-sizes"><img sizes></a></code>).</p> <p>This algorithm provides an easy hook to accomplish exactly that. It returns a list of values split by "top-level" commas, where each values is either failure (if it failed to parse) or the result of parsing (an unspecified structure, as described in the <a data-link-type="dfn" href="#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar②">parse</a> algorithm).</p> <div class="algorithm" data-algorithm="parse a comma-separated list according to a CSS grammar" data-algorithm-for="CSS"> To <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export data-lt="parse a comma-separated list according to a CSS grammar|parse a list|parsing a list" id="css-parse-a-comma-separated-list-according-to-a-css-grammar">parse a comma-separated list according to a CSS grammar</dfn> (aka <a data-link-type="dfn" href="#css-parse-a-comma-separated-list-according-to-a-css-grammar" id="ref-for-css-parse-a-comma-separated-list-according-to-a-css-grammar①">parse a list</a>) given an <var>input</var> and a CSS <var>grammar</var> production: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream①">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> If <var>input</var> contains only <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token②"><whitespace-token></a>s, return an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list">list</a>. <li> <a data-link-type="dfn" href="#parse-a-comma-separated-list-of-component-values" id="ref-for-parse-a-comma-separated-list-of-component-values">Parse a comma-separated list of component values</a> from <var>input</var>, and let <var>list</var> be the return value. <li> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate">For each</a> <var>item</var> of <var>list</var>, replace <var>item</var> with the result of <a data-link-type="dfn" href="#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar③">parsing</a> <var>item</var> with <var>grammar</var>. <li> Return <var>list</var>. </ol> </div> <h4 class="heading settled" data-level="5.3.3" id="parse-stylesheet"><span class="secno">5.3.3. </span><span class="content"> Parse a stylesheet</span><a class="self-link" href="#parse-stylesheet"></a></h4> <div class="algorithm" data-algorithm="parse a stylesheet"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-stylesheet">parse a stylesheet</dfn> from an <var>input</var> given an optional <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url">url</a> <var>location</var>: <ol> <li> If <var>input</var> is a byte stream for stylesheet, <a data-link-type="dfn" href="#css-decode-bytes" id="ref-for-css-decode-bytes">decode bytes</a> from <var>input</var>, and set <var>input</var> to the result. <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream②">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> Create a new stylesheet, with its <a data-link-type="dfn" href="https://www.w3.org/TR/cssom-1/#concept-css-style-sheet-location" id="ref-for-concept-css-style-sheet-location">location</a> set to <var>location</var> (or null, if <var>location</var> was not passed). <li> <a data-link-type="dfn" href="#consume-a-list-of-rules" id="ref-for-consume-a-list-of-rules">Consume a list of rules</a> from <var>input</var>, with the <var>top-level flag</var> set, and set the stylesheet’s value to the result. <li> Return the stylesheet. </ol> </div> <h4 class="heading settled" data-level="5.3.4" id="parse-list-of-rules"><span class="secno">5.3.4. </span><span class="content"> Parse a list of rules</span><a class="self-link" href="#parse-list-of-rules"></a></h4> <div class="algorithm" data-algorithm="parse a list of rules"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-list-of-rules">parse a list of rules</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream③">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> <a data-link-type="dfn" href="#consume-a-list-of-rules" id="ref-for-consume-a-list-of-rules①">Consume a list of rules</a> from the <var>input</var>, with the <var>top-level flag</var> unset. <li> Return the returned list. </ol> </div> <h4 class="heading settled" data-level="5.3.5" id="parse-rule"><span class="secno">5.3.5. </span><span class="content"> Parse a rule</span><a class="self-link" href="#parse-rule"></a></h4> <div class="algorithm" data-algorithm="parse a rule"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-rule">parse a rule</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream④">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token④">next input token</a> from <var>input</var> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token③"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token①">consume the next input token</a> from <var>input</var>. <li> If the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token⑤">next input token</a> from <var>input</var> is an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token⑤"><EOF-token></a>, return a syntax error. <p>Otherwise, if the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token⑥">next input token</a> from <var>input</var> is an <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token⑤"><at-keyword-token></a>, <a data-link-type="dfn" href="#consume-an-at-rule" id="ref-for-consume-an-at-rule">consume an at-rule</a> from <var>input</var>, and let <var>rule</var> be the return value.</p> <p>Otherwise, <a data-link-type="dfn" href="#consume-a-qualified-rule" id="ref-for-consume-a-qualified-rule">consume a qualified rule</a> from <var>input</var> and let <var>rule</var> be the return value. If nothing was returned, return a syntax error.</p> <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token⑦">next input token</a> from <var>input</var> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token④"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token②">consume the next input token</a> from <var>input</var>. <li> If the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token⑧">next input token</a> from <var>input</var> is an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token⑥"><EOF-token></a>, return <var>rule</var>. Otherwise, return a syntax error. </ol> </div> <h4 class="heading settled" data-level="5.3.6" id="parse-declaration"><span class="secno">5.3.6. </span><span class="content"> Parse a declaration</span><a class="self-link" href="#parse-declaration"></a></h4> <p class="note" role="note"><span>Note:</span> Unlike "<a data-link-type="dfn" href="#parse-a-list-of-declarations" id="ref-for-parse-a-list-of-declarations②">Parse a list of declarations</a>", this parses only a declaration and not an at-rule.</p> <div class="algorithm" data-algorithm="parse a declaration"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-declaration">parse a declaration</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream⑤">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token⑨">next input token</a> from <var>input</var> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token⑤"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token③">consume the next input token</a>. <li> If the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①⓪">next input token</a> from <var>input</var> is not an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token⑥"><ident-token></a>, return a syntax error. <li> <a data-link-type="dfn" href="#consume-a-declaration" id="ref-for-consume-a-declaration">Consume a declaration</a> from <var>input</var>. If anything was returned, return it. Otherwise, return a syntax error. </ol> </div> <h4 class="heading settled" data-level="5.3.7" id="parse-style-blocks-contents"><span class="secno">5.3.7. </span><span class="content"> Parse a style block’s contents</span><a class="self-link" href="#parse-style-blocks-contents"></a></h4> <p class="note" role="note"><span>Note:</span> This algorithm parses the contents of <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule②">style rules</a>, which need to allow <em>nested</em> style rules and other <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①④">at-rules</a>. If you don’t need nested <span id="ref-for-style-rule③">style rules</span>, such as in <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-page-3/#at-ruledef-page" id="ref-for-at-ruledef-page①">@page</a> or in <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes">@keyframes</a> child rules, use <a data-link-type="dfn" href="#parse-a-list-of-declarations" id="ref-for-parse-a-list-of-declarations③">parse a list of declarations</a>.</p> <div class="algorithm" data-algorithm="parse a style block’s contents"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-style-blocks-contents">parse a style block’s contents</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream⑥">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> <a data-link-type="dfn" href="#consume-a-style-blocks-contents" id="ref-for-consume-a-style-blocks-contents">Consume a style block’s contents</a> from <var>input</var>, and return the result. </ol> </div> <h4 class="heading settled" data-level="5.3.8" id="parse-list-of-declarations"><span class="secno">5.3.8. </span><span class="content"> Parse a list of declarations</span><a class="self-link" href="#parse-list-of-declarations"></a></h4> <p class="note" role="note"><span>Note:</span> Despite the name, this actually parses a mixed list of declarations and at-rules, as CSS 2.1 does for <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-page-3/#at-ruledef-page" id="ref-for-at-ruledef-page②">@page</a>. Unexpected at-rules (which could be all of them, in a given context) are invalid and will be ignored by the consumer.</p> <p class="note" role="note"><span>Note:</span> This algorithm does not handle nested <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule④">style rules</a>. If your use requires that, use <a data-link-type="dfn" href="#parse-a-style-blocks-contents" id="ref-for-parse-a-style-blocks-contents">parse a style block’s contents</a>.</p> <div class="algorithm" data-algorithm="parse a list of declarations"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-list-of-declarations">parse a list of declarations</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream⑦">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> <a data-link-type="dfn" href="#consume-a-list-of-declarations" id="ref-for-consume-a-list-of-declarations">Consume a list of declarations</a> from <var>input</var>, and return the result. </ol> </div> <h4 class="heading settled" data-level="5.3.9" id="parse-component-value"><span class="secno">5.3.9. </span><span class="content"> Parse a component value</span><a class="self-link" href="#parse-component-value"></a></h4> <div class="algorithm" data-algorithm="parse a component value"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-component-value">parse a component value</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream⑧">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①①">next input token</a> from <var>input</var> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token⑥"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token④">consume the next input token</a> from <var>input</var>. <li> If the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①②">next input token</a> from <var>input</var> is an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token⑦"><EOF-token></a>, return a syntax error. <li> <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value">Consume a component value</a> from <var>input</var> and let <var>value</var> be the return value. <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①③">next input token</a> from <var>input</var> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token⑦"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token⑤">consume the next input token</a>. <li> If the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①④">next input token</a> from <var>input</var> is an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token⑧"><EOF-token></a>, return <var>value</var>. Otherwise, return a syntax error. </ol> </div> <h4 class="heading settled" data-level="5.3.10" id="parse-list-of-component-values"><span class="secno">5.3.10. </span><span class="content"> Parse a list of component values</span><a class="self-link" href="#parse-list-of-component-values"></a></h4> <div class="algorithm" data-algorithm="parse a list of component values"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-list-of-component-values">parse a list of component values</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream⑨">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> Repeatedly <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value①">consume a component value</a> from <var>input</var> until an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token⑨"><EOF-token></a> is returned, appending the returned values (except the final <span class="production" id="ref-for-typedef-eof-token①⓪"><EOF-token></span>) into a list. Return the list. </ol> </div> <h4 class="heading settled" data-level="5.3.11" id="parse-comma-separated-list-of-component-values"><span class="secno">5.3.11. </span><span class="content"> Parse a comma-separated list of component values</span><a class="self-link" href="#parse-comma-separated-list-of-component-values"></a></h4> <div class="algorithm" data-algorithm="parse a comma-separated list of component values"> To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="parse-a-comma-separated-list-of-component-values">parse a comma-separated list of component values</dfn> from <var>input</var>: <ol> <li> <a data-link-type="dfn" href="#normalize-into-a-token-stream" id="ref-for-normalize-into-a-token-stream①⓪">Normalize</a> <var>input</var>, and set <var>input</var> to the result. <li> Let <var>list of cvls</var> be an initially empty list of component value lists. <li> Repeatedly <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value②">consume a component value</a> from <var>input</var> until an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①①"><EOF-token></a> or <a class="production css" data-link-type="type" href="#typedef-comma-token" id="ref-for-typedef-comma-token①"><comma-token></a> is returned, appending the returned values (except the final <span class="production" id="ref-for-typedef-eof-token①②"><EOF-token></span> or <span class="production" id="ref-for-typedef-comma-token②"><comma-token></span>) into a list. Append the list to <var>list of cvls</var>. <p>If it was a <a class="production css" data-link-type="type" href="#typedef-comma-token" id="ref-for-typedef-comma-token③"><comma-token></a> that was returned, repeat this step.</p> <li> Return <var>list of cvls</var>. </ol> </div> <h3 class="heading settled" data-level="5.4" id="parser-algorithms"><span class="secno">5.4. </span><span class="content"> Parser Algorithms</span><a class="self-link" href="#parser-algorithms"></a></h3> <p>The following algorithms comprise the parser. They are called by the parser entry points above.</p> <p>These algorithms may be called with a list of either tokens or of component values. (The difference being that some tokens are replaced by <a data-link-type="dfn" href="#function" id="ref-for-function①">functions</a> and <a data-link-type="dfn" href="#simple-block" id="ref-for-simple-block②">simple blocks</a> in a list of component values.) Similar to how the input stream returned EOF code points to represent when it was empty during the tokenization stage, the lists in this stage must return an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①③"><EOF-token></a> when the next token is requested but they are empty.</p> <p>An algorithm may be invoked with a specific list, in which case it consumes only that list (and when that list is exhausted, it begins returning <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①④"><EOF-token></a>s). Otherwise, it is implicitly invoked with the same list as the invoking algorithm.</p> <h4 class="heading settled" data-level="5.4.1" id="consume-list-of-rules"><span class="secno">5.4.1. </span><span class="content"> Consume a list of rules</span><a class="self-link" href="#consume-list-of-rules"></a></h4> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-list-of-rules">consume a list of rules</dfn>, given a <var>top-level flag</var>:</p> <p>Create an initially empty list of rules.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①⑤">next input token</a>:</p> <dl> <dt><a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token⑧"><whitespace-token></a> <dd> Do nothing. <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①⑤"><EOF-token></a> <dd> Return the list of rules. <dt><a class="production css" data-link-type="type" href="#typedef-cdo-token" id="ref-for-typedef-cdo-token③"><CDO-token></a> <dt><a class="production css" data-link-type="type" href="#typedef-cdc-token" id="ref-for-typedef-cdc-token③"><CDC-token></a> <dd> If the <var>top-level flag</var> is set, do nothing. <p>Otherwise, <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token">reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-qualified-rule" id="ref-for-consume-a-qualified-rule①">Consume a qualified rule</a>. If anything is returned, append it to the list of rules.</p> <dt><a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token⑥"><at-keyword-token></a> <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token①">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-an-at-rule" id="ref-for-consume-an-at-rule①">Consume an at-rule</a>, and append the returned value to the list of rules. <dt>anything else <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token②">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-qualified-rule" id="ref-for-consume-a-qualified-rule②">Consume a qualified rule</a>. If anything is returned, append it to the list of rules. </dl> <h4 class="heading settled" data-level="5.4.2" id="consume-at-rule"><span class="secno">5.4.2. </span><span class="content"> Consume an at-rule</span><a class="self-link" href="#consume-at-rule"></a></h4> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-an-at-rule">consume an at-rule</dfn>:</p> <p><a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token⑥">Consume the next input token</a>. Create a new at-rule with its name set to the value of the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token④">current input token</a>, its prelude initially set to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①">list</a>, and its value initially set to nothing.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①⑥">next input token</a>:</p> <dl> <dt><a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token②"><semicolon-token></a> <dd> Return the at-rule. <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①⑥"><EOF-token></a> <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error⑨">parse error</a>. Return the at-rule. <dt><a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly④"><{-token></a> <dd> <a data-link-type="dfn" href="#consume-a-simple-block" id="ref-for-consume-a-simple-block">Consume a simple block</a> and assign it to the at-rule’s block. Return the at-rule. <dt><a data-link-type="dfn" href="#simple-block" id="ref-for-simple-block③">simple block</a> with an associated token of <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly⑤"><{-token></a> <dd> Assign the block to the at-rule’s block. Return the at-rule. <dt>anything else <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token③">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value③">Consume a component value</a>. Append the returned value to the at-rule’s prelude. </dl> <h4 class="heading settled" data-level="5.4.3" id="consume-qualified-rule"><span class="secno">5.4.3. </span><span class="content"> Consume a qualified rule</span><a class="self-link" href="#consume-qualified-rule"></a></h4> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-qualified-rule">consume a qualified rule</dfn>:</p> <p>Create a new qualified rule with its prelude initially set to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list②">list</a>, and its value initially set to nothing.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①⑦">next input token</a>:</p> <dl> <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①⑦"><EOF-token></a> <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①⓪">parse error</a>. Return nothing. <dt><a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly⑥"><{-token></a> <dd> <a data-link-type="dfn" href="#consume-a-simple-block" id="ref-for-consume-a-simple-block①">Consume a simple block</a> and assign it to the qualified rule’s block. Return the qualified rule. <dt><a data-link-type="dfn" href="#simple-block" id="ref-for-simple-block④">simple block</a> with an associated token of <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly⑦"><{-token></a> <dd> Assign the block to the qualified rule’s block. Return the qualified rule. <dt>anything else <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token④">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value④">Consume a component value</a>. Append the returned value to the qualified rule’s prelude. </dl> <h4 class="heading settled" data-level="5.4.4" id="consume-style-block"><span class="secno">5.4.4. </span><span class="content"> Consume a style block’s contents</span><a class="self-link" href="#consume-style-block"></a></h4> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-style-blocks-contents">consume a style block’s contents</dfn>:</p> <p>Create an initially empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list③">list</a> of declarations <var>decls</var>, and an initially empty <span id="ref-for-list④">list</span> of rules <var>rules</var>.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①⑧">next input token</a>:</p> <dl> <dt><a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token⑨"><whitespace-token></a> <dt><a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token③"><semicolon-token></a> <dd> Do nothing. <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①⑧"><EOF-token></a> <dd> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-extend" id="ref-for-list-extend">Extend</a> <var>decls</var> with <var>rules</var>, then return <var>decls</var>. <dt><a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token⑦"><at-keyword-token></a> <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token⑤">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-an-at-rule" id="ref-for-consume-an-at-rule②">Consume an at-rule</a>, and append the result to <var>rules</var>. <dt><a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token⑦"><ident-token></a> <dd> Initialize a temporary list initially filled with the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token⑤">current input token</a>. As long as the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token①⑨">next input token</a> is anything other than a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token④"><semicolon-token></a> or <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token①⑨"><EOF-token></a>, <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value⑤">consume a component value</a> and append it to the temporary list. <a data-link-type="dfn" href="#consume-a-declaration" id="ref-for-consume-a-declaration①">Consume a declaration</a> from the temporary list. If anything was returned, append it to <var>decls</var>. <dt><a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token⑨"><delim-token></a> with a value of "&" (U+0026 AMPERSAND) <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token⑥">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-qualified-rule" id="ref-for-consume-a-qualified-rule③">Consume a qualified rule</a>. If anything was returned, append it to <var>rules</var>. <dt>anything else <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①①">parse error</a>. <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token⑦">Reconsume the current input token</a>. As long as the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②⓪">next input token</a> is anything other than a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token⑤"><semicolon-token></a> or <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②⓪"><EOF-token></a>, <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value⑥">consume a component value</a> and throw away the returned value. </dl> <h4 class="heading settled" data-level="5.4.5" id="consume-list-of-declarations"><span class="secno">5.4.5. </span><span class="content"> Consume a list of declarations</span><a class="self-link" href="#consume-list-of-declarations"></a></h4> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-list-of-declarations">consume a list of declarations</dfn>:</p> <p>Create an initially empty list of declarations.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②①">next input token</a>:</p> <dl> <dt><a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①⓪"><whitespace-token></a> <dt><a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token⑥"><semicolon-token></a> <dd> Do nothing. <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②①"><EOF-token></a> <dd> Return the list of declarations. <dt><a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token⑧"><at-keyword-token></a> <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token⑧">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-an-at-rule" id="ref-for-consume-an-at-rule③">Consume an at-rule</a>. Append the returned rule to the list of declarations. <dt><a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token⑧"><ident-token></a> <dd> Initialize a temporary list initially filled with the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token⑥">current input token</a>. As long as the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②②">next input token</a> is anything other than a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token⑦"><semicolon-token></a> or <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②②"><EOF-token></a>, <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value⑦">consume a component value</a> and append it to the temporary list. <a data-link-type="dfn" href="#consume-a-declaration" id="ref-for-consume-a-declaration②">Consume a declaration</a> from the temporary list. If anything was returned, append it to the list of declarations. <dt>anything else <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①②">parse error</a>. <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token⑨">Reconsume the current input token</a>. As long as the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②③">next input token</a> is anything other than a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token⑧"><semicolon-token></a> or <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②③"><EOF-token></a>, <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value⑧">consume a component value</a> and throw away the returned value. </dl> <h4 class="heading settled" data-level="5.4.6" id="consume-declaration"><span class="secno">5.4.6. </span><span class="content"> Consume a declaration</span><a class="self-link" href="#consume-declaration"></a></h4> <p class="note" role="note"><span>Note:</span> This algorithm assumes that the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②④">next input token</a> has already been checked to be an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token⑨"><ident-token></a>.</p> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-declaration">consume a declaration</dfn>:</p> <p><a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token⑦">Consume the next input token</a>. Create a new declaration with its name set to the value of the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token⑦">current input token</a> and its value initially set to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤">list</a>.</p> <ol> <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②⑤">next input token</a> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①①"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token⑧">consume the next input token</a>. <li> If the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②⑥">next input token</a> is anything other than a <a class="production css" data-link-type="type" href="#typedef-colon-token" id="ref-for-typedef-colon-token①"><colon-token></a>, this is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①③">parse error</a>. Return nothing. <p>Otherwise, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token⑨">consume the next input token</a>.</p> <li> While the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②⑦">next input token</a> is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①②"><whitespace-token></a>, <a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token①⓪">consume the next input token</a>. <li> As long as the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②⑧">next input token</a> is anything other than an <a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②④"><EOF-token></a>, <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value⑨">consume a component value</a> and append it to the declaration’s value. <li> If the last two non-<a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①③"><whitespace-token></a>s in the declaration’s value are a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①⓪"><delim-token></a> with the value "!" followed by an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①⓪"><ident-token></a> with a value that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive①">ASCII case-insensitive</a> match for "important", remove them from the declaration’s value and set the declaration’s <var>important</var> flag to true. <li> While the last token in the declaration’s value is a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①④"><whitespace-token></a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove">remove</a> that token. <li> Return the declaration. </ol> <h4 class="heading settled" data-level="5.4.7" id="consume-component-value"><span class="secno">5.4.7. </span><span class="content"> Consume a component value</span><a class="self-link" href="#consume-component-value"></a></h4> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-component-value">consume a component value</dfn>:</p> <p><a data-link-type="dfn" href="#consume-the-next-input-token" id="ref-for-consume-the-next-input-token①①">Consume the next input token</a>.</p> <p>If the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token⑧">current input token</a> is a <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly⑧"><{-token></a>, <a href="#tokendef-open-square" id="ref-for-tokendef-open-square③"><[-token></a>, or <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren③"><(-token></a>, <a data-link-type="dfn" href="#consume-a-simple-block" id="ref-for-consume-a-simple-block②">consume a simple block</a> and return it.</p> <p>Otherwise, if the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token⑨">current input token</a> is a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token⑧"><function-token></a>, <a data-link-type="dfn" href="#consume-a-function" id="ref-for-consume-a-function">consume a function</a> and return it.</p> <p>Otherwise, return the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token①⓪">current input token</a>.</p> <h4 class="heading settled" data-level="5.4.8" id="consume-simple-block"><span class="secno">5.4.8. </span><span class="content"> Consume a simple block</span><a class="self-link" href="#consume-simple-block"></a></h4> <p class="note" role="note"><span>Note:</span> This algorithm assumes that the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token①①">current input token</a> has already been checked to be an <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly⑨"><{-token></a>, <a href="#tokendef-open-square" id="ref-for-tokendef-open-square④"><[-token></a>, or <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren④"><(-token></a>.</p> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-simple-block">consume a simple block</dfn>:</p> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="ending-token">ending token</dfn> is the mirror variant of the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token①②">current input token</a>. (E.g. if it was called with <a href="#tokendef-open-square" id="ref-for-tokendef-open-square⑤"><[-token></a>, the <a data-link-type="dfn" href="#ending-token" id="ref-for-ending-token">ending token</a> is <a href="#tokendef-close-square" id="ref-for-tokendef-close-square②"><]-token></a>.)</p> <p>Create a <a data-link-type="dfn" href="#simple-block" id="ref-for-simple-block⑤">simple block</a> with its associated token set to the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token①③">current input token</a> and with its value initially set to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑥">list</a>.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token②⑨">next input token</a> and process it as follows:</p> <dl> <dt><a data-link-type="dfn" href="#ending-token" id="ref-for-ending-token①">ending token</a> <dd> Return the block. <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②⑤"><EOF-token></a> <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①④">parse error</a>. Return the block. <dt>anything else <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token①⓪">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value①⓪">Consume a component value</a> and append it to the value of the block. </dl> <p class="note" role="note"><span>Note:</span> CSS has an unfortunate syntactic ambiguity between blocks that can contain declarations and blocks that can contain qualified rules, so any "consume" algorithms that handle rules will initially use this more generic algorithm rather than the more specific <a data-link-type="dfn" href="#consume-a-list-of-declarations" id="ref-for-consume-a-list-of-declarations①">consume a list of declarations</a> or <a data-link-type="dfn" href="#consume-a-list-of-rules" id="ref-for-consume-a-list-of-rules②">consume a list of rules</a> algorithms. These more specific algorithms are instead invoked when grammars are applied, depending on whether it contains a <a class="production css" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list"><declaration-list></a> or a <a class="production css" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list"><rule-list></a>/<a class="production css" data-link-type="type" href="#typedef-stylesheet" id="ref-for-typedef-stylesheet"><stylesheet></a>.</p> <h4 class="heading settled" data-level="5.4.9" id="consume-function"><span class="secno">5.4.9. </span><span class="content"> Consume a function</span><a class="self-link" href="#consume-function"></a></h4> <p class="note" role="note"><span>Note:</span> This algorithm assumes that the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token①④">current input token</a> has already been checked to be a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token⑨"><function-token></a>.</p> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="consume-a-function">consume a function</dfn>:</p> <p>Create a function with its name equal to the value of the <a data-link-type="dfn" href="#current-input-token" id="ref-for-current-input-token①⑤">current input token</a> and with its value initially set to an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑦">list</a>.</p> <p>Repeatedly consume the <a data-link-type="dfn" href="#next-input-token" id="ref-for-next-input-token③⓪">next input token</a> and process it as follows:</p> <dl> <dt><a href="#tokendef-close-paren" id="ref-for-tokendef-close-paren②"><)-token></a> <dd> Return the function. <dt><a class="production css" data-link-type="type" href="#typedef-eof-token" id="ref-for-typedef-eof-token②⑥"><EOF-token></a> <dd> This is a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①⑤">parse error</a>. Return the function. <dt>anything else <dd> <a data-link-type="dfn" href="#reconsume-the-current-input-token" id="ref-for-reconsume-the-current-input-token①①">Reconsume the current input token</a>. <a data-link-type="dfn" href="#consume-a-component-value" id="ref-for-consume-a-component-value①①">Consume a component value</a> and append the returned value to the function’s value. </dl> <h2 class="heading settled" data-level="6" id="anb-microsyntax"><span class="secno">6. </span><span class="content"> The <var>An+B</var> microsyntax</span><a class="self-link" href="#anb-microsyntax"></a></h2> <p>Several things in CSS, such as the <span class="informative"><a class="css" data-link-type="maybe" href="https://www.w3.org/TR/selectors-4/#nth-child-pseudo" id="ref-for-nth-child-pseudo">:nth-child()</a></span> pseudoclass, need to indicate indexes in a list. The <var>An+B</var> microsyntax is useful for this, allowing an author to easily indicate single elements or all elements at regularly-spaced intervals in a list.</p> <p>The <dfn data-dfn-type="dfn" data-export id="anb">An+B<a class="self-link" href="#anb"></a></dfn> notation defines an integer step (<var>A</var>) and offset (<var>B</var>), and represents the <var>An+B</var>th elements in a list, for every positive integer or zero value of <var>n</var>, with the first element in the list having index 1 (not 0).</p> <p>For values of <var>A</var> and <var>B</var> greater than 0, this effectively divides the list into groups of <var>A</var> elements (the last group taking the remainder), and selecting the <var>B</var>th element of each group.</p> <p>The <var>An+B</var> notation also accepts the <span class="css">even</span> and <span class="css">odd</span> keywords, which have the same meaning as <span class="css">2n</span> and <span class="css">2n+1</span>, respectively.</p> <div class="example" id="example-0b8828eb"> <a class="self-link" href="#example-0b8828eb"></a> <p>Examples: </p> <pre>2n+0 /* represents all of the even elements in the list */ even /* same */ 4n+1 /* represents the 1st, 5th, 9th, 13th, etc. elements in the list */</pre> </div> <p>The values of <var>A</var> and <var>B</var> can be negative, but only the positive results of <var>An+B</var>, for <var>n</var> ≥ 0, are used.</p> <div class="example" id="example-34cd21ee"> <a class="self-link" href="#example-34cd21ee"></a> <p>Example: </p> <pre>-1n+6 /* represents the first 6 elements of the list */ -4n+10 /* represents the 2nd, 6th, and 10th elements of the list */ </pre> </div> <p>If both <var>A</var> and <var>B</var> are 0, the pseudo-class represents no element in the list.</p> <h3 class="heading settled" data-level="6.1" id="anb-syntax"><span class="secno">6.1. </span><span class="content"> Informal Syntax Description</span><a class="self-link" href="#anb-syntax"></a></h3> <p><em>This section is non-normative.</em></p> <p>When <var>A</var> is 0, the <var>An</var> part may be omitted (unless the <var>B</var> part is already omitted). When <var>An</var> is not included and <var>B</var> is non-negative, the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/selectors-4/#selectordef-adjacent" id="ref-for-selectordef-adjacent">+</a> sign before <var>B</var> (when allowed) may also be omitted. In this case the syntax simplifies to just <var>B</var>.</p> <div class="example" id="example-335ba750"> <a class="self-link" href="#example-335ba750"></a> <p>Examples: </p> <pre>0n+5 /* represents the 5th element in the list */ 5 /* same */</pre> </div> <p>When <var>A</var> is 1 or -1, the <code>1</code> may be omitted from the rule.</p> <div class="example" id="example-5d33d659"> <a class="self-link" href="#example-5d33d659"></a> <p>Examples: </p> <p>The following notations are therefore equivalent: </p> <pre>1n+0 /* represents all elements in the list */ n+0 /* same */ n /* same */</pre> </div> <p>If <var>B</var> is 0, then every <var>A</var>th element is picked. In such a case, the <var>+B</var> (or <var>-B</var>) part may be omitted unless the <var>A</var> part is already omitted.</p> <div class="example" id="example-c62dcd18"> <a class="self-link" href="#example-c62dcd18"></a> <p>Examples: </p> <pre>2n+0 /* represents every even element in the list */ 2n /* same */</pre> </div> <p>When B is negative, its minus sign replaces the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/selectors-4/#selectordef-adjacent" id="ref-for-selectordef-adjacent①">+</a> sign.</p> <div class="example" id="example-3d25855e"> <a class="self-link" href="#example-3d25855e"></a> <p>Valid example: </p> <pre>3n-6</pre> <p>Invalid example: </p> <pre>3n + -6</pre> </div> <p>Whitespace is permitted on either side of the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/selectors-4/#selectordef-adjacent" id="ref-for-selectordef-adjacent②">+</a> or <span class="css">-</span> that separates the <var>An</var> and <var>B</var> parts when both are present.</p> <div class="example" id="example-e61d78e8"> <a class="self-link" href="#example-e61d78e8"></a> <p>Valid Examples with white space: </p> <pre>3n + 1 +3n - 2 -n+ 6 +6</pre> <p>Invalid Examples with white space: </p> <pre>3 n + 2n + 2</pre> </div> <h3 class="heading settled" data-level="6.2" id="the-anb-type"><span class="secno">6.2. </span><span class="content"> The <code><an+b></code> type</span><a class="self-link" href="#the-anb-type"></a></h3> <p>The <var>An+B</var> notation was originally defined using a slightly different tokenizer than the rest of CSS, resulting in a somewhat odd definition when expressed in terms of CSS tokens. This section describes how to recognize the <var>An+B</var> notation in terms of CSS tokens (thus defining the <var><an+b></var> type for CSS grammar purposes), and how to interpret the CSS tokens to obtain values for <var>A</var> and <var>B</var>.</p> <p>The <var><an+b></var> type is defined (using the <a href="https://www.w3.org/TR/css3-values/#value-defs">Value Definition Syntax in the Values & Units spec</a>) as:</p> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="anb-production"><an<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus">+</a>b></dfn> = odd <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one">|</a> even <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> <var><integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②">|</a> <var><n-dimension></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③">|</a> '+'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt">?</a><sup><a href="#anb-plus">†</a></sup> n <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> -n <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑤">|</a> <var><ndashdigit-dimension></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> '+'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt①">?</a><sup><a href="#anb-plus">†</a></sup> <var><ndashdigit-ident></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑦">|</a> <var><dashndashdigit-ident></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑧">|</a> <var><n-dimension></var> <var><signed-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑨">|</a> '+'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt②">?</a><sup><a href="#anb-plus">†</a></sup> n <var><signed-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⓪">|</a> -n <var><signed-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①①">|</a> <var><ndash-dimension></var> <var><signless-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①②">|</a> '+'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt③">?</a><sup><a href="#anb-plus">†</a></sup> n- <var><signless-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①③">|</a> -n- <var><signless-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①④">|</a> <var><n-dimension></var> ['+' <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑤">|</a> '-'] <var><signless-integer></var> '+'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt④">?</a><sup><a href="#anb-plus">†</a></sup> n ['+' <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑥">|</a> '-'] <var><signless-integer></var> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑦">|</a> -n ['+' <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑧">|</a> '-'] <var><signless-integer></var> </pre> <p>where:</p> <ul> <li><dfn class="css" data-dfn-type="type" data-export id="typedef-n-dimension"><code><n-dimension></code><a class="self-link" href="#typedef-n-dimension"></a></dfn> is a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token⑨"><dimension-token></a> with its type flag set to "integer", and a unit that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive②">ASCII case-insensitive</a> match for "n" <li><dfn class="css" data-dfn-type="type" data-export id="typedef-ndash-dimension"><code><ndash-dimension></code><a class="self-link" href="#typedef-ndash-dimension"></a></dfn> is a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①⓪"><dimension-token></a> with its type flag set to "integer", and a unit that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive③">ASCII case-insensitive</a> match for "n-" <li><dfn class="css" data-dfn-type="type" data-export id="typedef-ndashdigit-dimension"><code><ndashdigit-dimension></code><a class="self-link" href="#typedef-ndashdigit-dimension"></a></dfn> is a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①①"><dimension-token></a> with its type flag set to "integer", and a unit that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive④">ASCII case-insensitive</a> match for "n-*", where "*" is a series of one or more <a data-link-type="dfn" href="#digit" id="ref-for-digit①⑤">digits</a> <li><dfn class="css" data-dfn-type="type" data-export id="typedef-ndashdigit-ident"><code><ndashdigit-ident></code><a class="self-link" href="#typedef-ndashdigit-ident"></a></dfn> is an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①①"><ident-token></a> whose value is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑤">ASCII case-insensitive</a> match for "n-*", where "*" is a series of one or more <a data-link-type="dfn" href="#digit" id="ref-for-digit①⑥">digits</a> <li><dfn class="css" data-dfn-type="type" data-export id="typedef-dashndashdigit-ident"><code><dashndashdigit-ident></code><a class="self-link" href="#typedef-dashndashdigit-ident"></a></dfn> is an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①②"><ident-token></a> whose value is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑥">ASCII case-insensitive</a> match for "-n-*", where "*" is a series of one or more <a data-link-type="dfn" href="#digit" id="ref-for-digit①⑦">digits</a> <li><dfn class="css" data-dfn-type="type" data-export id="typedef-integer"><code><integer></code><a class="self-link" href="#typedef-integer"></a></dfn> is a <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token⑤"><number-token></a> with its type flag set to "integer" <li><dfn class="css" data-dfn-type="type" data-export id="typedef-signed-integer"><code><signed-integer></code><a class="self-link" href="#typedef-signed-integer"></a></dfn> is a <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token⑥"><number-token></a> with its type flag set to "integer", and whose <a data-link-type="dfn" href="#representation" id="ref-for-representation③">representation</a> starts with "+" or "-" <li><dfn class="css" data-dfn-type="type" data-export id="typedef-signless-integer"><code><signless-integer></code><a class="self-link" href="#typedef-signless-integer"></a></dfn> is a <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token⑦"><number-token></a> with its type flag set to "integer", and whose <a data-link-type="dfn" href="#representation" id="ref-for-representation④">representation</a> starts with a <a data-link-type="dfn" href="#digit" id="ref-for-digit①⑧">digit</a> </ul> <p id="anb-plus"> <sup>†</sup>: When a plus sign (+) precedes an ident starting with "n", as in the cases marked above, there must be no whitespace between the two tokens, or else the tokens do not match the above grammar. Whitespace is valid (and ignored) between any other two tokens. </p> <p>The clauses of the production are interpreted as follows:</p> <dl> <dt><span class="css">odd</span> <dd> <var>A</var> is 2, <var>B</var> is 1. <dt><span class="css">even</span> <dd> <var>A</var> is 2, <var>B</var> is 0. <dt><code><var><integer></var></code> <dd> <var>A</var> is 0, <var>B</var> is the integer’s value. <dt><code><var><n-dimension></var></code> <dt><code>'+'? n</code> <dt><code>-n</code> <dd> <var>A</var> is the dimension’s value, 1, or -1, respectively. <var>B</var> is 0. <dt><code><var><ndashdigit-dimension></var></code> <dt><code>'+'? <var><ndashdigit-ident></var></code> <dd> <var>A</var> is the dimension’s value or 1, respectively. <var>B</var> is the dimension’s unit or ident’s value, respectively, with the first <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦⑥">code point</a> removed and the remainder interpreted as a base-10 number. <span class="note">B is negative.</span> <dt><code><var><dashndashdigit-ident></var></code> <dd> <var>A</var> is -1. <var>B</var> is the ident’s value, with the first two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦⑦">code points</a> removed and the remainder interpreted as a base-10 number. <span class="note">B is negative.</span> <dt><code><var><n-dimension></var> <var><signed-integer></var></code> <dt><code>'+'? n <var><signed-integer></var></code> <dt><code>-n <var><signed-integer></var></code> <dd> <var>A</var> is the dimension’s value, 1, or -1, respectively. <var>B</var> is the integer’s value. <dt><code><var><ndash-dimension></var> <var><signless-integer></var></code> <dt><code>'+'? n- <var><signless-integer></var></code> <dt><code>-n- <var><signless-integer></var></code> <dd> <var>A</var> is the dimension’s value, 1, or -1, respectively. <var>B</var> is the negation of the integer’s value. <dt><code><var><n-dimension></var> ['+' | '-'] <var><signless-integer></var></code> <dt><code>'+'? n ['+' | '-'] <var><signless-integer></var></code> <dt><code>-n ['+' | '-'] <var><signless-integer></var></code> <dd> <var>A</var> is the dimension’s value, 1, or -1, respectively. <var>B</var> is the integer’s value. If a <code>'-'</code> was provided between the two, <var>B</var> is instead the negation of the integer’s value. </dl> <h2 class="heading settled" data-level="7" id="urange"><span class="secno">7. </span><span class="content"> The Unicode-Range microsyntax</span><a class="self-link" href="#urange"></a></h2> <p>Some constructs, <span class="informative">such as the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-fonts-4/#descdef-font-face-unicode-range" id="ref-for-descdef-font-face-unicode-range">unicode-range</a> descriptor for the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-fonts-5/#at-font-face-rule" id="ref-for-at-font-face-rule">@font-face</a> rule,</span> need a way to describe one or more unicode code points. The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-urange"><urange></dfn> production represents a range of one or more unicode code points.</p> <p>Informally, the <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①"><urange></a> production has three forms:</p> <dl> <dt>U+0001 <dd> Defines a range consisting of a single code point, in this case the code point "1". <dt>U+0001-00ff <dd> Defines a range of codepoints between the first and the second value inclusive, in this case the range between "1" and "ff" (255 in decimal) inclusive. <dt>U+00?? <dd> Defines a range of codepoints where the "?" characters range over all <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit⑤">hex digits</a>, in this case defining the same as the value <span class="css">U+0000-00ff</span>. </dl> <p>In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).</p> <h3 class="heading settled" data-level="7.1" id="urange-syntax"><span class="secno">7.1. </span><span class="content"> The <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange②"><urange></a> type</span><a class="self-link" href="#urange-syntax"></a></h3> <p>The <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange③"><urange></a> notation was originally defined as a primitive token in CSS, but it is used very rarely, and collides with legitimate <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①③"><ident-token></a>s in confusing ways. This section describes how to recognize the <span class="production" id="ref-for-typedef-urange④"><urange></span> notation in terms of existing CSS tokens, and how to interpret it as a range of unicode codepoints.</p> <details class="note"> <summary>What are the confusing collisions?</summary> <p>For example, in the CSS <span style=";white-space:nowrap"><span class="css">u + a { color: green; }</span></span>, the intended meaning is that an <code>a</code> element following a <code>u</code> element should be colored green. Whitespace is not normally required between combinators and the surrounding selectors, so it <em>should</em> be equivalent to minify it to</p> <span style=";white-space:nowrap"><span class="css">u+a{color:green;}</span></span>. <p>With any other combinator, the two pieces of CSS would be equivalent, but due to the previous existence of a specialized unicode-range token, the selector portion of the minified code now contains a unicode-range, not two idents and a combinator. It thus fails to match the Selectors grammar, and the rule is thrown out as invalid.</p> <p>(This example is taken from a real-world bug reported to Firefox.)</p> </details> <p class="note" role="note"><span>Note:</span> The syntax described here is intentionally very low-level, and geared toward implementors. Authors should instead read the informal syntax description in the previous section, as it contains all information necessary to use <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange⑤"><urange></a>, and is actually readable.</p> <p>The <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange⑥"><urange></a> type is defined (using the <a href="https://www.w3.org/TR/css3-values/#value-defs">Value Definition Syntax in the Values & Units spec</a>) as:</p> <pre class="prod"><a class="production" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange⑦"><urange></a> = u '+' <a class="production" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①④"><ident-token></a> '?'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus">*</a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑨">|</a> u <a class="production" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①②"><dimension-token></a> '?'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus①">*</a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⓪">|</a> u <a class="production" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token⑧"><number-token></a> '?'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-zero-plus" id="ref-for-mult-zero-plus②">*</a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②①">|</a> u <a class="production" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token⑨"><number-token></a> <a class="production" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①③"><dimension-token></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②②">|</a> u <a class="production" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token①⓪"><number-token></a> <a class="production" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token①①"><number-token></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②③">|</a> u '+' '?'<a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus①">+</a> </pre> <p>In this production, no whitespace can occur between any of the tokens.</p> <p>The <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange⑧"><urange></a> production represents a range of one or more contiguous unicode code points as a <var>start value</var> and an <var>end value</var>, which are non-negative integers. To interpret the production above into a range, execute the following steps in order:</p> <ol> <li data-md> <p>Skipping the first <span class="css">u</span> token, concatenate the <a data-link-type="dfn" href="#representation" id="ref-for-representation⑤">representations</a> of all the tokens in the production together. Let this be <var>text</var>.</p> <li data-md> <p>If the first character of <var>text</var> is U+002B PLUS SIGN, consume it. Otherwise, this is an invalid <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange⑨"><urange></a>, and this algorithm must exit.</p> <li data-md> <p>Consume as many <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit⑥">hex digits</a> from <var>text</var> as possible. then consume as many U+003F QUESTION MARK (?) <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑦⑧">code points</a> as possible. If zero <span id="ref-for-code-point⑦⑨">code points</span> were consumed, or more than six <span id="ref-for-code-point⑧⓪">code points</span> were consumed, this is an invalid <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①⓪"><urange></a>, and this algorithm must exit.</p> <p>If any U+003F QUESTION MARK (?) <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑧①">code points</a> were consumed, then:</p> <ol> <li data-md> <p>If there are any <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑧②">code points</a> left in <var>text</var>, this is an invalid <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①①"><urange></a>, and this algorithm must exit.</p> <li data-md> <p>Interpret the consumed <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑧③">code points</a> as a hexadecimal number, with the U+003F QUESTION MARK (?) <span id="ref-for-code-point⑧④">code points</span> replaced by U+0030 DIGIT ZERO (0) <span id="ref-for-code-point⑧⑤">code points</span>. This is the <var>start value</var>.</p> <li data-md> <p>Interpret the consumed <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑧⑥">code points</a> as a hexadecimal number again, with the U+003F QUESTION MARK (?) <span id="ref-for-code-point⑧⑦">code points</span> replaced by U+0046 LATIN CAPITAL LETTER F (F) <span id="ref-for-code-point⑧⑧">code points</span>. This is the <var>end value</var>.</p> <li data-md> <p>Exit this algorithm.</p> </ol> <p>Otherwise, interpret the consumed <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑧⑨">code points</a> as a hexadecimal number. This is the <var>start value</var>.</p> <li data-md> <p>If there are no <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨⓪">code points</a> left in <var>text</var>, The <var>end value</var> is the same as the <var>start value</var>. Exit this algorithm.</p> <li data-md> <p>If the next <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨①">code point</a> in <var>text</var> is U+002D HYPHEN-MINUS (-), consume it. Otherwise, this is an invalid <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①②"><urange></a>, and this algorithm must exit.</p> <li data-md> <p>Consume as many <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit⑦">hex digits</a> as possible from <var>text</var>.</p> <p>If zero <a data-link-type="dfn" href="#hex-digit" id="ref-for-hex-digit⑧">hex digits</a> were consumed, or more than 6 <span id="ref-for-hex-digit⑨">hex digits</span> were consumed, this is an invalid <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①③"><urange></a>, and this algorithm must exit. If there are any <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨②">code points</a> left in <var>text</var>, this is an invalid <span class="production" id="ref-for-typedef-urange①④"><urange></span>, and this algorithm must exit.</p> <li data-md> <p>Interpret the consumed <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨③">code points</a> as a hexadecimal number. This is the <var>end value</var>.</p> </ol> <p>To determine what codepoints the <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①⑤"><urange></a> represents:</p> <ol> <li data-md> <p>If <var>end value</var> is greater than the <a data-link-type="dfn" href="#maximum-allowed-code-point" id="ref-for-maximum-allowed-code-point①">maximum allowed code point</a>, the <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①⑥"><urange></a> is invalid and a syntax error.</p> <li data-md> <p>If <var>start value</var> is greater than <var>end value</var>, the <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①⑦"><urange></a> is invalid and a syntax error.</p> <li data-md> <p>Otherwise, the <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①⑧"><urange></a> represents a contiguous range of codepoints from <var>start value</var> to <var>end value</var>, inclusive.</p> </ol> <p class="note" role="note"><span>Note:</span> The syntax of <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange①⑨"><urange></a> is intentionally fairly wide; its patterns capture every possible token sequence that the informal syntax can generate. However, it requires no whitespace between its constituent tokens, which renders it fairly safe to use in practice. Even grammars which have a <span class="production" id="ref-for-typedef-urange②⓪"><urange></span> followed by a <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#number-value" id="ref-for-number-value"><number></a> or <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-dimension" id="ref-for-typedef-dimension"><dimension></a> (which might appear to be ambiguous if an author specifies the <span class="production" id="ref-for-typedef-urange②①"><urange></span> with the ''u <span class="production" id="ref-for-number-value①"><number></span>'' clause) are actually quite safe, as an author would have to intentionally separate the <span class="production" id="ref-for-typedef-urange②②"><urange></span> and the <span class="production" id="ref-for-number-value②"><number></span>/<span class="production" id="ref-for-typedef-dimension①"><dimension></span> with a comment rather than whitespace for it to be ambiguous. Thus, while it’s <em>possible</em> for authors to write things that are parsed in confusing ways, the actual code they’d have to write to cause the confusion is, itself, confusing and rare.</p> <h2 class="heading settled" data-level="8" id="rule-defs"><span class="secno">8. </span><span class="content"> Defining Grammars for Rules and Other Values</span><a class="self-link" href="#rule-defs"></a></h2> <p>The <a href="https://www.w3.org/TR/css3-values/">Values</a> spec defines how to specify a grammar for properties. This section does the same, but for rules.</p> <p>Just like in property grammars, the notation <code><foo></code> refers to the "foo" grammar term, assumed to be defined elsewhere. Substituting the <code><foo></code> for its definition results in a semantically identical grammar.</p> <p>Several types of tokens are written literally, without quotes:</p> <ul> <li><a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①⑤"><ident-token></a>s (such as <code>auto</code>, <code>disc</code>, etc), which are simply written as their value. <li><a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token⑨"><at-keyword-token></a>s, which are written as an @ character followed by the token’s value, like <code>@media</code>. <li><a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token①⓪"><function-token></a>s, which are written as the function name followed by a ( character, like <code>translate(</code>. <li>The <a class="production css" data-link-type="type" href="#typedef-colon-token" id="ref-for-typedef-colon-token②"><colon-token></a> (written as <code>:</code>), <a class="production css" data-link-type="type" href="#typedef-comma-token" id="ref-for-typedef-comma-token④"><comma-token></a> (written as <code>,</code>), <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token⑨"><semicolon-token></a> (written as <code>;</code>), <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren⑤"><(-token></a>, <a href="#tokendef-close-paren" id="ref-for-tokendef-close-paren③"><)-token></a>, <a href="#tokendef-open-curly" id="ref-for-tokendef-open-curly①⓪"><{-token></a>, and <a href="#tokendef-close-curly" id="ref-for-tokendef-close-curly③"><}-token></a>s. </ul> <p>Tokens match if their value is a match for the value defined in the grammar. Unless otherwise specified, all matches are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑦">ASCII case-insensitive</a>.</p> <p class="note" role="note"><span>Note:</span> Although it is possible, with <a data-link-type="dfn" href="#escape-codepoint" id="ref-for-escape-codepoint①">escaping</a>, to construct an <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①⑥"><ident-token></a> whose value ends with <code>(</code> or starts with <code>@</code>, such a tokens is not a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token①①"><function-token></a> or an <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token①⓪"><at-keyword-token></a> and does not match corresponding grammar definitions.</p> <p><a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①①"><delim-token></a>s are written with their value enclosed in single quotes. For example, a <span class="production" id="ref-for-typedef-delim-token①②"><delim-token></span> containing the "+" <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨④">code point</a> is written as <code>'+'</code>. Similarly, the <a href="#tokendef-open-square" id="ref-for-tokendef-open-square⑥"><[-token></a> and <a href="#tokendef-close-square" id="ref-for-tokendef-close-square③"><]-token></a>s must be written in single quotes, as they’re used by the syntax of the grammar itself to group clauses. <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①⑤"><whitespace-token></a> is never indicated in the grammar; <span class="production" id="ref-for-typedef-whitespace-token①⑥"><whitespace-token></span>s are allowed before, after, and between any two tokens, unless explicitly specified otherwise in prose definitions. (For example, if the prelude of a rule is a selector, whitespace is significant.)</p> <p>When defining a function or a block, the ending token must be specified in the grammar, but if it’s not present in the eventual token stream, it still matches.</p> <div class="example" id="example-84a0b91f"> <a class="self-link" href="#example-84a0b91f"></a> For example, the syntax of the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-transforms-1/#funcdef-transform-translatex" id="ref-for-funcdef-transform-translatex">translateX()</a> function is: <pre>translateX( <a class="production" data-link-type="type"><translation-value></a> )</pre> <p>However, the stylesheet may end with the function unclosed, like:</p> <pre>.foo { transform: translate(50px</pre> <p>The CSS parser parses this as a style rule containing one declaration, whose value is a function named "translate". This matches the above grammar, even though the ending token didn’t appear in the token stream, because by the time the parser is finished, the presence of the ending token is no longer possible to determine; all you have is the fact that there’s a block and a function.</p> </div> <h3 class="heading settled" data-level="8.1" id="declaration-rule-list"><span class="secno">8.1. </span><span class="content"> Defining Block Contents: the <a class="production css" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list①"><declaration-list></a>, <a class="production css" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list①"><rule-list></a>, and <a class="production css" data-link-type="type" href="#typedef-stylesheet" id="ref-for-typedef-stylesheet①"><stylesheet></a> productions</span><a class="self-link" href="#declaration-rule-list"></a></h3> <p>The CSS parser is agnostic as to the contents of blocks, such as those that come at the end of some at-rules. Defining the generic grammar of the blocks in terms of tokens is non-trivial, but there are dedicated and unambiguous algorithms defined for parsing this.</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-style-block"><style-block></dfn> production represents the contents of a <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule⑤">style rule’s</a> block. It may only be used in grammars as the sole value in a block, and represents that the contents of the block must be parsed using the <a data-link-type="dfn" href="#consume-a-style-blocks-contents" id="ref-for-consume-a-style-blocks-contents①">consume a style block’s contents</a> algorithm.</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-declaration-list"><declaration-list></dfn> production represents a list of declarations. It may only be used in grammars as the sole value in a block, and represents that the contents of the block must be parsed using the <a data-link-type="dfn" href="#consume-a-list-of-declarations" id="ref-for-consume-a-list-of-declarations②">consume a list of declarations</a> algorithm.</p> <p>Similarly, the <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-rule-list"><rule-list></dfn> production represents a list of rules, and may only be used in grammars as the sole value in a block. It represents that the contents of the block must be parsed using the <a data-link-type="dfn" href="#consume-a-list-of-rules" id="ref-for-consume-a-list-of-rules③">consume a list of rules</a> algorithm.</p> <p>Finally, the <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-stylesheet"><stylesheet></dfn> production represents a list of rules. It is identical to <a class="production css" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list②"><rule-list></a>, except that blocks using it default to accepting all rules that aren’t otherwise limited to a particular context.</p> <div class="note" role="note"> All four of these productions are pretty similar to each other, so this table summarizes what they accept and lists some example instances of each: <table class="data"> <thead> <tr> <td> <th>Allows <a data-link-type="dfn" href="#declaration" id="ref-for-declaration">declarations</a> <th>Allows <a data-link-type="dfn" href="https://www.w3.org/TR/css-nesting-1/#nested-style-rule" id="ref-for-nested-style-rule">nested style rules</a> <th>Allow arbitrary <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule⑤">qualified rules</a> <th>Allows <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①⑤">at-rules</a> <th>Examples <tbody> <tr> <th><a class="production css" data-link-type="type" href="#typedef-style-block" id="ref-for-typedef-style-block"><style-block></a> <td>✓ <td>✓ <td>✗ <td>✓ <td><a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule⑥">style rules</a>, <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-nesting-1/#at-ruledef-nest" id="ref-for-at-ruledef-nest">@nest</a>, <a data-link-type="dfn" href="https://www.w3.org/TR/css-nesting-1/#nested-conditional-group-rules" id="ref-for-nested-conditional-group-rules">nested conditional group rules</a> <tr> <th><a class="production css" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list②"><declaration-list></a> <td>✓ <td>✗ <td>✗ <td>✓ <td><span class="css">@font</span>, <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-counter-styles-3/#at-ruledef-counter-style" id="ref-for-at-ruledef-counter-style">@counter-style</a>, <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-page-3/#at-ruledef-page" id="ref-for-at-ruledef-page③">@page</a>, <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes①">@keyframes</a> child rules <tr> <th><a class="production css" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list③"><rule-list></a> <td>✗ <td>✗ <td>✓ <td>✓ <td><a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes②">@keyframes</a>, <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-fonts-4/#at-ruledef-font-feature-values" id="ref-for-at-ruledef-font-feature-values">@font-feature-values</a> <tr> <th><a class="production css" data-link-type="type" href="#typedef-stylesheet" id="ref-for-typedef-stylesheet②"><stylesheet></a> <td>✗ <td>✗ <td>✓ <td>✓ <td>stylesheets, non-nested <a data-link-type="dfn" href="https://www.w3.org/TR/css3-conditional/#conditional-group-rule" id="ref-for-conditional-group-rule">conditional group rules</a> </table> <p>If a given context is <em>only</em> intended to accept <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①⑥">at-rules</a>, such as in <span class="css">@font-features-values</span>, it doesn’t actually matter which production is used, but <a class="production css" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list④"><rule-list></a> is preferred for its more straightforward name.</p> </div> <div class="example" id="example-c847c7cd"> <a class="self-link" href="#example-c847c7cd"></a> For example, the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-fonts-5/#at-font-face-rule" id="ref-for-at-font-face-rule①">@font-face</a> rule is defined to have an empty prelude, and to contain a list of declarations. This is expressed with the following grammar: <pre>@font-face { <a class="production" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list③"><declaration-list></a> }</pre> <p>This is a complete and sufficient definition of the rule’s grammar.</p> <p>For another example, <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes③">@keyframes</a> rules are more complex, interpreting their prelude as a name and containing keyframes rules in their block Their grammar is:</p> <pre>@keyframes <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-animations-1/#typedef-keyframes-name" id="ref-for-typedef-keyframes-name"><keyframes-name></a> { <a class="production" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list⑤"><rule-list></a> }</pre> </div> <p>For rules that use <a class="production css" data-link-type="type" href="#typedef-style-block" id="ref-for-typedef-style-block①"><style-block></a> or <a class="production css" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list④"><declaration-list></a>, the spec for the rule must define which properties, descriptors, and/or at-rules are valid inside the rule; this may be as simple as saying "The @foo rule accepts the properties/descriptors defined in this specification/section.", and extension specs may simply say "The @foo rule additionally accepts the following properties/descriptors.". Any declarations or at-rules found inside the block that are not defined as valid must be removed from the rule’s value.</p> <p>Within a <a class="production css" data-link-type="type" href="#typedef-style-block" id="ref-for-typedef-style-block②"><style-block></a> or <a class="production css" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list⑤"><declaration-list></a>, <code>!important</code> is automatically invalid on any descriptors. If the rule accepts properties, the spec for the rule must define whether the properties interact with the cascade, and with what specificity. If they don’t interact with the cascade, properties containing <code>!important</code> are automatically invalid; otherwise using <code>!important</code> is valid and causes the declaration to be <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-6/#important" id="ref-for-important">important</a> for the purposes of the <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-6/#cascade" id="ref-for-cascade">cascade</a>. See <a data-link-type="biblio" href="#biblio-css-cascade-3">[CSS-CASCADE-3]</a>.</p> <div class="example" id="example-69a4f873"><a class="self-link" href="#example-69a4f873"></a> For example, the grammar for <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-fonts-5/#at-font-face-rule" id="ref-for-at-font-face-rule②">@font-face</a> in the previous example must, in addition to what is written there, define that the allowed declarations are the descriptors defined in the Fonts spec. </div> <p>For rules that use <a class="production css" data-link-type="type" href="#typedef-rule-list" id="ref-for-typedef-rule-list⑥"><rule-list></a>, the spec for the rule must define what types of rules are valid inside the rule, same as <a class="production css" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list⑥"><declaration-list></a>, and unrecognized rules must similarly be removed from the rule’s value.</p> <div class="example" id="example-9f2a94f9"> <a class="self-link" href="#example-9f2a94f9"></a> For example, the grammar for <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes④">@keyframes</a> in the previous example must, in addition to what is written there, define that the only allowed rules are <a class="production css" data-link-type="type"><keyframe-rule></a>s, which are defined as: <pre><a class="production" data-link-type="type"><keyframe-rule></a> = <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-animations-1/#typedef-keyframe-selector" id="ref-for-typedef-keyframe-selector"><keyframe-selector></a> { <a class="production" data-link-type="type" href="#typedef-declaration-list" id="ref-for-typedef-declaration-list⑦"><declaration-list></a> }</pre> <p>Keyframe rules, then, must further define that they accept as declarations all animatable CSS properties, plus the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css-animations-1/#propdef-animation-timing-function" id="ref-for-propdef-animation-timing-function">animation-timing-function</a> property, but that they do not interact with the cascade.</p> </div> <p>For rules that use <a class="production css" data-link-type="type" href="#typedef-stylesheet" id="ref-for-typedef-stylesheet③"><stylesheet></a>, all rules are allowed by default, but the spec for the rule may define what types of rules are <em>invalid</em> inside the rule.</p> <div class="example" id="example-27685560"> <a class="self-link" href="#example-27685560"></a> For example, the <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-conditional/#at-ruledef-media" id="ref-for-at-ruledef-media③">@media</a> rule accepts anything that can be placed in a stylesheet, except more <span class="css" id="ref-for-at-ruledef-media④">@media</span> rules. As such, its grammar is: <pre>@media <a class="production" data-link-type="type" href="https://www.w3.org/TR/mediaqueries-5/#typedef-media-query-list" id="ref-for-typedef-media-query-list"><media-query-list></a> { <a class="production" data-link-type="type" href="#typedef-stylesheet" id="ref-for-typedef-stylesheet④"><stylesheet></a> }</pre> <p>It additionally defines a restriction that the <a class="production css" data-link-type="type" href="#typedef-stylesheet" id="ref-for-typedef-stylesheet⑤"><stylesheet></a> can not contain <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-conditional/#at-ruledef-media" id="ref-for-at-ruledef-media⑤">@media</a> rules, which causes them to be dropped from the outer rule’s value if they appear.</p> </div> <h3 class="heading settled" data-level="8.2" id="any-value"><span class="secno">8.2. </span><span class="content"> Defining Arbitrary Contents: the <a class="production css" data-link-type="type" href="#typedef-declaration-value" id="ref-for-typedef-declaration-value"><declaration-value></a> and <a class="production css" data-link-type="type" href="#typedef-any-value" id="ref-for-typedef-any-value"><any-value></a> productions</span><a class="self-link" href="#any-value"></a></h3> <p>In some grammars, it is useful to accept any reasonable input in the grammar, and do more specific error-handling on the contents manually (rather than simply invalidating the construct, as grammar mismatches tend to do).</p> <p><span class="informative">For example, <a data-link-type="dfn" href="https://www.w3.org/TR/css-variables-1/#custom-property" id="ref-for-custom-property">custom properties</a> allow any reasonable value, as they can contain arbitrary pieces of other CSS properties, or be used for things that aren’t part of existing CSS at all. For another example, the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/mediaqueries-5/#typedef-general-enclosed" id="ref-for-typedef-general-enclosed"><general-enclosed></a> production in Media Queries defines the bounds of what future syntax MQs will allow, and uses special logic to deal with "unknown" values.</span></p> <p>To aid in this, two additional productions are defined:</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-declaration-value"><declaration-value></dfn> production matches <em>any</em> sequence of one or more tokens, so long as the sequence does not contain <a class="production css" data-link-type="type" href="#typedef-bad-string-token" id="ref-for-typedef-bad-string-token③"><bad-string-token></a>, <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token⑧"><bad-url-token></a>, unmatched <a class="production css" data-link-type="type" href="#tokendef-close-paren" id="ref-for-tokendef-close-paren④"><)-token></a>, <a class="production css" data-link-type="type" href="#tokendef-close-square" id="ref-for-tokendef-close-square④"><]-token></a>, or <a class="production css" data-link-type="type" href="#tokendef-close-curly" id="ref-for-tokendef-close-curly④"><}-token></a>, or top-level <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token①⓪"><semicolon-token></a> tokens or <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①③"><delim-token></a> tokens with a value of "!". It represents the entirety of what a valid declaration can have as its value.</p> <p>The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-any-value"><any-value></dfn> production is identical to <a class="production css" data-link-type="type" href="#typedef-declaration-value" id="ref-for-typedef-declaration-value①"><declaration-value></a>, but also allows top-level <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token①①"><semicolon-token></a> tokens and <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①④"><delim-token></a> tokens with a value of "!". It represents the entirety of what valid CSS can be in any context.</p> <h2 class="heading settled" data-level="9" id="css-stylesheets"><span class="secno">9. </span><span class="content"> CSS stylesheets</span><a class="self-link" href="#css-stylesheets"></a></h2> <p>To <dfn data-dfn-type="dfn" data-export id="parse-a-css-stylesheet">parse a CSS stylesheet<a class="self-link" href="#parse-a-css-stylesheet"></a></dfn>, first <a data-link-type="dfn" href="#parse-a-stylesheet" id="ref-for-parse-a-stylesheet②">parse a stylesheet</a>. Interpret all of the resulting top-level <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule⑥">qualified rules</a> as <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule⑦">style rules</a>, defined below.</p> <p>If any style rule is <a data-link-type="dfn" href="#css-invalid" id="ref-for-css-invalid">invalid</a>, or any at-rule is not recognized or is invalid according to its grammar or context, it’s a <a data-link-type="dfn" href="#parse-error" id="ref-for-parse-error①⑥">parse error</a>. Discard that rule.</p> <h3 class="heading settled" data-level="9.1" id="style-rules"><span class="secno">9.1. </span><span class="content"> Style rules</span><a class="self-link" href="#style-rules"></a></h3> <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="style-rule">style rule</dfn> is a <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule⑦">qualified rule</a> that associates a <a data-link-type="dfn" href="https://www.w3.org/TR/selectors-4/#selector-list" id="ref-for-selector-list">selector list</a> with a list of property declarations and possibly a list of nested rules. They are also called <a href="https://www.w3.org/TR/CSS2/syndata.html#rule-sets">rule sets</a> in <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>. CSS Cascading and Inheritance <a data-link-type="biblio" href="#biblio-css-cascade-3">[CSS-CASCADE-3]</a> defines how the declarations inside of style rules participate in the cascade.</p> <p>The prelude of the qualified rule is <a data-link-type="dfn" href="#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar④">parsed</a> as a <a class="production css" data-link-type="type" href="https://www.w3.org/TR/selectors-4/#typedef-selector-list" id="ref-for-typedef-selector-list"><selector-list></a>. If this returns failure, the entire style rule is <a data-link-type="dfn" href="#css-invalid" id="ref-for-css-invalid①">invalid</a>.</p> <p>The content of the qualified rule’s block is parsed as a <a data-link-type="dfn" href="#parse-a-style-blocks-contents" id="ref-for-parse-a-style-blocks-contents①">style block’s contents</a>. Unless defined otherwise by another specification or a future level of this specification, at-rules in that list are <a data-link-type="dfn" href="#css-invalid" id="ref-for-css-invalid②">invalid</a> and must be ignored.</p> <p class="note" role="note"><span>Note:</span> <a data-link-type="biblio" href="#biblio-css-nesting-1">[CSS-NESTING-1]</a> defines that <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-nesting-1/#at-ruledef-nest" id="ref-for-at-ruledef-nest①">@nest</a> and <a data-link-type="dfn" href="https://www.w3.org/TR/css3-conditional/#conditional-group-rule" id="ref-for-conditional-group-rule①">conditional group rules</a> are allowed inside of <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule⑧">style rules</a>.</p> <p>Declarations for an unknown CSS property or whose value does not match the syntax defined by the property are <a data-link-type="dfn" href="#css-invalid" id="ref-for-css-invalid③">invalid</a> and must be ignored. The validity of the style rule’s contents have no effect on the validity of the style rule itself. Unless otherwise specified, property names are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑧">ASCII case-insensitive</a>.</p> <p class="note" role="note"><span>Note:</span> The names of Custom Properties <a data-link-type="biblio" href="#biblio-css-variables">[CSS-VARIABLES]</a> are case-sensitive.</p> <p><a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule⑧">Qualified rules</a> at the top-level of a CSS stylesheet are <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule⑨">style rules</a>. Qualified rules in other contexts may or may not be style rules, as defined by the context.</p> <p class="example" id="example-4acffe04"><a class="self-link" href="#example-4acffe04"></a> For example, qualified rules inside <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-conditional/#at-ruledef-media" id="ref-for-at-ruledef-media⑥">@media</a> rules <a data-link-type="biblio" href="#biblio-css3-conditional">[CSS3-CONDITIONAL]</a> are style rules, but qualified rules inside <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes" id="ref-for-at-ruledef-keyframes⑤">@keyframes</a> rules <a data-link-type="biblio" href="#biblio-css3-animations">[CSS3-ANIMATIONS]</a> are not. </p> <h3 class="heading settled" data-level="9.2" id="at-rules"><span class="secno">9.2. </span><span class="content"> At-rules</span><a class="self-link" href="#at-rules"></a></h3> <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="at-rule">at-rule</dfn> is a rule that begins with an at-keyword, and can thus be distinguished from <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule①⓪">style rules</a> in the same context.</p> <p><a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①⑦">At-rules</a> are used to:</p> <ul> <li data-md> <p>group and structure style rules and other at-rules such as in <a data-link-type="dfn" href="https://www.w3.org/TR/css3-conditional/#conditional-group-rule" id="ref-for-conditional-group-rule②">conditional group rules</a></p> <li data-md> <p>declare style information that is not associated with a particular element, such as defining <a data-link-type="dfn" href="https://www.w3.org/TR/css-counter-styles-3/#counter-style" id="ref-for-counter-style">counter styles</a></p> <li data-md> <p>manage syntactic constructs such as <a href="https://www.w3.org/TR/css-cascade-3/#at-import">imports</a> and <a data-link-type="biblio" href="#biblio-css-namespaces-3">namespaces</a> keyword mappings</p> <li data-md> <p>and serve other miscellaneous purposes not served by a <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule①①">style rule</a></p> </ul> <p>At-rules take many forms, depending on the specific rule and its purpose, but broadly speaking there are two kinds: <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="statement at-rule" id="statement-at-rule">statement at-rules</dfn> which are simpler constructs that end in a semicolon, and <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="block at-rule" id="block-at-rule">block at-rules</dfn> which end in a <a data-link-type="dfn" href="#curly-block" id="ref-for-curly-block①">{}-block</a> that can contain nested <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule⑨">qualified rules</a>, <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①⑧">at-rules</a>, or <a data-link-type="dfn" href="#declaration" id="ref-for-declaration①">declarations</a>.</p> <p><a data-link-type="dfn" href="#block-at-rule" id="ref-for-block-at-rule">Block at-rules</a> will typically contain a collection of (generic or <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule①⑨">at-rule</a>–specific) <span id="ref-for-at-rule②⓪">at-rules</span>, <a data-link-type="dfn" href="#qualified-rule" id="ref-for-qualified-rule①⓪">qualified rules</a>, and/or <a data-link-type="dfn" href="#css-descriptor-declarations" id="ref-for-css-descriptor-declarations">descriptor declarations</a> subject to limitations defined by the <span id="ref-for-at-rule②①">at-rule</span>. <dfn class="dfn-paneled" data-dfn-for="CSS" data-dfn-type="dfn" data-export data-lt="descriptor" id="css-descriptor">Descriptors</dfn> are similar to <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-5/#css-property" id="ref-for-css-property①">properties</a> (and are declared with the same syntax) but are associated with a particular type of <span id="ref-for-at-rule②②">at-rule</span> rather than with elements and boxes in the tree.</p> <h3 class="heading settled" data-level="9.3" id="charset-rule"><span class="secno">9.3. </span><span class="content"> The <a class="css" data-link-type="maybe" href="#at-ruledef-charset" id="ref-for-at-ruledef-charset②">@charset</a> Rule</span><a class="self-link" href="#charset-rule"></a></h3> <p>The algorithm used to <a data-link-type="dfn" href="#determine-the-fallback-encoding" id="ref-for-determine-the-fallback-encoding①">determine the fallback encoding</a> for a stylesheet looks for a specific byte sequence as the very first few bytes in the file, which has the syntactic form of an <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule②③">at-rule</a> named "@charset".</p> <p>However, there is no actual <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule②④">at-rule</a> named <dfn class="dfn-paneled css" data-dfn-type="at-rule" data-export id="at-ruledef-charset">@charset</dfn>. When a stylesheet is actually parsed, any occurrences of an <a class="css" data-link-type="maybe" href="#at-ruledef-charset" id="ref-for-at-ruledef-charset③">@charset</a> rule must be treated as an unrecognized rule, and thus dropped as invalid when the stylesheet is grammar-checked.</p> <p class="note" role="note"><span>Note:</span> In CSS 2.1, <a class="css" data-link-type="maybe" href="#at-ruledef-charset" id="ref-for-at-ruledef-charset④">@charset</a> was a valid rule. Some legacy specs may still refer to a <span class="css" id="ref-for-at-ruledef-charset⑤">@charset</span> rule, and explicitly talk about its presence in the stylesheet.</p> <h2 class="heading settled" data-level="10" id="serialization"><span class="secno">10. </span><span class="content"> Serialization</span><a class="self-link" href="#serialization"></a></h2> <p>The tokenizer described in this specification does not produce tokens for comments, or otherwise preserve them in any way. Implementations may preserve the contents of comments and their location in the token stream. If they do, this preserved information must have no effect on the parsing step.</p> <p>This specification does not define how to serialize CSS in general, leaving that task to the <a data-link-type="biblio" href="#biblio-cssom">[CSSOM]</a> and individual feature specifications. In particular, the serialization of comments and whitespace is not defined.</p> <p>The only requirement for serialization is that it must "round-trip" with parsing, that is, parsing the stylesheet must produce the same data structures as parsing, serializing, and parsing again, except for consecutive <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①⑦"><whitespace-token></a>s, which may be collapsed into a single token.</p> <p class="note" role="note"><span>Note:</span> This exception can exist because CSS grammars always interpret any amount of whitespace as identical to a single space.</p> <div class="note" id="serialization-tables" role="note"> <a class="self-link" href="#serialization-tables"></a> To satisfy this requirement: <ul> <li> A <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①⑤"><delim-token></a> containing U+005C REVERSE SOLIDUS (\) must be serialized as U+005C REVERSE SOLIDUS followed by a <a data-link-type="dfn" href="#newline" id="ref-for-newline④">newline</a>. (The tokenizer only ever emits such a token followed by a <a class="production css" data-link-type="type" href="#typedef-whitespace-token" id="ref-for-typedef-whitespace-token①⑧"><whitespace-token></a> that starts with a newline.) <li> A <a class="production css" data-link-type="type" href="#typedef-hash-token" id="ref-for-typedef-hash-token⑦"><hash-token></a> with the "unrestricted" type flag may not need as much escaping as the same token with the "id" type flag. <li> The unit of a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①④"><dimension-token></a> may need escaping to disambiguate with scientific notation. <li> For any consecutive pair of tokens, if the first token shows up in the row headings of the following table, and the second token shows up in the column headings, and there’s a ✗ in the cell denoted by the intersection of the chosen row and column, the pair of tokens must be serialized with a comment between them. <p>If the tokenizer preserves comments, the preserved comment should be used; otherwise, an empty comment (<code>/**/</code>) must be inserted. (Preserved comments may be reinserted even if the following tables don’t require a comment between two tokens.)</p> <p>Single characters in the row and column headings represent a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①⑥"><delim-token></a> with that value, except for "<code>(</code>", which represents a <a href="#tokendef-open-paren" id="ref-for-tokendef-open-paren⑥">(-token</a>.</p> </ul> <table class="data"> <tbody> <tr> <td> <th>ident <th>function <th>url <th>bad url <th>- <th>number <th>percentage <th>dimension <th>CDC <th>( <th>* <th>% <tr> <th>ident <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <tr> <th>at-keyword <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td> <tr> <th>hash <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td> <tr> <th>dimension <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td> <tr> <th># <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td> <tr> <th>- <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td> <tr> <th>number <td>✗ <td>✗ <td>✗ <td>✗ <td> <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td>✗ <tr> <th>@ <td>✗ <td>✗ <td>✗ <td>✗ <td>✗ <td> <td> <td> <td>✗ <td> <td> <td> <tr> <th>. <td> <td> <td> <td> <td> <td>✗ <td>✗ <td>✗ <td> <td> <td> <td> <tr> <th>+ <td> <td> <td> <td> <td> <td>✗ <td>✗ <td>✗ <td> <td> <td> <td> <tr> <th>/ <td> <td> <td> <td> <td> <td> <td> <td> <td> <td> <td>✗ <td> </table> </div> <h3 class="heading settled" data-level="10.1" id="serializing-anb"><span class="secno">10.1. </span><span class="content"> Serializing <var><an+b></var></span><a class="self-link" href="#serializing-anb"></a></h3> <div class="algorithm" data-algorithm="serialize an <an+b> value"> To <dfn data-dfn-type="dfn" data-export id="serialize-an-anb-value">serialize an <a class="production css" data-link-type="type" href="#anb-production" id="ref-for-anb-production"><an+b></a> value<a class="self-link" href="#serialize-an-anb-value"></a></dfn>, with integer values <var>A</var> and <var>B</var>: <ol> <li data-md> <p>If <var>A</var> is zero, return the serialization of <var>B</var>.</p> <li data-md> <p>Otherwise, let <var>result</var> initially be an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string①">string</a>.</p> <li data-md> <dl class="switch"> <dt data-md><var>A</var> is <code>1</code> <dd data-md> <p>Append "n" to <var>result</var>.</p> <dt data-md><var>A</var> is <code>-1</code> <dd data-md> <p>Append "-n" to <var>result</var>.</p> <dt data-md><var>A</var> is non-zero <dd data-md> <p>Serialize <var>A</var> and append it to <var>result</var>, then append "n" to <var>result</var>.</p> </dl> <li data-md> <dl class="switch"> <dt data-md><var>B</var> is greater than zero <dd data-md> <p>Append "+" to <var>result</var>, then append the serialization of <var>B</var> to <var>result</var>.</p> <dt data-md><var>B</var> is less than zero <dd data-md> <p>Append the serialization of <var>B</var> to <var>result</var>.</p> </dl> <li data-md> <p>Return <var>result</var>.</p> </ol> </div> <h2 class="heading settled" data-level="11" id="priv-sec"><span class="secno">11. </span><span class="content"> Privacy and Security Considerations</span><a class="self-link" href="#priv-sec"></a></h2> <p>This specification introduces no new privacy concerns.</p> <p>This specification improves security, in that CSS parsing is now unambiguously defined for all inputs.</p> <p>Insofar as old parsers, such as whitelists/filters, parse differently from this specification, they are somewhat insecure, but the previous parsing specification left a lot of ambiguous corner cases which browsers interpreted differently, so those filters were potentially insecure already, and this specification does not worsen the situation.</p> <h2 class="non-normative heading settled" data-level="12" id="changes"><span class="secno">12. </span><span class="content"> Changes</span><a class="self-link" href="#changes"></a></h2> <p><em>This section is non-normative.</em></p> <h3 class="heading settled" data-level="12.1" id="changes-CR-20190716"><span class="secno">12.1. </span><span class="content"> Changes from the 16 August 2019 Candidate Recommendation</span><a class="self-link" href="#changes-CR-20190716"></a></h3> <p>The following substantive changes were made:</p> <ul> <li data-md> <p>Added a new <a href="#parse-comma-list">§ 5.3.2 Parse A Comma-Separated List According To A CSS Grammar</a> algorithm.</p> <li data-md> <p>Added a new <a href="#parse-style-blocks-contents">§ 5.3.7 Parse a style block’s contents</a> algorithm and a corresponding <a class="production css" data-link-type="type" href="#typedef-style-block" id="ref-for-typedef-style-block③"><style-block></a> production, and defined that <a data-link-type="dfn" href="#style-rule" id="ref-for-style-rule①②">style rules</a> use it.</p> <li data-md> <p>Aligned <a data-link-type="dfn" href="#parse-a-stylesheet" id="ref-for-parse-a-stylesheet③">parse a stylesheet</a> with the Fetch-related shenanigans. (See <a href="https://github.com/w3c/csswg-drafts/commit/64becb59fe678760608a6f2a8d6bfb3a334500c9#diff-9d409f899ee6e2cc8cd87356d0e2a0ff739c5aa9663d83f49c951c379a38f1f6">commit</a>.)</p> <blockquote> <p> To <a data-link-type="dfn" href="#parse-a-stylesheet" id="ref-for-parse-a-stylesheet④">parse a stylesheet</a> from an <var>input</var> <ins>given an optional <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url①">url</a> <var>location</var></ins> : </p> <ol> <li>... <li> Create a new stylesheet <ins>, with its <a data-link-type="dfn" href="https://www.w3.org/TR/cssom-1/#concept-css-style-sheet-location" id="ref-for-concept-css-style-sheet-location①">location</a> set to <var>location</var> (or null, if <var>location</var> was not passed).</ins> <li>... </ol> </blockquote> </ul> <p>The following editorial changes were made:</p> <ul> <li data-md> <p>Added <a href="#at-rules">§ 9.2 At-rules</a> to provide definitions for <a data-link-type="dfn" href="#at-rule" id="ref-for-at-rule②⑤">at-rules</a>, <a data-link-type="dfn" href="#statement-at-rule" id="ref-for-statement-at-rule">statement at-rules</a>, <a data-link-type="dfn" href="#block-at-rule" id="ref-for-block-at-rule①">block at-rules</a>, and <a data-link-type="dfn" href="#css-descriptor" id="ref-for-css-descriptor①">descriptors</a>. (<a href="https://github.com/w3c/csswg-drafts/issues/5633">5633</a>)</p> <li data-md> <p>Improved the definition text for <a data-link-type="dfn" href="#declaration" id="ref-for-declaration②">declaration</a>, and added definitions for <a data-link-type="dfn" href="#css-property-declarations" id="ref-for-css-property-declarations">property declarations</a> and <a data-link-type="dfn" href="#css-descriptor-declarations" id="ref-for-css-descriptor-declarations①">descriptor declarations</a>.</p> <li data-md> <p>Switched to consistently refer to <a data-link-type="dfn" href="#ident-sequence" id="ref-for-ident-sequence⑤">ident sequence</a>, rather than sometimes using the term “name”.</p> <li data-md> <p>Explicitly named several of the pre-tokenizing processes, and explicitly referred to them in the parsing entry points (rather than relying on a blanket "do X at the start of these algorithms" statement).</p> <li data-md> <p>Added more entries to the "put a comment between them" table, to properly handle the fact that idents can now start with <code>--</code>. (<a href="https://github.com/w3c/csswg-drafts/pull/6874">6874</a>)</p> </ul> <h3 class="heading settled" data-level="12.2" id="changes-CR-20140220"><span class="secno">12.2. </span><span class="content"> Changes from the 20 February 2014 Candidate Recommendation</span><a class="self-link" href="#changes-CR-20140220"></a></h3> <p>The following substantive changes were made:</p> <ul> <li data-md> <p>Removed <a class="production css" data-link-type="type"><unicode-range-token></a>, in favor of creating a <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange②③"><urange></a> production.</p> <li data-md> <p>url() functions that contain a string are now parsed as normal <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token①②"><function-token></a>s. url() functions that contain "raw" URLs are still specially parsed as <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token①①"><url-token></a>s.</p> <li data-md> <p>Fixed a bug in the "Consume a URL token" algorithm, where it didn’t consume the quote character starting a string before attempting to consume the string.</p> <li data-md> <p>Fixed a bug in several of the parser algorithms related to the current/next input token and things getting consumed early/late.</p> <li data-md> <p>Fix several bugs in the tokenization and parsing algorithms.</p> <li data-md> <p>Change the definition of ident-like tokens to allow "--" to start an ident. As part of this, rearrange the ordering of the clauses in the "-" step of <a data-link-type="dfn" href="#consume-a-token" id="ref-for-consume-a-token③">consume a token</a> so that <a class="production css" data-link-type="type" href="#typedef-cdc-token" id="ref-for-typedef-cdc-token④"><CDC-token></a>s are recognized as such instead of becoming a <span class="css">--</span> <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①⑦"><ident-token></a>.</p> <li data-md> <p>Don’t serialize the digit in an <a class="production css" data-link-type="type" href="#anb-production" id="ref-for-anb-production①"><an+b></a> when A is 1 or -1.</p> <li data-md> <p>Define all tokens to have a <a data-link-type="dfn" href="#representation" id="ref-for-representation⑥">representation</a>.</p> <li data-md> <p>Fixed minor bug in <a data-link-type="dfn" href="#check-if-two-code-points-are-a-valid-escape" id="ref-for-check-if-two-code-points-are-a-valid-escape⑧">check if two code points are a valid escape</a>—<wbr>a <code>\</code> followed by an EOF is now correctly reported as <em>not</em> a valid escape. A final <code>\</code> in a stylesheet now just emits itself as a <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①⑦"><delim-token></a>.</p> <li data-md> <p>@charset is no longer a valid CSS rule (there’s just an encoding declaration that <em>looks</em> like a rule named @charset)</p> <li data-md> <p>Trimmed whitespace from the beginning/ending of a declaration’s value during parsing.</p> <li data-md> <p>Removed the Selectors-specific tokens, per WG resolution.</p> <li data-md> <p>Filtered <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate②">surrogates</a> from the input stream, per WG resolution. Now the entire specification operates only on <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#scalar-value" id="ref-for-scalar-value">scalar values</a>.</p> </ul> <p>The following editorial changes were made:</p> <ul> <li data-md> <p>The "Consume a string token" algorithm was changed to allow calling it without specifying an explicit ending token, so that it uses the current input token instead. The three call-sites of the algorithm were changed to use that form.</p> <li data-md> <p>Minor editorial restructuring of algorithms.</p> <li data-md> <p>Added the <a data-link-type="dfn" href="#css-parse-something-according-to-a-css-grammar" id="ref-for-css-parse-something-according-to-a-css-grammar⑤">parse</a> and <a data-link-type="dfn" href="#parse-a-comma-separated-list-of-component-values" id="ref-for-parse-a-comma-separated-list-of-component-values①">parse a comma-separated list of component values</a> API entry points.</p> <li data-md> <p>Added the <a class="production css" data-link-type="type" href="#typedef-declaration-value" id="ref-for-typedef-declaration-value②"><declaration-value></a> and <a class="production css" data-link-type="type" href="#typedef-any-value" id="ref-for-typedef-any-value①"><any-value></a> productions.</p> <li data-md> <p>Removed "code point" and "surrogate code point" in favor of the identical definitions in the Infra Standard.</p> <li data-md> <p>Clarified on every range that they are inclusive.</p> <li data-md> <p>Added a column to the comment-insertion table to handle a number token appearing next to a "%" delim token.</p> </ul> <p><a href="https://github.com/w3c/csswg-drafts/milestone/5?closed=1">A Disposition of Comments is available.</a></p> <h3 class="heading settled" data-level="12.3" id="changes-WD-20131105"><span class="secno">12.3. </span><span class="content"> Changes from the 5 November 2013 Last Call Working Draft</span><a class="self-link" href="#changes-WD-20131105"></a></h3> <ul> <li> The <a href="#serialization">Serialization</a> section has been rewritten to make only the "round-trip" requirement normative, and move the details of how to achieve it into a note. Some corner cases in these details have been fixed. <li> <a data-link-type="biblio" href="#biblio-encoding">[ENCODING]</a> has been added to the list of normative references. It was already referenced in normative text before, just not listed as such. <li> In the algorithm to <a data-link-type="dfn" href="#determine-the-fallback-encoding" id="ref-for-determine-the-fallback-encoding②">determine the fallback encoding</a> of a stylesheet, limit the <code>@charset</code> byte sequence to 1024 bytes. This aligns with what HTML does for <code><meta charset></code> and makes sure the size of the sequence is bounded. This only makes a difference with leading or trailing whitespace in the encoding label: <pre>@charset " <em>(lots of whitespace)</em> utf-8";</pre> </ul> <h3 class="heading settled" data-level="12.4" id="changes-WD-20130919"><span class="secno">12.4. </span><span class="content"> Changes from the 19 September 2013 Working Draft</span><a class="self-link" href="#changes-WD-20130919"></a></h3> <ul> <li> The concept of <a data-link-type="dfn" href="#environment-encoding" id="ref-for-environment-encoding③">environment encoding</a> was added. The behavior does not change, but some of the definitions should be moved to the relevant specs. </ul> <h3 class="heading settled" data-level="12.5" id="changes-css21"><span class="secno">12.5. </span><span class="content"> Changes from CSS 2.1 and Selectors Level 3</span><a class="self-link" href="#changes-css21"></a></h3> <p class="note" role="note"><span>Note:</span> The point of this spec is to match reality; changes from CSS2.1 are nearly always because CSS 2.1 specified something that doesn’t match actual browser behavior, or left something unspecified. If some detail doesn’t match browsers, please let me know as it’s almost certainly unintentional.</p> <p>Changes in decoding from a byte stream:</p> <ul> <li> Only detect <a class="css" data-link-type="maybe" href="#at-ruledef-charset" id="ref-for-at-ruledef-charset⑥">@charset</a> rules in ASCII-compatible byte patterns. <li> Ignore <a class="css" data-link-type="maybe" href="#at-ruledef-charset" id="ref-for-at-ruledef-charset⑦">@charset</a> rules that specify an ASCII-incompatible encoding, as that would cause the rule itself to not decode properly. <li> Refer to <a data-link-type="biblio" href="#biblio-encoding">[ENCODING]</a> rather than the IANA registry for character encodings. </ul> <p>Tokenization changes:</p> <ul> <li> Any U+0000 NULL <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨⑤">code point</a> in the CSS source is replaced with U+FFFD REPLACEMENT CHARACTER. <li> Any hexadecimal escape sequence such as <span class="css">\0</span> that evaluates to zero produce U+FFFD REPLACEMENT CHARACTER rather than U+0000 NULL. <li> The definition of <a data-link-type="dfn" href="#non-ascii-code-point" id="ref-for-non-ascii-code-point①">non-ASCII code point</a> was changed to be consistent with every definition of ASCII. This affects <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point⑨⑥">code points</a> U+0080 to U+009F, which are now <a data-link-type="dfn" href="#ident-code-point" id="ref-for-ident-code-point③">ident code points</a> rather than <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①⑧"><delim-token></a>s, like the rest of <span id="ref-for-non-ascii-code-point②">non-ASCII code points</span>. <li> Tokenization does not emit COMMENT or BAD_COMMENT tokens anymore. BAD_COMMENT is now considered the same as a normal token (not an error). <a href="#serialization">Serialization</a> is responsible for inserting comments as necessary between tokens that need to be separated, e.g. two consecutive <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①⑧"><ident-token></a>s. <li> The <a class="production css" data-link-type="type"><unicode-range-token></a> was removed, as it was low value and occasionally actively harmful. (<span class="css">u+a { font-weight: bold; }</span> was an invalid selector, for example...) <p>Instead, a <a class="production css" data-link-type="type" href="#typedef-urange" id="ref-for-typedef-urange②④"><urange></a> production was added, based on token patterns. It is technically looser than what 2.1 allowed (any number of digits and ? characters), but not in any way that should impact its use in practice.</p> <li> Apply the <a href="https://www.w3.org/TR/CSS2/syndata.html#unexpected-eof">EOF error handling rule</a> in the tokenizer and emit normal <a class="production css" data-link-type="type" href="#typedef-string-token" id="ref-for-typedef-string-token⑧"><string-token></a> and <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token①②"><url-token></a> rather than BAD_STRING or BAD_URI on EOF. <li> The BAD_URI token (now <a class="production css" data-link-type="type" href="#typedef-bad-url-token" id="ref-for-typedef-bad-url-token⑨"><bad-url-token></a>) is "self-contained". In other words, once the tokenizer realizes it’s in a <span class="production" id="ref-for-typedef-bad-url-token①⓪"><bad-url-token></span> rather than a <a class="production css" data-link-type="type" href="#typedef-url-token" id="ref-for-typedef-url-token①③"><url-token></a>, it just seeks forward to look for the closing ), ignoring everything else. This behavior is simpler than treating it like a <a class="production css" data-link-type="type" href="#typedef-function-token" id="ref-for-typedef-function-token①③"><function-token></a> and paying attention to opened blocks and such. Only WebKit exhibits this behavior, but it doesn’t appear that we’ve gotten any compat bugs from it. <li> The <a class="production css" data-link-type="type" href="#typedef-comma-token" id="ref-for-typedef-comma-token⑤"><comma-token></a> has been added. <li> <a class="production css" data-link-type="type" href="#typedef-number-token" id="ref-for-typedef-number-token①②"><number-token></a>, <a class="production css" data-link-type="type" href="#typedef-percentage-token" id="ref-for-typedef-percentage-token④"><percentage-token></a>, and <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①⑤"><dimension-token></a> have been changed to include the preceding +/- sign as part of their value (rather than as a separate <a class="production css" data-link-type="type" href="#typedef-delim-token" id="ref-for-typedef-delim-token①⑨"><delim-token></a> that needs to be manually handled every time the token is mentioned in other specs). The only consequence of this is that comments can no longer be inserted between the sign and the number. <li> Scientific notation is supported for numbers/percentages/dimensions to match SVG, per WG resolution. <li> Hexadecimal escape for <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate③">surrogate</a> now emit a replacement character rather than the surrogate. This allows implementations to safely use UTF-16 internally. </ul> <p>Parsing changes:</p> <ul> <li> Any list of declarations now also accepts at-rules, like <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-page-3/#at-ruledef-page" id="ref-for-at-ruledef-page④">@page</a>, per WG resolution. This makes a difference in error handling even if no such at-rules are defined yet: an at-rule, valid or not, ends at a {} block without a <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token①②"><semicolon-token></a> and lets the next declaration begin. <li> The handling of some miscellaneous "special" tokens (like an unmatched <a href="#tokendef-close-curly" id="ref-for-tokendef-close-curly⑤"><}-token></a>) showing up in various places in the grammar has been specified with some reasonable behavior shown by at least one browser. Previously, stylesheets with those tokens in those places just didn’t match the stylesheet grammar at all, so their handling was totally undefined. Specifically: <ul> <li> [] blocks, () blocks and functions can now contain {} blocks, <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token①①"><at-keyword-token></a>s or <a class="production css" data-link-type="type" href="#typedef-semicolon-token" id="ref-for-typedef-semicolon-token①③"><semicolon-token></a>s <li> Qualified rule preludes can now contain semicolons <li> Qualified rule and at-rule preludes can now contain <a class="production css" data-link-type="type" href="#typedef-at-keyword-token" id="ref-for-typedef-at-keyword-token①②"><at-keyword-token></a>s </ul> </ul> <p><var>An+B</var> changes from Selectors Level 3 <a data-link-type="biblio" href="#biblio-select">[SELECT]</a>:</p> <ul> <li> The <var>An+B</var> microsyntax has now been formally defined in terms of CSS tokens, rather than with a separate tokenizer. This has resulted in minor differences: <ul> <li> In some cases, minus signs or digits can be escaped (when they appear as part of the unit of a <a class="production css" data-link-type="type" href="#typedef-dimension-token" id="ref-for-typedef-dimension-token①⑥"><dimension-token></a> or <a class="production css" data-link-type="type" href="#typedef-ident-token" id="ref-for-typedef-ident-token①⑨"><ident-token></a>). </ul> </ul> <h2 class="no-num heading settled" id="acknowledgments"><span class="content"> Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2> <p>Thanks for feedback and contributions from Anne van Kesteren, David Baron, Elika J. Etemad (fantasai), Henri Sivonen, Johannes Koch, 呂康豪 (Kang-Hao Lu), Marc O’Morain, Raffaello Giulietti, Simon Pieter, Tyler Karaszewski, and Zack Weinberg.</p> </main> <h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content"> Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2> <h3 class="no-ref heading settled" id="w3c-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3> <p>Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification. </p> <p>All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a></p> <p>Examples in this specification are introduced with the words “for example” or are set apart from the normative text with <code>class="example"</code>, like this: </p> <div class="example" id="w3c-example"> <a class="self-link" href="#w3c-example"></a> <p>This is an example of an informative example.</p> </div> <p>Informative notes begin with the word “Note” and are set apart from the normative text with <code>class="note"</code>, like this: </p> <p class="note" role="note">Note, this is an informative note.</p> <p>Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <code><strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p> <h3 class="no-ref heading settled" id="w3c-conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#w3c-conformance-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders documents that use them. <dt>authoring tool <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet. </dl> <p>A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module. </p> <p>A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.) </p> <p>An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module. </p> <h3 class="no-ref heading settled" id="w3c-partial"><span class="content"> Partial implementations</span><a class="self-link" href="#w3c-partial"></a></h3> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignore as appropriate</a>) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents <strong>must not</strong> selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.</p> <h4 class="heading settled" id="w3c-conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#w3c-conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="https://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="https://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="https://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h3 class="no-ref heading settled" id="w3c-testing"><span class="content"> Non-experimental implementations</span><a class="self-link" href="#w3c-testing"></a></h3> <p>Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec. </p> <p>To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group. </p> <p>Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at <a href="https://www.w3.org/Style/CSS/Test/">https://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="https://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.</p> <h3 class="no-ref heading settled" id="w3c-cr-exit-criteria"><span class="content"> CR exit criteria</span><a class="self-link" href="#w3c-cr-exit-criteria"></a></h3> <p> For this specification to be advanced to Proposed Recommendation, there must be at least two independent, interoperable implementations of each feature. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms: </p> <dl> <dt>independent <dd>each implementation must be developed by a different party and cannot share, reuse, or derive from code used by another qualifying implementation. Sections of code that have no bearing on the implementation of this specification are exempt from this requirement. <dt>interoperable <dd>passing the respective test case(s) in the official CSS test suite, or, if the implementation is not a Web browser, an equivalent test. Every relevant test in the test suite should have an equivalent test created if such a user agent (UA) is to be used to claim interoperability. In addition if such a UA is to be used to claim interoperability, then there must one or more additional UAs which can also pass those equivalent tests in the same way for the purpose of interoperability. The equivalent tests must be made publicly available for the purposes of peer review. <dt>implementation <dd> a user agent which: <ol class="inline"> <li>implements the specification. <li>is available to the general public. The implementation may be a shipping product or other publicly available version (i.e., beta version, preview release, or "nightly build"). Non-shipping product releases must have implemented the feature(s) for a period of at least one month in order to demonstrate stability. <li>is not experimental (i.e., a version specifically designed to pass the test suite and is not intended for normal usage going forward). </ol> </dl> <p>The specification will remain Candidate Recommendation for at least six months.</p> <script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li><a href="#anb-production"><an+b></a><span>, in § 6.2</span> <li><a href="#anb">An+B</a><span>, in § 6</span> <li><a href="#typedef-any-value"><any-value></a><span>, in § 8.2</span> <li><a href="#check-if-two-code-points-are-a-valid-escape">are a valid escape</a><span>, in § 4.3.8</span> <li><a href="#typedef-at-keyword-token"><at-keyword-token></a><span>, in § 4</span> <li><a href="#at-rule">at-rule</a><span>, in § 9.2</span> <li><a href="#typedef-bad-string-token"><bad-string-token></a><span>, in § 4</span> <li><a href="#typedef-bad-url-token"><bad-url-token></a><span>, in § 4</span> <li><a href="#paren-block">()-block</a><span>, in § 5</span> <li><a href="#square-block">[]-block</a><span>, in § 5</span> <li><a href="#curly-block">{}-block</a><span>, in § 5</span> <li><a href="#block-at-rule">block at-rule</a><span>, in § 9.2</span> <li><a href="#typedef-cdc-token"><CDC-token></a><span>, in § 4</span> <li><a href="#typedef-cdo-token"><CDO-token></a><span>, in § 4</span> <li><a href="#at-ruledef-charset">@charset</a><span>, in § 9.3</span> <li><a href="#check-if-three-code-points-would-start-an-ident-sequence">check if three code points would start an ident sequence</a><span>, in § 4.3.9</span> <li><a href="#check-if-three-code-points-would-start-a-number">check if three code points would start a number</a><span>, in § 4.3.10</span> <li><a href="#check-if-two-code-points-are-a-valid-escape">check if two code points are a valid escape</a><span>, in § 4.3.8</span> <li><a href="#typedef-colon-token"><colon-token></a><span>, in § 4</span> <li><a href="#typedef-comma-token"><comma-token></a><span>, in § 4</span> <li><a href="#component-value">component value</a><span>, in § 5</span> <li><a href="#consume-a-component-value">consume a component value</a><span>, in § 5.4.7</span> <li><a href="#consume-a-declaration">consume a declaration</a><span>, in § 5.4.6</span> <li><a href="#consume-a-function">consume a function</a><span>, in § 5.4.9</span> <li><a href="#consume-a-list-of-declarations">consume a list of declarations</a><span>, in § 5.4.5</span> <li><a href="#consume-a-list-of-rules">consume a list of rules</a><span>, in § 5.4.1</span> <li><a href="#consume-an-at-rule">consume an at-rule</a><span>, in § 5.4.2</span> <li><a href="#consume-an-escaped-code-point">consume an escaped code point</a><span>, in § 4.3.7</span> <li><a href="#consume-an-ident-like-token">consume an ident-like token</a><span>, in § 4.3.4</span> <li><a href="#consume-an-ident-sequence">consume an ident sequence</a><span>, in § 4.3.11</span> <li><a href="#consume-a-number">consume a number</a><span>, in § 4.3.12</span> <li><a href="#consume-a-numeric-token">consume a numeric token</a><span>, in § 4.3.3</span> <li><a href="#consume-a-qualified-rule">consume a qualified rule</a><span>, in § 5.4.3</span> <li><a href="#consume-a-simple-block">consume a simple block</a><span>, in § 5.4.8</span> <li><a href="#consume-a-string-token">consume a string token</a><span>, in § 4.3.5</span> <li><a href="#consume-a-style-blocks-contents">consume a style block’s contents</a><span>, in § 5.4.4</span> <li><a href="#consume-a-token">consume a token</a><span>, in § 4.3.1</span> <li><a href="#consume-a-url-token">consume a url token</a><span>, in § 4.3.6</span> <li><a href="#consume-comments">consume comments</a><span>, in § 4.3.2</span> <li><a href="#consume-the-next-input-token">consume the next input token</a><span>, in § 5.2</span> <li><a href="#consume-the-remnants-of-a-bad-url">consume the remnants of a bad url</a><span>, in § 4.3.14</span> <li><a href="#convert-a-string-to-a-number">convert a string to a number</a><span>, in § 4.3.13</span> <li><a href="#ident-sequence">CSS ident sequence</a><span>, in § 4.2</span> <li><a href="#current-input-code-point">current input code point</a><span>, in § 4.2</span> <li><a href="#current-input-token">current input token</a><span>, in § 5.2</span> <li><a href="#typedef-dashndashdigit-ident"><dashndashdigit-ident></a><span>, in § 6.2</span> <li><a href="#declaration">declaration</a><span>, in § 5</span> <li><a href="#typedef-declaration-list"><declaration-list></a><span>, in § 8.1</span> <li><a href="#typedef-declaration-value"><declaration-value></a><span>, in § 8.2</span> <li><a href="#css-decode-bytes">decode bytes</a><span>, in § 3.2</span> <li><a href="#typedef-delim-token"><delim-token></a><span>, in § 4</span> <li><a href="#css-descriptor">descriptor</a><span>, in § 9.2</span> <li><a href="#css-descriptor-declarations">descriptor declarations</a><span>, in § 5</span> <li><a href="#determine-the-fallback-encoding">determine the fallback encoding</a><span>, in § 3.2</span> <li><a href="#digit">digit</a><span>, in § 4.2</span> <li><a href="#typedef-dimension-token"><dimension-token></a><span>, in § 4</span> <li><a href="#ending-token">ending token</a><span>, in § 5.4.8</span> <li><a href="#environment-encoding">environment encoding</a><span>, in § 3.2</span> <li><a href="#eof-code-point">EOF code point</a><span>, in § 4.2</span> <li><a href="#typedef-eof-token"><EOF-token></a><span>, in § 5.2</span> <li><a href="#escape-codepoint">escaping</a><span>, in § 2.1</span> <li><a href="#css-filter-code-points">filter code points</a><span>, in § 3.3</span> <li><a href="#css-filter-code-points">filtered code points</a><span>, in § 3.3</span> <li><a href="#function">function</a><span>, in § 5</span> <li><a href="#typedef-function-token"><function-token></a><span>, in § 4</span> <li><a href="#typedef-hash-token"><hash-token></a><span>, in § 4</span> <li><a href="#hex-digit">hex digit</a><span>, in § 4.2</span> <li><a href="#ident-code-point">ident code point</a><span>, in § 4.2</span> <li><a href="#ident-sequence">ident sequence</a><span>, in § 4.2</span> <li><a href="#ident-start-code-point">ident-start code point</a><span>, in § 4.2</span> <li><a href="#typedef-ident-token"><ident-token></a><span>, in § 4</span> <li><a href="#css-ignored">ignored</a><span>, in § 2.2</span> <li><a href="#input-stream">input stream</a><span>, in § 3.3</span> <li><a href="#typedef-integer"><integer></a><span>, in § 6.2</span> <li><a href="#css-invalid">invalid</a><span>, in § 2.2</span> <li><a href="#letter">letter</a><span>, in § 4.2</span> <li><a href="#lowercase-letter">lowercase letter</a><span>, in § 4.2</span> <li><a href="#maximum-allowed-code-point">maximum allowed code point</a><span>, in § 4.2</span> <li><a href="#ident-start-code-point">name-start code point</a><span>, in § 4.2</span> <li><a href="#typedef-ndashdigit-dimension"><ndashdigit-dimension></a><span>, in § 6.2</span> <li><a href="#typedef-ndashdigit-ident"><ndashdigit-ident></a><span>, in § 6.2</span> <li><a href="#typedef-ndash-dimension"><ndash-dimension></a><span>, in § 6.2</span> <li><a href="#typedef-n-dimension"><n-dimension></a><span>, in § 6.2</span> <li><a href="#newline">newline</a><span>, in § 4.2</span> <li><a href="#next-input-code-point">next input code point</a><span>, in § 4.2</span> <li><a href="#next-input-token">next input token</a><span>, in § 5.2</span> <li><a href="#non-ascii-code-point">non-ASCII code point</a><span>, in § 4.2</span> <li><a href="#non-printable-code-point">non-printable code point</a><span>, in § 4.2</span> <li><a href="#normalize-into-a-token-stream">normalize</a><span>, in § 5.3</span> <li><a href="#normalize-into-a-token-stream">normalize into a token stream</a><span>, in § 5.3</span> <li><a href="#typedef-number-token"><number-token></a><span>, in § 4</span> <li><a href="#css-parse-something-according-to-a-css-grammar">parse</a><span>, in § 5.3.1</span> <li><a href="#css-parse-a-comma-separated-list-according-to-a-css-grammar">parse a comma-separated list according to a CSS grammar</a><span>, in § 5.3.2</span> <li><a href="#parse-a-comma-separated-list-of-component-values">parse a comma-separated list of component values</a><span>, in § 5.3.11</span> <li><a href="#parse-a-component-value">parse a component value</a><span>, in § 5.3.9</span> <li><a href="#parse-a-css-stylesheet">parse a CSS stylesheet</a><span>, in § 9</span> <li><a href="#parse-a-declaration">parse a declaration</a><span>, in § 5.3.6</span> <li><a href="#css-parse-a-comma-separated-list-according-to-a-css-grammar">parse a list</a><span>, in § 5.3.2</span> <li><a href="#parse-a-list-of-component-values">parse a list of component values</a><span>, in § 5.3.10</span> <li><a href="#parse-a-list-of-declarations">parse a list of declarations</a><span>, in § 5.3.8</span> <li><a href="#parse-a-list-of-rules">parse a list of rules</a><span>, in § 5.3.4</span> <li><a href="#parse-a-rule">parse a rule</a><span>, in § 5.3.5</span> <li><a href="#parse-a-style-blocks-contents">parse a style block’s contents</a><span>, in § 5.3.7</span> <li><a href="#parse-a-stylesheet">parse a stylesheet</a><span>, in § 5.3.3</span> <li><a href="#parse-error">parse error</a><span>, in § 3</span> <li><a href="#css-parse-something-according-to-a-css-grammar">parse something according to a CSS grammar</a><span>, in § 5.3.1</span> <li><a href="#css-parse-a-comma-separated-list-according-to-a-css-grammar">parsing a list</a><span>, in § 5.3.2</span> <li><a href="#typedef-percentage-token"><percentage-token></a><span>, in § 4</span> <li><a href="#preserved-tokens">preserved tokens</a><span>, in § 5</span> <li><a href="#css-property-declarations">property declarations</a><span>, in § 5</span> <li><a href="#qualified-rule">qualified rule</a><span>, in § 5</span> <li><a href="#reconsume-the-current-input-code-point">reconsume the current input code point</a><span>, in § 4.2</span> <li><a href="#reconsume-the-current-input-token">reconsume the current input token</a><span>, in § 5.2</span> <li><a href="#representation">representation</a><span>, in § 4.2</span> <li><a href="#typedef-rule-list"><rule-list></a><span>, in § 8.1</span> <li><a href="#typedef-semicolon-token"><semicolon-token></a><span>, in § 4</span> <li><a href="#serialize-an-anb-value">serialize an <an+b> value</a><span>, in § 10.1</span> <li><a href="#typedef-signed-integer"><signed-integer></a><span>, in § 6.2</span> <li><a href="#typedef-signless-integer"><signless-integer></a><span>, in § 6.2</span> <li><a href="#simple-block">simple block</a><span>, in § 5</span> <li><a href="#check-if-three-code-points-would-start-an-ident-sequence">starts with an ident sequence</a><span>, in § 4.3.9</span> <li><a href="#check-if-three-code-points-would-start-a-number">starts with a number</a><span>, in § 4.3.10</span> <li><a href="#check-if-two-code-points-are-a-valid-escape">starts with a valid escape</a><span>, in § 4.3.8</span> <li><a href="#check-if-three-code-points-would-start-an-ident-sequence">start with an ident sequence</a><span>, in § 4.3.9</span> <li><a href="#check-if-three-code-points-would-start-a-number">start with a number</a><span>, in § 4.3.10</span> <li><a href="#statement-at-rule">statement at-rule</a><span>, in § 9.2</span> <li><a href="#typedef-string-token"><string-token></a><span>, in § 4</span> <li><a href="#typedef-style-block"><style-block></a><span>, in § 8.1</span> <li><a href="#style-rule">style rule</a><span>, in § 9.1</span> <li><a href="#typedef-stylesheet"><stylesheet></a><span>, in § 8.1</span> <li><a href="#tokendef-open-paren"><(-token></a><span>, in § 4</span> <li><a href="#tokendef-close-paren"><)-token></a><span>, in § 4</span> <li><a href="#tokendef-open-square"><[-token></a><span>, in § 4</span> <li><a href="#tokendef-close-square"><]-token></a><span>, in § 4</span> <li><a href="#tokendef-open-curly"><{-token></a><span>, in § 4</span> <li><a href="#tokendef-close-curly"><}-token></a><span>, in § 4</span> <li><a href="#css-tokenize">tokenization</a><span>, in § 4</span> <li><a href="#css-tokenize">tokenize</a><span>, in § 4</span> <li><a href="#uppercase-letter">uppercase letter</a><span>, in § 4.2</span> <li><a href="#typedef-urange"><urange></a><span>, in § 7</span> <li><a href="#typedef-url-token"><url-token></a><span>, in § 4</span> <li><a href="#whitespace">whitespace</a><span>, in § 4.2</span> <li><a href="#typedef-whitespace-token"><whitespace-token></a><span>, in § 4</span> <li><a href="#check-if-three-code-points-would-start-an-ident-sequence">would start an ident sequence</a><span>, in § 4.3.9</span> <li><a href="#check-if-three-code-points-would-start-a-number">would start a number</a><span>, in § 4.3.10</span> </ul> <aside class="dfn-panel" data-for="term-for-at-ruledef-import"> <a href="https://www.w3.org/TR/css-cascade-5/#at-ruledef-import">https://www.w3.org/TR/css-cascade-5/#at-ruledef-import</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-import">2. Description of CSS’s Syntax</a> <li><a href="#ref-for-at-ruledef-import①">3.2. The input byte stream</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-css-property"> <a href="https://www.w3.org/TR/css-cascade-5/#css-property">https://www.w3.org/TR/css-cascade-5/#css-property</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-property">5. Parsing</a> <li><a href="#ref-for-css-property①">9.2. At-rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-cascade"> <a href="https://www.w3.org/TR/css-cascade-6/#cascade">https://www.w3.org/TR/css-cascade-6/#cascade</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-cascade">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-important"> <a href="https://www.w3.org/TR/css-cascade-6/#important">https://www.w3.org/TR/css-cascade-6/#important</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-important">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-color"> <a href="https://www.w3.org/TR/css-color-4/#typedef-color">https://www.w3.org/TR/css-color-4/#typedef-color</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-color">5.3.1. Parse something according to a CSS grammar</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-valdef-color-blue"> <a href="https://www.w3.org/TR/css-color-4/#valdef-color-blue">https://www.w3.org/TR/css-color-4/#valdef-color-blue</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-color-blue">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-color"> <a href="https://www.w3.org/TR/css-color-4/#propdef-color">https://www.w3.org/TR/css-color-4/#propdef-color</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-color">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-counter-style"> <a href="https://www.w3.org/TR/css-counter-styles-3/#at-ruledef-counter-style">https://www.w3.org/TR/css-counter-styles-3/#at-ruledef-counter-style</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-counter-style">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-counter-style"> <a href="https://www.w3.org/TR/css-counter-styles-3/#counter-style">https://www.w3.org/TR/css-counter-styles-3/#counter-style</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-counter-style">9.2. At-rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-font-feature-values"> <a href="https://www.w3.org/TR/css-fonts-4/#at-ruledef-font-feature-values">https://www.w3.org/TR/css-fonts-4/#at-ruledef-font-feature-values</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-font-feature-values">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-descdef-font-face-unicode-range"> <a href="https://www.w3.org/TR/css-fonts-4/#descdef-font-face-unicode-range">https://www.w3.org/TR/css-fonts-4/#descdef-font-face-unicode-range</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-descdef-font-face-unicode-range">7. The Unicode-Range microsyntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-font-face-rule"> <a href="https://www.w3.org/TR/css-fonts-5/#at-font-face-rule">https://www.w3.org/TR/css-fonts-5/#at-font-face-rule</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-font-face-rule">7. The Unicode-Range microsyntax</a> <li><a href="#ref-for-at-font-face-rule①">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-at-font-face-rule②">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-nest"> <a href="https://www.w3.org/TR/css-nesting-1/#at-ruledef-nest">https://www.w3.org/TR/css-nesting-1/#at-ruledef-nest</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-nest">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <li><a href="#ref-for-at-ruledef-nest①">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-nested-conditional-group-rules"> <a href="https://www.w3.org/TR/css-nesting-1/#nested-conditional-group-rules">https://www.w3.org/TR/css-nesting-1/#nested-conditional-group-rules</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-nested-conditional-group-rules">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-nested-style-rule"> <a href="https://www.w3.org/TR/css-nesting-1/#nested-style-rule">https://www.w3.org/TR/css-nesting-1/#nested-style-rule</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-nested-style-rule">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-valdef-page-left"> <a href="https://www.w3.org/TR/css-page-3/#valdef-page-left">https://www.w3.org/TR/css-page-3/#valdef-page-left</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-page-left">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-page"> <a href="https://www.w3.org/TR/css-page-3/#at-ruledef-page">https://www.w3.org/TR/css-page-3/#at-ruledef-page</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-page">2. Description of CSS’s Syntax</a> <li><a href="#ref-for-at-ruledef-page①">5.3.7. Parse a style block’s contents</a> <li><a href="#ref-for-at-ruledef-page②">5.3.8. Parse a list of declarations</a> <li><a href="#ref-for-at-ruledef-page③">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <li><a href="#ref-for-at-ruledef-page④">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-text-decoration"> <a href="https://www.w3.org/TR/css-text-decor-3/#propdef-text-decoration">https://www.w3.org/TR/css-text-decor-3/#propdef-text-decoration</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-text-decoration">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-valdef-text-decoration-line-underline"> <a href="https://www.w3.org/TR/css-text-decor-3/#valdef-text-decoration-line-underline">https://www.w3.org/TR/css-text-decor-3/#valdef-text-decoration-line-underline</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-text-decoration-line-underline">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-funcdef-transform-translatex"> <a href="https://www.w3.org/TR/css-transforms-1/#funcdef-transform-translatex">https://www.w3.org/TR/css-transforms-1/#funcdef-transform-translatex</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-transform-translatex">8. Defining Grammars for Rules and Other Values</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-funcdef-attr"> <a href="https://www.w3.org/TR/css-values-3/#funcdef-attr">https://www.w3.org/TR/css-values-3/#funcdef-attr</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-attr">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-mult-zero-plus"> <a href="https://www.w3.org/TR/css-values-4/#mult-zero-plus">https://www.w3.org/TR/css-values-4/#mult-zero-plus</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-mult-zero-plus">7.1. The <urange> type</a> <a href="#ref-for-mult-zero-plus①">(2)</a> <a href="#ref-for-mult-zero-plus②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-mult-one-plus"> <a href="https://www.w3.org/TR/css-values-4/#mult-one-plus">https://www.w3.org/TR/css-values-4/#mult-one-plus</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-mult-one-plus">6.2. The <an+b> type</a> <li><a href="#ref-for-mult-one-plus①">7.1. The <urange> type</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-dimension"> <a href="https://www.w3.org/TR/css-values-4/#typedef-dimension">https://www.w3.org/TR/css-values-4/#typedef-dimension</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-dimension">7.1. The <urange> type</a> <a href="#ref-for-typedef-dimension①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-number-value"> <a href="https://www.w3.org/TR/css-values-4/#number-value">https://www.w3.org/TR/css-values-4/#number-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-number-value">7.1. The <urange> type</a> <a href="#ref-for-number-value①">(2)</a> <a href="#ref-for-number-value②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-string-value"> <a href="https://www.w3.org/TR/css-values-4/#string-value">https://www.w3.org/TR/css-values-4/#string-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-string-value">5.3.1. Parse something according to a CSS grammar</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-mult-opt"> <a href="https://www.w3.org/TR/css-values-4/#mult-opt">https://www.w3.org/TR/css-values-4/#mult-opt</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-mult-opt">6.2. The <an+b> type</a> <a href="#ref-for-mult-opt①">(2)</a> <a href="#ref-for-mult-opt②">(3)</a> <a href="#ref-for-mult-opt③">(4)</a> <a href="#ref-for-mult-opt④">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-funcdef-url"> <a href="https://www.w3.org/TR/css-values-4/#funcdef-url">https://www.w3.org/TR/css-values-4/#funcdef-url</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-url">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-comb-one"> <a href="https://www.w3.org/TR/css-values-4/#comb-one">https://www.w3.org/TR/css-values-4/#comb-one</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-comb-one">6.2. The <an+b> type</a> <a href="#ref-for-comb-one①">(2)</a> <a href="#ref-for-comb-one②">(3)</a> <a href="#ref-for-comb-one③">(4)</a> <a href="#ref-for-comb-one④">(5)</a> <a href="#ref-for-comb-one⑤">(6)</a> <a href="#ref-for-comb-one⑥">(7)</a> <a href="#ref-for-comb-one⑦">(8)</a> <a href="#ref-for-comb-one⑧">(9)</a> <a href="#ref-for-comb-one⑨">(10)</a> <a href="#ref-for-comb-one①⓪">(11)</a> <a href="#ref-for-comb-one①①">(12)</a> <a href="#ref-for-comb-one①②">(13)</a> <a href="#ref-for-comb-one①③">(14)</a> <a href="#ref-for-comb-one①④">(15)</a> <a href="#ref-for-comb-one①⑤">(16)</a> <a href="#ref-for-comb-one①⑥">(17)</a> <a href="#ref-for-comb-one①⑦">(18)</a> <a href="#ref-for-comb-one①⑧">(19)</a> <li><a href="#ref-for-comb-one①⑨">7.1. The <urange> type</a> <a href="#ref-for-comb-one②⓪">(2)</a> <a href="#ref-for-comb-one②①">(3)</a> <a href="#ref-for-comb-one②②">(4)</a> <a href="#ref-for-comb-one②③">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-custom-property"> <a href="https://www.w3.org/TR/css-variables-1/#custom-property">https://www.w3.org/TR/css-variables-1/#custom-property</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-custom-property">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-keyframe-selector"> <a href="https://www.w3.org/TR/css-animations-1/#typedef-keyframe-selector">https://www.w3.org/TR/css-animations-1/#typedef-keyframe-selector</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-keyframe-selector">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-keyframes-name"> <a href="https://www.w3.org/TR/css-animations-1/#typedef-keyframes-name">https://www.w3.org/TR/css-animations-1/#typedef-keyframes-name</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-keyframes-name">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-keyframes"> <a href="https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes">https://www.w3.org/TR/css-animations-1/#at-ruledef-keyframes</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-keyframes">5.3.7. Parse a style block’s contents</a> <li><a href="#ref-for-at-ruledef-keyframes①">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-at-ruledef-keyframes②">(2)</a> <a href="#ref-for-at-ruledef-keyframes③">(3)</a> <a href="#ref-for-at-ruledef-keyframes④">(4)</a> <li><a href="#ref-for-at-ruledef-keyframes⑤">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-animation-timing-function"> <a href="https://www.w3.org/TR/css-animations-1/#propdef-animation-timing-function">https://www.w3.org/TR/css-animations-1/#propdef-animation-timing-function</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-animation-timing-function">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-media"> <a href="https://www.w3.org/TR/css3-conditional/#at-ruledef-media">https://www.w3.org/TR/css3-conditional/#at-ruledef-media</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-media">2. Description of CSS’s Syntax</a> <a href="#ref-for-at-ruledef-media①">(2)</a> <li><a href="#ref-for-at-ruledef-media②">5.3. Parser Entry Points</a> <li><a href="#ref-for-at-ruledef-media③">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-at-ruledef-media④">(2)</a> <a href="#ref-for-at-ruledef-media⑤">(3)</a> <li><a href="#ref-for-at-ruledef-media⑥">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-at-ruledef-supports"> <a href="https://www.w3.org/TR/css3-conditional/#at-ruledef-supports">https://www.w3.org/TR/css3-conditional/#at-ruledef-supports</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-supports">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-conditional-group-rule"> <a href="https://www.w3.org/TR/css3-conditional/#conditional-group-rule">https://www.w3.org/TR/css3-conditional/#conditional-group-rule</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-conditional-group-rule">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <li><a href="#ref-for-conditional-group-rule①">9.1. Style rules</a> <li><a href="#ref-for-conditional-group-rule②">9.2. At-rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-concept-css-style-sheet-location"> <a href="https://www.w3.org/TR/cssom-1/#concept-css-style-sheet-location">https://www.w3.org/TR/cssom-1/#concept-css-style-sheet-location</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-concept-css-style-sheet-location">5.3.3. Parse a stylesheet</a> <li><a href="#ref-for-concept-css-style-sheet-location①">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-decode"> <a href="https://encoding.spec.whatwg.org/#decode">https://encoding.spec.whatwg.org/#decode</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-decode">3.2. The input byte stream</a> <a href="#ref-for-decode①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-concept-encoding-get"> <a href="https://encoding.spec.whatwg.org/#concept-encoding-get">https://encoding.spec.whatwg.org/#concept-encoding-get</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-concept-encoding-get">3.2. The input byte stream</a> <a href="#ref-for-concept-encoding-get①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-the-a-element"> <a href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element">https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-the-a-element">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-the-p-element"> <a href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element">https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-the-p-element">2. Description of CSS’s Syntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-attr-img-sizes"> <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-sizes">https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-sizes</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-attr-img-sizes">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-ascii-case-insensitive"> <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">https://infra.spec.whatwg.org/#ascii-case-insensitive</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-ascii-case-insensitive">4.3.4. Consume an ident-like token</a> <li><a href="#ref-for-ascii-case-insensitive①">5.4.6. Consume a declaration</a> <li><a href="#ref-for-ascii-case-insensitive②">6.2. The <an+b> type</a> <a href="#ref-for-ascii-case-insensitive③">(2)</a> <a href="#ref-for-ascii-case-insensitive④">(3)</a> <a href="#ref-for-ascii-case-insensitive⑤">(4)</a> <a href="#ref-for-ascii-case-insensitive⑥">(5)</a> <li><a href="#ref-for-ascii-case-insensitive⑦">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-ascii-case-insensitive⑧">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-code-point"> <a href="https://infra.spec.whatwg.org/#code-point">https://infra.spec.whatwg.org/#code-point</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-code-point">1. Introduction</a> <li><a href="#ref-for-code-point①">2. Description of CSS’s Syntax</a> <a href="#ref-for-code-point②">(2)</a> <li><a href="#ref-for-code-point③">2.1. Escaping</a> <a href="#ref-for-code-point④">(2)</a> <a href="#ref-for-code-point⑤">(3)</a> <a href="#ref-for-code-point⑥">(4)</a> <li><a href="#ref-for-code-point⑦">3.1. Overview of the Parsing Model</a> <li><a href="#ref-for-code-point⑧">3.2. The input byte stream</a> <a href="#ref-for-code-point⑨">(2)</a> <a href="#ref-for-code-point①⓪">(3)</a> <li><a href="#ref-for-code-point①①">3.3. Preprocessing the input stream</a> <a href="#ref-for-code-point①②">(2)</a> <a href="#ref-for-code-point①③">(3)</a> <a href="#ref-for-code-point①④">(4)</a> <a href="#ref-for-code-point①⑤">(5)</a> <li><a href="#ref-for-code-point①⑥">4. Tokenization</a> <a href="#ref-for-code-point①⑦">(2)</a> <a href="#ref-for-code-point①⑧">(3)</a> <a href="#ref-for-code-point①⑨">(4)</a> <a href="#ref-for-code-point②⓪">(5)</a> <li><a href="#ref-for-code-point②①">4.2. Definitions</a> <a href="#ref-for-code-point②②">(2)</a> <a href="#ref-for-code-point②③">(3)</a> <a href="#ref-for-code-point②④">(4)</a> <a href="#ref-for-code-point②⑤">(5)</a> <a href="#ref-for-code-point②⑥">(6)</a> <a href="#ref-for-code-point②⑦">(7)</a> <a href="#ref-for-code-point②⑧">(8)</a> <a href="#ref-for-code-point②⑨">(9)</a> <a href="#ref-for-code-point③⓪">(10)</a> <a href="#ref-for-code-point③①">(11)</a> <a href="#ref-for-code-point③②">(12)</a> <a href="#ref-for-code-point③③">(13)</a> <li><a href="#ref-for-code-point③④">4.3. Tokenizer Algorithms</a> <li><a href="#ref-for-code-point③⑤">4.3.1. Consume a token</a> <li><a href="#ref-for-code-point③⑥">4.3.2. Consume comments</a> <a href="#ref-for-code-point③⑦">(2)</a> <li><a href="#ref-for-code-point③⑧">4.3.3. Consume a numeric token</a> <li><a href="#ref-for-code-point③⑨">4.3.4. Consume an ident-like token</a> <li><a href="#ref-for-code-point④⓪">4.3.5. Consume a string token</a> <a href="#ref-for-code-point④①">(2)</a> <a href="#ref-for-code-point④②">(3)</a> <li><a href="#ref-for-code-point④③">4.3.6. Consume a url token</a> <a href="#ref-for-code-point④④">(2)</a> <li><a href="#ref-for-code-point④⑤">4.3.7. Consume an escaped code point</a> <a href="#ref-for-code-point④⑥">(2)</a> <li><a href="#ref-for-code-point④⑦">4.3.8. Check if two code points are a valid escape</a> <a href="#ref-for-code-point④⑧">(2)</a> <a href="#ref-for-code-point④⑨">(3)</a> <a href="#ref-for-code-point⑤⓪">(4)</a> <a href="#ref-for-code-point⑤①">(5)</a> <li><a href="#ref-for-code-point⑤②">4.3.9. Check if three code points would start an ident sequence</a> <a href="#ref-for-code-point⑤③">(2)</a> <a href="#ref-for-code-point⑤④">(3)</a> <a href="#ref-for-code-point⑤⑤">(4)</a> <a href="#ref-for-code-point⑤⑥">(5)</a> <a href="#ref-for-code-point⑤⑦">(6)</a> <a href="#ref-for-code-point⑤⑧">(7)</a> <li><a href="#ref-for-code-point⑤⑨">4.3.10. Check if three code points would start a number</a> <a href="#ref-for-code-point⑥⓪">(2)</a> <a href="#ref-for-code-point⑥①">(3)</a> <a href="#ref-for-code-point⑥②">(4)</a> <a href="#ref-for-code-point⑥③">(5)</a> <a href="#ref-for-code-point⑥④">(6)</a> <a href="#ref-for-code-point⑥⑤">(7)</a> <a href="#ref-for-code-point⑥⑥">(8)</a> <li><a href="#ref-for-code-point⑥⑦">4.3.11. Consume an ident sequence</a> <a href="#ref-for-code-point⑥⑧">(2)</a> <a href="#ref-for-code-point⑥⑨">(3)</a> <a href="#ref-for-code-point⑦⓪">(4)</a> <a href="#ref-for-code-point⑦①">(5)</a> <a href="#ref-for-code-point⑦②">(6)</a> <li><a href="#ref-for-code-point⑦③">4.3.12. Consume a number</a> <a href="#ref-for-code-point⑦④">(2)</a> <li><a href="#ref-for-code-point⑦⑤">4.3.14. Consume the remnants of a bad url</a> <li><a href="#ref-for-code-point⑦⑥">6.2. The <an+b> type</a> <a href="#ref-for-code-point⑦⑦">(2)</a> <li><a href="#ref-for-code-point⑦⑧">7.1. The <urange> type</a> <a href="#ref-for-code-point⑦⑨">(2)</a> <a href="#ref-for-code-point⑧⓪">(3)</a> <a href="#ref-for-code-point⑧①">(4)</a> <a href="#ref-for-code-point⑧②">(5)</a> <a href="#ref-for-code-point⑧③">(6)</a> <a href="#ref-for-code-point⑧④">(7)</a> <a href="#ref-for-code-point⑧⑤">(8)</a> <a href="#ref-for-code-point⑧⑥">(9)</a> <a href="#ref-for-code-point⑧⑦">(10)</a> <a href="#ref-for-code-point⑧⑧">(11)</a> <a href="#ref-for-code-point⑧⑨">(12)</a> <a href="#ref-for-code-point⑨⓪">(13)</a> <a href="#ref-for-code-point⑨①">(14)</a> <a href="#ref-for-code-point⑨②">(15)</a> <a href="#ref-for-code-point⑨③">(16)</a> <li><a href="#ref-for-code-point⑨④">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-code-point⑨⑤">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-code-point⑨⑥">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-list-extend"> <a href="https://infra.spec.whatwg.org/#list-extend">https://infra.spec.whatwg.org/#list-extend</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-list-extend">5.4.4. Consume a style block’s contents</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-list-iterate"> <a href="https://infra.spec.whatwg.org/#list-iterate">https://infra.spec.whatwg.org/#list-iterate</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-list-iterate">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-list"> <a href="https://infra.spec.whatwg.org/#list">https://infra.spec.whatwg.org/#list</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-list">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> <li><a href="#ref-for-list①">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-list②">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-list③">5.4.4. Consume a style block’s contents</a> <a href="#ref-for-list④">(2)</a> <li><a href="#ref-for-list⑤">5.4.6. Consume a declaration</a> <li><a href="#ref-for-list⑥">5.4.8. Consume a simple block</a> <li><a href="#ref-for-list⑦">5.4.9. Consume a function</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-list-remove"> <a href="https://infra.spec.whatwg.org/#list-remove">https://infra.spec.whatwg.org/#list-remove</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-list-remove">5.4.6. Consume a declaration</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-scalar-value"> <a href="https://infra.spec.whatwg.org/#scalar-value">https://infra.spec.whatwg.org/#scalar-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-scalar-value">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-string"> <a href="https://infra.spec.whatwg.org/#string">https://infra.spec.whatwg.org/#string</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-string">5.3. Parser Entry Points</a> <li><a href="#ref-for-string①">10.1. Serializing <an+b></a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-surrogate"> <a href="https://infra.spec.whatwg.org/#surrogate">https://infra.spec.whatwg.org/#surrogate</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-surrogate">3.3. Preprocessing the input stream</a> <li><a href="#ref-for-surrogate①">4.3.7. Consume an escaped code point</a> <li><a href="#ref-for-surrogate②">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> <li><a href="#ref-for-surrogate③">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-general-enclosed"> <a href="https://www.w3.org/TR/mediaqueries-5/#typedef-general-enclosed">https://www.w3.org/TR/mediaqueries-5/#typedef-general-enclosed</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-general-enclosed">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-media-query-list"> <a href="https://www.w3.org/TR/mediaqueries-5/#typedef-media-query-list">https://www.w3.org/TR/mediaqueries-5/#typedef-media-query-list</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-media-query-list">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-selectordef-adjacent"> <a href="https://www.w3.org/TR/selectors-4/#selectordef-adjacent">https://www.w3.org/TR/selectors-4/#selectordef-adjacent</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-selectordef-adjacent">6.1. Informal Syntax Description</a> <a href="#ref-for-selectordef-adjacent①">(2)</a> <a href="#ref-for-selectordef-adjacent②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-nth-child-pseudo"> <a href="https://www.w3.org/TR/selectors-4/#nth-child-pseudo">https://www.w3.org/TR/selectors-4/#nth-child-pseudo</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-nth-child-pseudo">6. The An+B microsyntax</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-selector-list"> <a href="https://www.w3.org/TR/selectors-4/#typedef-selector-list">https://www.w3.org/TR/selectors-4/#typedef-selector-list</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-selector-list">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-selector-list"> <a href="https://www.w3.org/TR/selectors-4/#selector-list">https://www.w3.org/TR/selectors-4/#selector-list</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-selector-list">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-concept-url"> <a href="https://url.spec.whatwg.org/#concept-url">https://url.spec.whatwg.org/#concept-url</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-concept-url">5.3.3. Parse a stylesheet</a> <li><a href="#ref-for-concept-url①">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[css-cascade-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-at-ruledef-import">@import</span> <li><span class="dfn-paneled" id="term-for-css-property">property</span> </ul> <li> <a data-link-type="biblio">[css-cascade-6]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-cascade">cascade</span> <li><span class="dfn-paneled" id="term-for-important">important</span> </ul> <li> <a data-link-type="biblio">[css-color-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-color"><color></span> <li><span class="dfn-paneled" id="term-for-valdef-color-blue">blue</span> <li><span class="dfn-paneled" id="term-for-propdef-color">color</span> </ul> <li> <a data-link-type="biblio">[css-counter-styles-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-at-ruledef-counter-style">@counter-style</span> <li><span class="dfn-paneled" id="term-for-counter-style">counter style</span> </ul> <li> <a data-link-type="biblio">[css-fonts-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-at-ruledef-font-feature-values">@font-feature-values</span> <li><span class="dfn-paneled" id="term-for-descdef-font-face-unicode-range">unicode-range</span> </ul> <li> <a data-link-type="biblio">[css-fonts-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-at-font-face-rule">@font-face</span> </ul> <li> <a data-link-type="biblio">[CSS-NESTING-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-at-ruledef-nest">@nest</span> <li><span class="dfn-paneled" id="term-for-nested-conditional-group-rules">nested conditional group rules</span> <li><span class="dfn-paneled" id="term-for-nested-style-rule">nested style rule</span> </ul> <li> <a data-link-type="biblio">[css-page-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-valdef-page-left">:left</span> <li><span class="dfn-paneled" id="term-for-at-ruledef-page">@page</span> </ul> <li> <a data-link-type="biblio">[css-text-decor-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-propdef-text-decoration">text-decoration</span> <li><span class="dfn-paneled" id="term-for-valdef-text-decoration-line-underline">underline</span> </ul> <li> <a data-link-type="biblio">[css-transforms-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-funcdef-transform-translatex">translatex()</span> </ul> <li> <a data-link-type="biblio">[css-values-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-funcdef-attr">attr()</span> </ul> <li> <a data-link-type="biblio">[css-values-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-mult-zero-plus">*</span> <li><span class="dfn-paneled" id="term-for-mult-one-plus">+</span> <li><span class="dfn-paneled" id="term-for-typedef-dimension"><dimension></span> <li><span class="dfn-paneled" id="term-for-number-value"><number></span> <li><span class="dfn-paneled" id="term-for-string-value"><string></span> <li><span class="dfn-paneled" id="term-for-mult-opt">?</span> <li><span class="dfn-paneled" id="term-for-funcdef-url">url()</span> <li><span class="dfn-paneled" id="term-for-comb-one">|</span> </ul> <li> <a data-link-type="biblio">[CSS-VARIABLES]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-custom-property">custom property</span> </ul> <li> <a data-link-type="biblio">[CSS3-ANIMATIONS]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-keyframe-selector"><keyframe-selector></span> <li><span class="dfn-paneled" id="term-for-typedef-keyframes-name"><keyframes-name></span> <li><span class="dfn-paneled" id="term-for-at-ruledef-keyframes">@keyframes</span> <li><span class="dfn-paneled" id="term-for-propdef-animation-timing-function">animation-timing-function</span> </ul> <li> <a data-link-type="biblio">[CSS3-CONDITIONAL]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-at-ruledef-media">@media</span> <li><span class="dfn-paneled" id="term-for-at-ruledef-supports">@supports</span> <li><span class="dfn-paneled" id="term-for-conditional-group-rule">conditional group rule</span> </ul> <li> <a data-link-type="biblio">[CSSOM]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-concept-css-style-sheet-location">location</span> </ul> <li> <a data-link-type="biblio">[ENCODING]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-decode">decode</span> <li><span class="dfn-paneled" id="term-for-concept-encoding-get">get an encoding</span> </ul> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-the-a-element">a</span> <li><span class="dfn-paneled" id="term-for-the-p-element">p</span> <li><span class="dfn-paneled" id="term-for-attr-img-sizes">sizes</span> </ul> <li> <a data-link-type="biblio">[INFRA]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-ascii-case-insensitive">ascii case-insensitive</span> <li><span class="dfn-paneled" id="term-for-code-point">code point</span> <li><span class="dfn-paneled" id="term-for-list-extend">extend</span> <li><span class="dfn-paneled" id="term-for-list-iterate">for each</span> <li><span class="dfn-paneled" id="term-for-list">list</span> <li><span class="dfn-paneled" id="term-for-list-remove">remove</span> <li><span class="dfn-paneled" id="term-for-scalar-value">scalar value</span> <li><span class="dfn-paneled" id="term-for-string">string</span> <li><span class="dfn-paneled" id="term-for-surrogate">surrogate</span> </ul> <li> <a data-link-type="biblio">[mediaqueries-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-general-enclosed"><general-enclosed></span> <li><span class="dfn-paneled" id="term-for-typedef-media-query-list"><media-query-list></span> </ul> <li> <a data-link-type="biblio">[selectors-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-selectordef-adjacent">+</span> <li><span class="dfn-paneled" id="term-for-nth-child-pseudo">:nth-child()</span> <li><span class="dfn-paneled" id="term-for-typedef-selector-list"><selector-list></span> <li><span class="dfn-paneled" id="term-for-selector-list">selector list</span> </ul> <li> <a data-link-type="biblio">[URL]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-concept-url">url</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-css-cascade-3">[CSS-CASCADE-3] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-3/"><cite>CSS Cascading and Inheritance Level 3</cite></a>. 11 February 2021. REC. URL: <a href="https://www.w3.org/TR/css-cascade-3/">https://www.w3.org/TR/css-cascade-3/</a> <dt id="biblio-css-cascade-5">[CSS-CASCADE-5] <dd>Elika Etemad; Miriam Suzanne; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-5/"><cite>CSS Cascading and Inheritance Level 5</cite></a>. 3 December 2021. WD. URL: <a href="https://www.w3.org/TR/css-cascade-5/">https://www.w3.org/TR/css-cascade-5/</a> <dt id="biblio-css-cascade-6">[CSS-CASCADE-6] <dd>Elika Etemad; Miriam Suzanne; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-cascade-6/"><cite>CSS Cascading and Inheritance Level 6</cite></a>. 21 December 2021. WD. URL: <a href="https://www.w3.org/TR/css-cascade-6/">https://www.w3.org/TR/css-cascade-6/</a> <dt id="biblio-css-counter-styles-3">[CSS-COUNTER-STYLES-3] <dd>Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-counter-styles-3/"><cite>CSS Counter Styles Level 3</cite></a>. 27 July 2021. CR. URL: <a href="https://www.w3.org/TR/css-counter-styles-3/">https://www.w3.org/TR/css-counter-styles-3/</a> <dt id="biblio-css-page-3">[CSS-PAGE-3] <dd>Elika Etemad; Simon Sapin. <a href="https://www.w3.org/TR/css-page-3/"><cite>CSS Paged Media Module Level 3</cite></a>. 18 October 2018. WD. URL: <a href="https://www.w3.org/TR/css-page-3/">https://www.w3.org/TR/css-page-3/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/"><cite>CSS Values and Units Module Level 4</cite></a>. 16 December 2021. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a> <dt id="biblio-css3-conditional">[CSS3-CONDITIONAL] <dd>David Baron; Elika Etemad; Chris Lilley. <a href="https://www.w3.org/TR/css-conditional-3/"><cite>CSS Conditional Rules Module Level 3</cite></a>. 8 December 2020. CR. URL: <a href="https://www.w3.org/TR/css-conditional-3/">https://www.w3.org/TR/css-conditional-3/</a> <dt id="biblio-cssom">[CSSOM] <dd>Daniel Glazman; Emilio Cobos Álvarez. <a href="https://www.w3.org/TR/cssom-1/"><cite>CSS Object Model (CSSOM)</cite></a>. 26 August 2021. WD. URL: <a href="https://www.w3.org/TR/cssom-1/">https://www.w3.org/TR/cssom-1/</a> <dt id="biblio-encoding">[ENCODING] <dd>Anne van Kesteren. <a href="https://encoding.spec.whatwg.org/"><cite>Encoding Standard</cite></a>. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a> <dt id="biblio-html">[HTML] <dd>Ian Hickson. <a href="https://whatwg.org/html"><cite>HTML</cite></a>. Living Standard. URL: <a href="https://whatwg.org/html">http://whatwg.org/html</a> <dt id="biblio-infra">[INFRA] <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://datatracker.ietf.org/doc/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://datatracker.ietf.org/doc/html/rfc2119">https://datatracker.ietf.org/doc/html/rfc2119</a> <dt id="biblio-selectors-4">[SELECTORS-4] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/selectors-4/"><cite>Selectors Level 4</cite></a>. 21 November 2018. WD. URL: <a href="https://www.w3.org/TR/selectors-4/">https://www.w3.org/TR/selectors-4/</a> <dt id="biblio-url">[URL] <dd>Anne van Kesteren. <a href="https://url.spec.whatwg.org/"><cite>URL Standard</cite></a>. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-css-color-4">[CSS-COLOR-4] <dd>Tab Atkins Jr.; Chris Lilley; Lea Verou. <a href="https://www.w3.org/TR/css-color-4/"><cite>CSS Color Module Level 4</cite></a>. 15 December 2021. WD. URL: <a href="https://www.w3.org/TR/css-color-4/">https://www.w3.org/TR/css-color-4/</a> <dt id="biblio-css-fonts-4">[CSS-FONTS-4] <dd>John Daggett; Myles Maxfield; Chris Lilley. <a href="https://www.w3.org/TR/css-fonts-4/"><cite>CSS Fonts Module Level 4</cite></a>. 21 December 2021. WD. URL: <a href="https://www.w3.org/TR/css-fonts-4/">https://www.w3.org/TR/css-fonts-4/</a> <dt id="biblio-css-fonts-5">[CSS-FONTS-5] <dd>Myles Maxfield; Chris Lilley. <a href="https://www.w3.org/TR/css-fonts-5/"><cite>CSS Fonts Module Level 5</cite></a>. 21 December 2021. WD. URL: <a href="https://www.w3.org/TR/css-fonts-5/">https://www.w3.org/TR/css-fonts-5/</a> <dt id="biblio-css-namespaces-3">[CSS-NAMESPACES-3] <dd>Elika Etemad. <a href="https://www.w3.org/TR/css-namespaces-3/"><cite>CSS Namespaces Module Level 3</cite></a>. 20 March 2014. REC. URL: <a href="https://www.w3.org/TR/css-namespaces-3/">https://www.w3.org/TR/css-namespaces-3/</a> <dt id="biblio-css-nesting-1">[CSS-NESTING-1] <dd>Tab Atkins Jr.; Adam Argyle. <a href="https://www.w3.org/TR/css-nesting-1/"><cite>CSS Nesting Module</cite></a>. 31 August 2021. WD. URL: <a href="https://www.w3.org/TR/css-nesting-1/">https://www.w3.org/TR/css-nesting-1/</a> <dt id="biblio-css-text-decor-3">[CSS-TEXT-DECOR-3] <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-text-decor-3/"><cite>CSS Text Decoration Module Level 3</cite></a>. 13 August 2019. CR. URL: <a href="https://www.w3.org/TR/css-text-decor-3/">https://www.w3.org/TR/css-text-decor-3/</a> <dt id="biblio-css-transforms-1">[CSS-TRANSFORMS-1] <dd>Simon Fraser; et al. <a href="https://www.w3.org/TR/css-transforms-1/"><cite>CSS Transforms Module Level 1</cite></a>. 14 February 2019. CR. URL: <a href="https://www.w3.org/TR/css-transforms-1/">https://www.w3.org/TR/css-transforms-1/</a> <dt id="biblio-css-values-3">[CSS-VALUES-3] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/"><cite>CSS Values and Units Module Level 3</cite></a>. 6 June 2019. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a> <dt id="biblio-css-variables">[CSS-VARIABLES] <dd>Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-variables-1/"><cite>CSS Custom Properties for Cascading Variables Module Level 1</cite></a>. 11 November 2021. CR. URL: <a href="https://www.w3.org/TR/css-variables-1/">https://www.w3.org/TR/css-variables-1/</a> <dt id="biblio-css2">[CSS2] <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS21/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</cite></a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS21/">https://www.w3.org/TR/CSS21/</a> <dt id="biblio-css3-animations">[CSS3-ANIMATIONS] <dd>Dean Jackson; et al. <a href="https://www.w3.org/TR/css-animations-1/"><cite>CSS Animations Level 1</cite></a>. 11 October 2018. WD. URL: <a href="https://www.w3.org/TR/css-animations-1/">https://www.w3.org/TR/css-animations-1/</a> <dt id="biblio-mediaq">[MEDIAQ] <dd>Florian Rivoal; Tab Atkins Jr.. <a href="https://www.w3.org/TR/mediaqueries-4/"><cite>Media Queries Level 4</cite></a>. 21 July 2020. CR. URL: <a href="https://www.w3.org/TR/mediaqueries-4/">https://www.w3.org/TR/mediaqueries-4/</a> <dt id="biblio-mediaqueries-5">[MEDIAQUERIES-5] <dd>Dean Jackson; et al. <a href="https://www.w3.org/TR/mediaqueries-5/"><cite>Media Queries Level 5</cite></a>. 18 December 2021. WD. URL: <a href="https://www.w3.org/TR/mediaqueries-5/">https://www.w3.org/TR/mediaqueries-5/</a> <dt id="biblio-select">[SELECT] <dd>Tantek Çelik; et al. <a href="https://www.w3.org/TR/selectors-3/"><cite>Selectors Level 3</cite></a>. 6 November 2018. REC. URL: <a href="https://www.w3.org/TR/selectors-3/">https://www.w3.org/TR/selectors-3/</a> </dl> <aside class="dfn-panel" data-for="escape-codepoint"> <b><a href="#escape-codepoint">#escape-codepoint</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-escape-codepoint">2. Description of CSS’s Syntax</a> <li><a href="#ref-for-escape-codepoint①">8. Defining Grammars for Rules and Other Values</a> </ul> </aside> <aside class="dfn-panel" data-for="css-invalid"> <b><a href="#css-invalid">#css-invalid</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-invalid">9. CSS stylesheets</a> <li><a href="#ref-for-css-invalid①">9.1. Style rules</a> <a href="#ref-for-css-invalid②">(2)</a> <a href="#ref-for-css-invalid③">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-error"> <b><a href="#parse-error">#parse-error</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-error">4.3.1. Consume a token</a> <li><a href="#ref-for-parse-error①">4.3.2. Consume comments</a> <li><a href="#ref-for-parse-error②">4.3.5. Consume a string token</a> <a href="#ref-for-parse-error③">(2)</a> <li><a href="#ref-for-parse-error④">4.3.6. Consume a url token</a> <a href="#ref-for-parse-error⑤">(2)</a> <a href="#ref-for-parse-error⑥">(3)</a> <a href="#ref-for-parse-error⑦">(4)</a> <li><a href="#ref-for-parse-error⑧">4.3.7. Consume an escaped code point</a> <li><a href="#ref-for-parse-error⑨">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-parse-error①⓪">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-parse-error①①">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-parse-error①②">5.4.5. Consume a list of declarations</a> <li><a href="#ref-for-parse-error①③">5.4.6. Consume a declaration</a> <li><a href="#ref-for-parse-error①④">5.4.8. Consume a simple block</a> <li><a href="#ref-for-parse-error①⑤">5.4.9. Consume a function</a> <li><a href="#ref-for-parse-error①⑥">9. CSS stylesheets</a> </ul> </aside> <aside class="dfn-panel" data-for="css-decode-bytes"> <b><a href="#css-decode-bytes">#css-decode-bytes</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-decode-bytes">5.3.3. Parse a stylesheet</a> </ul> </aside> <aside class="dfn-panel" data-for="determine-the-fallback-encoding"> <b><a href="#determine-the-fallback-encoding">#determine-the-fallback-encoding</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-determine-the-fallback-encoding">3.2. The input byte stream</a> <li><a href="#ref-for-determine-the-fallback-encoding①">9.3. The @charset Rule</a> <li><a href="#ref-for-determine-the-fallback-encoding②">12.3. Changes from the 5 November 2013 Last Call Working Draft</a> </ul> </aside> <aside class="dfn-panel" data-for="environment-encoding"> <b><a href="#environment-encoding">#environment-encoding</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-environment-encoding">3.2. The input byte stream</a> <a href="#ref-for-environment-encoding①">(2)</a> <a href="#ref-for-environment-encoding②">(3)</a> <li><a href="#ref-for-environment-encoding③">12.4. Changes from the 19 September 2013 Working Draft</a> </ul> </aside> <aside class="dfn-panel" data-for="input-stream"> <b><a href="#input-stream">#input-stream</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-input-stream">4.2. Definitions</a> <a href="#ref-for-input-stream①">(2)</a> <a href="#ref-for-input-stream②">(3)</a> <a href="#ref-for-input-stream③">(4)</a> <a href="#ref-for-input-stream④">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="css-filter-code-points"> <b><a href="#css-filter-code-points">#css-filter-code-points</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-filter-code-points">3.3. Preprocessing the input stream</a> <li><a href="#ref-for-css-filter-code-points①">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="css-tokenize"> <b><a href="#css-tokenize">#css-tokenize</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-tokenize">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-ident-token"> <b><a href="#typedef-ident-token">#typedef-ident-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-ident-token">4. Tokenization</a> <li><a href="#ref-for-typedef-ident-token①">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-ident-token②">4.2. Definitions</a> <li><a href="#ref-for-typedef-ident-token③">4.3.4. Consume an ident-like token</a> <a href="#ref-for-typedef-ident-token④">(2)</a> <li><a href="#ref-for-typedef-ident-token⑤">4.3.11. Consume an ident sequence</a> <li><a href="#ref-for-typedef-ident-token⑥">5.3.6. Parse a declaration</a> <li><a href="#ref-for-typedef-ident-token⑦">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-typedef-ident-token⑧">5.4.5. Consume a list of declarations</a> <li><a href="#ref-for-typedef-ident-token⑨">5.4.6. Consume a declaration</a> <a href="#ref-for-typedef-ident-token①⓪">(2)</a> <li><a href="#ref-for-typedef-ident-token①①">6.2. The <an+b> type</a> <a href="#ref-for-typedef-ident-token①②">(2)</a> <li><a href="#ref-for-typedef-ident-token①③">7.1. The <urange> type</a> <a href="#ref-for-typedef-ident-token①④">(2)</a> <li><a href="#ref-for-typedef-ident-token①⑤">8. Defining Grammars for Rules and Other Values</a> <a href="#ref-for-typedef-ident-token①⑥">(2)</a> <li><a href="#ref-for-typedef-ident-token①⑦">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> <li><a href="#ref-for-typedef-ident-token①⑧">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-ident-token①⑨">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-function-token"> <b><a href="#typedef-function-token">#typedef-function-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-function-token">4. Tokenization</a> <li><a href="#ref-for-typedef-function-token①">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-function-token②">4.2. Definitions</a> <li><a href="#ref-for-typedef-function-token③">4.3.4. Consume an ident-like token</a> <a href="#ref-for-typedef-function-token④">(2)</a> <a href="#ref-for-typedef-function-token⑤">(3)</a> <li><a href="#ref-for-typedef-function-token⑥">4.3.6. Consume a url token</a> <li><a href="#ref-for-typedef-function-token⑦">5. Parsing</a> <li><a href="#ref-for-typedef-function-token⑧">5.4.7. Consume a component value</a> <li><a href="#ref-for-typedef-function-token⑨">5.4.9. Consume a function</a> <li><a href="#ref-for-typedef-function-token①⓪">8. Defining Grammars for Rules and Other Values</a> <a href="#ref-for-typedef-function-token①①">(2)</a> <li><a href="#ref-for-typedef-function-token①②">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> <li><a href="#ref-for-typedef-function-token①③">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-at-keyword-token"> <b><a href="#typedef-at-keyword-token">#typedef-at-keyword-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-at-keyword-token">2.2. Error Handling</a> <li><a href="#ref-for-typedef-at-keyword-token①">4. Tokenization</a> <li><a href="#ref-for-typedef-at-keyword-token②">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-at-keyword-token③">4.2. Definitions</a> <li><a href="#ref-for-typedef-at-keyword-token④">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-at-keyword-token⑤">5.3.5. Parse a rule</a> <li><a href="#ref-for-typedef-at-keyword-token⑥">5.4.1. Consume a list of rules</a> <li><a href="#ref-for-typedef-at-keyword-token⑦">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-typedef-at-keyword-token⑧">5.4.5. Consume a list of declarations</a> <li><a href="#ref-for-typedef-at-keyword-token⑨">8. Defining Grammars for Rules and Other Values</a> <a href="#ref-for-typedef-at-keyword-token①⓪">(2)</a> <li><a href="#ref-for-typedef-at-keyword-token①①">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-at-keyword-token①②">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-hash-token"> <b><a href="#typedef-hash-token">#typedef-hash-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-hash-token">4. Tokenization</a> <li><a href="#ref-for-typedef-hash-token①">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-hash-token②">4.2. Definitions</a> <li><a href="#ref-for-typedef-hash-token③">4.3.1. Consume a token</a> <a href="#ref-for-typedef-hash-token④">(2)</a> <a href="#ref-for-typedef-hash-token⑤">(3)</a> <a href="#ref-for-typedef-hash-token⑥">(4)</a> <li><a href="#ref-for-typedef-hash-token⑦">10. Serialization</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-string-token"> <b><a href="#typedef-string-token">#typedef-string-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-string-token">4. Tokenization</a> <li><a href="#ref-for-typedef-string-token①">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-string-token②">4.3.5. Consume a string token</a> <a href="#ref-for-typedef-string-token③">(2)</a> <a href="#ref-for-typedef-string-token④">(3)</a> <a href="#ref-for-typedef-string-token⑤">(4)</a> <a href="#ref-for-typedef-string-token⑥">(5)</a> <a href="#ref-for-typedef-string-token⑦">(6)</a> <li><a href="#ref-for-typedef-string-token⑧">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-bad-string-token"> <b><a href="#typedef-bad-string-token">#typedef-bad-string-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-bad-string-token">4.3.5. Consume a string token</a> <a href="#ref-for-typedef-bad-string-token①">(2)</a> <li><a href="#ref-for-typedef-bad-string-token②">5. Parsing</a> <li><a href="#ref-for-typedef-bad-string-token③">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-url-token"> <b><a href="#typedef-url-token">#typedef-url-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-url-token">4. Tokenization</a> <li><a href="#ref-for-typedef-url-token①">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-url-token②">4.3.4. Consume an ident-like token</a> <li><a href="#ref-for-typedef-url-token③">4.3.6. Consume a url token</a> <a href="#ref-for-typedef-url-token④">(2)</a> <a href="#ref-for-typedef-url-token⑤">(3)</a> <a href="#ref-for-typedef-url-token⑥">(4)</a> <a href="#ref-for-typedef-url-token⑦">(5)</a> <a href="#ref-for-typedef-url-token⑧">(6)</a> <a href="#ref-for-typedef-url-token⑨">(7)</a> <li><a href="#ref-for-typedef-url-token①⓪">4.3.14. Consume the remnants of a bad url</a> <li><a href="#ref-for-typedef-url-token①①">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> <li><a href="#ref-for-typedef-url-token①②">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-url-token①③">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-bad-url-token"> <b><a href="#typedef-bad-url-token">#typedef-bad-url-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-bad-url-token">4.3.4. Consume an ident-like token</a> <li><a href="#ref-for-typedef-bad-url-token①">4.3.6. Consume a url token</a> <a href="#ref-for-typedef-bad-url-token②">(2)</a> <a href="#ref-for-typedef-bad-url-token③">(3)</a> <a href="#ref-for-typedef-bad-url-token④">(4)</a> <li><a href="#ref-for-typedef-bad-url-token⑤">4.3.14. Consume the remnants of a bad url</a> <a href="#ref-for-typedef-bad-url-token⑥">(2)</a> <li><a href="#ref-for-typedef-bad-url-token⑦">5. Parsing</a> <li><a href="#ref-for-typedef-bad-url-token⑧">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> <li><a href="#ref-for-typedef-bad-url-token⑨">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-bad-url-token①⓪">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-delim-token"> <b><a href="#typedef-delim-token">#typedef-delim-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-delim-token">4. Tokenization</a> <li><a href="#ref-for-typedef-delim-token①">4.3.1. Consume a token</a> <a href="#ref-for-typedef-delim-token②">(2)</a> <a href="#ref-for-typedef-delim-token③">(3)</a> <a href="#ref-for-typedef-delim-token④">(4)</a> <a href="#ref-for-typedef-delim-token⑤">(5)</a> <a href="#ref-for-typedef-delim-token⑥">(6)</a> <a href="#ref-for-typedef-delim-token⑦">(7)</a> <a href="#ref-for-typedef-delim-token⑧">(8)</a> <li><a href="#ref-for-typedef-delim-token⑨">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-typedef-delim-token①⓪">5.4.6. Consume a declaration</a> <li><a href="#ref-for-typedef-delim-token①①">8. Defining Grammars for Rules and Other Values</a> <a href="#ref-for-typedef-delim-token①②">(2)</a> <li><a href="#ref-for-typedef-delim-token①③">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> <a href="#ref-for-typedef-delim-token①④">(2)</a> <li><a href="#ref-for-typedef-delim-token①⑤">10. Serialization</a> <a href="#ref-for-typedef-delim-token①⑥">(2)</a> <li><a href="#ref-for-typedef-delim-token①⑦">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> <li><a href="#ref-for-typedef-delim-token①⑧">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-delim-token①⑨">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-number-token"> <b><a href="#typedef-number-token">#typedef-number-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-number-token">4. Tokenization</a> <a href="#ref-for-typedef-number-token①">(2)</a> <li><a href="#ref-for-typedef-number-token②">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-number-token③">4.3.3. Consume a numeric token</a> <a href="#ref-for-typedef-number-token④">(2)</a> <li><a href="#ref-for-typedef-number-token⑤">6.2. The <an+b> type</a> <a href="#ref-for-typedef-number-token⑥">(2)</a> <a href="#ref-for-typedef-number-token⑦">(3)</a> <li><a href="#ref-for-typedef-number-token⑧">7.1. The <urange> type</a> <a href="#ref-for-typedef-number-token⑨">(2)</a> <a href="#ref-for-typedef-number-token①⓪">(3)</a> <a href="#ref-for-typedef-number-token①①">(4)</a> <li><a href="#ref-for-typedef-number-token①②">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-percentage-token"> <b><a href="#typedef-percentage-token">#typedef-percentage-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-percentage-token">4. Tokenization</a> <li><a href="#ref-for-typedef-percentage-token①">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-percentage-token②">4.3.3. Consume a numeric token</a> <a href="#ref-for-typedef-percentage-token③">(2)</a> <li><a href="#ref-for-typedef-percentage-token④">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-dimension-token"> <b><a href="#typedef-dimension-token">#typedef-dimension-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-dimension-token">4. Tokenization</a> <a href="#ref-for-typedef-dimension-token①">(2)</a> <a href="#ref-for-typedef-dimension-token②">(3)</a> <li><a href="#ref-for-typedef-dimension-token③">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-dimension-token④">4.2. Definitions</a> <li><a href="#ref-for-typedef-dimension-token⑤">4.3.3. Consume a numeric token</a> <a href="#ref-for-typedef-dimension-token⑥">(2)</a> <a href="#ref-for-typedef-dimension-token⑦">(3)</a> <a href="#ref-for-typedef-dimension-token⑧">(4)</a> <li><a href="#ref-for-typedef-dimension-token⑨">6.2. The <an+b> type</a> <a href="#ref-for-typedef-dimension-token①⓪">(2)</a> <a href="#ref-for-typedef-dimension-token①①">(3)</a> <li><a href="#ref-for-typedef-dimension-token①②">7.1. The <urange> type</a> <a href="#ref-for-typedef-dimension-token①③">(2)</a> <li><a href="#ref-for-typedef-dimension-token①④">10. Serialization</a> <li><a href="#ref-for-typedef-dimension-token①⑤">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-dimension-token①⑥">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-whitespace-token"> <b><a href="#typedef-whitespace-token">#typedef-whitespace-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-whitespace-token">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-whitespace-token①">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-whitespace-token②">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> <li><a href="#ref-for-typedef-whitespace-token③">5.3.5. Parse a rule</a> <a href="#ref-for-typedef-whitespace-token④">(2)</a> <li><a href="#ref-for-typedef-whitespace-token⑤">5.3.6. Parse a declaration</a> <li><a href="#ref-for-typedef-whitespace-token⑥">5.3.9. Parse a component value</a> <a href="#ref-for-typedef-whitespace-token⑦">(2)</a> <li><a href="#ref-for-typedef-whitespace-token⑧">5.4.1. Consume a list of rules</a> <li><a href="#ref-for-typedef-whitespace-token⑨">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-typedef-whitespace-token①⓪">5.4.5. Consume a list of declarations</a> <li><a href="#ref-for-typedef-whitespace-token①①">5.4.6. Consume a declaration</a> <a href="#ref-for-typedef-whitespace-token①②">(2)</a> <a href="#ref-for-typedef-whitespace-token①③">(3)</a> <a href="#ref-for-typedef-whitespace-token①④">(4)</a> <li><a href="#ref-for-typedef-whitespace-token①⑤">8. Defining Grammars for Rules and Other Values</a> <a href="#ref-for-typedef-whitespace-token①⑥">(2)</a> <li><a href="#ref-for-typedef-whitespace-token①⑦">10. Serialization</a> <a href="#ref-for-typedef-whitespace-token①⑧">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-cdo-token"> <b><a href="#typedef-cdo-token">#typedef-cdo-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-cdo-token">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-cdo-token①">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-cdo-token②">5.3. Parser Entry Points</a> <li><a href="#ref-for-typedef-cdo-token③">5.4.1. Consume a list of rules</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-cdc-token"> <b><a href="#typedef-cdc-token">#typedef-cdc-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-cdc-token">4.1. Token Railroad Diagrams</a> <li><a href="#ref-for-typedef-cdc-token①">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-cdc-token②">5.3. Parser Entry Points</a> <li><a href="#ref-for-typedef-cdc-token③">5.4.1. Consume a list of rules</a> <li><a href="#ref-for-typedef-cdc-token④">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-colon-token"> <b><a href="#typedef-colon-token">#typedef-colon-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-colon-token">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-colon-token①">5.4.6. Consume a declaration</a> <li><a href="#ref-for-typedef-colon-token②">8. Defining Grammars for Rules and Other Values</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-semicolon-token"> <b><a href="#typedef-semicolon-token">#typedef-semicolon-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-semicolon-token">2.2. Error Handling</a> <li><a href="#ref-for-typedef-semicolon-token①">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-semicolon-token②">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-typedef-semicolon-token③">5.4.4. Consume a style block’s contents</a> <a href="#ref-for-typedef-semicolon-token④">(2)</a> <a href="#ref-for-typedef-semicolon-token⑤">(3)</a> <li><a href="#ref-for-typedef-semicolon-token⑥">5.4.5. Consume a list of declarations</a> <a href="#ref-for-typedef-semicolon-token⑦">(2)</a> <a href="#ref-for-typedef-semicolon-token⑧">(3)</a> <li><a href="#ref-for-typedef-semicolon-token⑨">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-typedef-semicolon-token①⓪">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> <a href="#ref-for-typedef-semicolon-token①①">(2)</a> <li><a href="#ref-for-typedef-semicolon-token①②">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-typedef-semicolon-token①③">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-comma-token"> <b><a href="#typedef-comma-token">#typedef-comma-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-comma-token">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-comma-token①">5.3.11. Parse a comma-separated list of component values</a> <a href="#ref-for-typedef-comma-token②">(2)</a> <a href="#ref-for-typedef-comma-token③">(3)</a> <li><a href="#ref-for-typedef-comma-token④">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-typedef-comma-token⑤">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="tokendef-open-square"> <b><a href="#tokendef-open-square">#tokendef-open-square</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-tokendef-open-square">4.3.1. Consume a token</a> <li><a href="#ref-for-tokendef-open-square">5. Parsing</a> <a href="#ref-for-tokendef-open-square">(2)</a> <li><a href="#ref-for-tokendef-open-square">5.4.7. Consume a component value</a> <li><a href="#ref-for-tokendef-open-square">5.4.8. Consume a simple block</a> <a href="#ref-for-tokendef-open-square">(2)</a> <li><a href="#ref-for-tokendef-open-square">8. Defining Grammars for Rules and Other Values</a> </ul> </aside> <aside class="dfn-panel" data-for="tokendef-close-square"> <b><a href="#tokendef-close-square">#tokendef-close-square</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-tokendef-close-square">4.3.1. Consume a token</a> <li><a href="#ref-for-tokendef-close-square">5. Parsing</a> <li><a href="#ref-for-tokendef-close-square">5.4.8. Consume a simple block</a> <li><a href="#ref-for-tokendef-close-square">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-tokendef-close-square">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="tokendef-open-paren"> <b><a href="#tokendef-open-paren">#tokendef-open-paren</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-tokendef-open-paren">4.3.1. Consume a token</a> <li><a href="#ref-for-tokendef-open-paren">5. Parsing</a> <a href="#ref-for-tokendef-open-paren">(2)</a> <li><a href="#ref-for-tokendef-open-paren">5.4.7. Consume a component value</a> <li><a href="#ref-for-tokendef-open-paren">5.4.8. Consume a simple block</a> <li><a href="#ref-for-tokendef-open-paren">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-tokendef-open-paren">10. Serialization</a> </ul> </aside> <aside class="dfn-panel" data-for="tokendef-close-paren"> <b><a href="#tokendef-close-paren">#tokendef-close-paren</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-tokendef-close-paren">4.3.1. Consume a token</a> <li><a href="#ref-for-tokendef-close-paren">5. Parsing</a> <li><a href="#ref-for-tokendef-close-paren">5.4.9. Consume a function</a> <li><a href="#ref-for-tokendef-close-paren">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-tokendef-close-paren">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="tokendef-open-curly"> <b><a href="#tokendef-open-curly">#tokendef-open-curly</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-tokendef-open-curly">2.2. Error Handling</a> <li><a href="#ref-for-tokendef-open-curly">4.3.1. Consume a token</a> <li><a href="#ref-for-tokendef-open-curly">5. Parsing</a> <a href="#ref-for-tokendef-open-curly">(2)</a> <li><a href="#ref-for-tokendef-open-curly">5.4.2. Consume an at-rule</a> <a href="#ref-for-tokendef-open-curly">(2)</a> <li><a href="#ref-for-tokendef-open-curly">5.4.3. Consume a qualified rule</a> <a href="#ref-for-tokendef-open-curly">(2)</a> <li><a href="#ref-for-tokendef-open-curly">5.4.7. Consume a component value</a> <li><a href="#ref-for-tokendef-open-curly">5.4.8. Consume a simple block</a> <li><a href="#ref-for-tokendef-open-curly">8. Defining Grammars for Rules and Other Values</a> </ul> </aside> <aside class="dfn-panel" data-for="tokendef-close-curly"> <b><a href="#tokendef-close-curly">#tokendef-close-curly</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-tokendef-close-curly">2.2. Error Handling</a> <li><a href="#ref-for-tokendef-close-curly">4.3.1. Consume a token</a> <li><a href="#ref-for-tokendef-close-curly">5. Parsing</a> <li><a href="#ref-for-tokendef-close-curly">8. Defining Grammars for Rules and Other Values</a> <li><a href="#ref-for-tokendef-close-curly">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> <li><a href="#ref-for-tokendef-close-curly">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="next-input-code-point"> <b><a href="#next-input-code-point">#next-input-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-next-input-code-point">4.2. Definitions</a> <a href="#ref-for-next-input-code-point①">(2)</a> <li><a href="#ref-for-next-input-code-point②">4.3.1. Consume a token</a> <a href="#ref-for-next-input-code-point③">(2)</a> <a href="#ref-for-next-input-code-point④">(3)</a> <a href="#ref-for-next-input-code-point⑤">(4)</a> <a href="#ref-for-next-input-code-point⑥">(5)</a> <a href="#ref-for-next-input-code-point⑦">(6)</a> <a href="#ref-for-next-input-code-point⑧">(7)</a> <li><a href="#ref-for-next-input-code-point⑨">4.3.2. Consume comments</a> <li><a href="#ref-for-next-input-code-point①⓪">4.3.3. Consume a numeric token</a> <a href="#ref-for-next-input-code-point①①">(2)</a> <li><a href="#ref-for-next-input-code-point①②">4.3.4. Consume an ident-like token</a> <a href="#ref-for-next-input-code-point①③">(2)</a> <a href="#ref-for-next-input-code-point①④">(3)</a> <a href="#ref-for-next-input-code-point①⑤">(4)</a> <a href="#ref-for-next-input-code-point①⑥">(5)</a> <li><a href="#ref-for-next-input-code-point①⑦">4.3.5. Consume a string token</a> <a href="#ref-for-next-input-code-point①⑧">(2)</a> <a href="#ref-for-next-input-code-point①⑨">(3)</a> <li><a href="#ref-for-next-input-code-point②⓪">4.3.6. Consume a url token</a> <a href="#ref-for-next-input-code-point②①">(2)</a> <li><a href="#ref-for-next-input-code-point②②">4.3.7. Consume an escaped code point</a> <a href="#ref-for-next-input-code-point②③">(2)</a> <li><a href="#ref-for-next-input-code-point②④">4.3.8. Check if two code points are a valid escape</a> <li><a href="#ref-for-next-input-code-point②⑤">4.3.9. Check if three code points would start an ident sequence</a> <li><a href="#ref-for-next-input-code-point②⑥">4.3.10. Check if three code points would start a number</a> <li><a href="#ref-for-next-input-code-point②⑦">4.3.11. Consume an ident sequence</a> <li><a href="#ref-for-next-input-code-point②⑧">4.3.12. Consume a number</a> <a href="#ref-for-next-input-code-point②⑨">(2)</a> <a href="#ref-for-next-input-code-point③⓪">(3)</a> <a href="#ref-for-next-input-code-point③①">(4)</a> <a href="#ref-for-next-input-code-point③②">(5)</a> <a href="#ref-for-next-input-code-point③③">(6)</a> <li><a href="#ref-for-next-input-code-point③④">4.3.14. Consume the remnants of a bad url</a> </ul> </aside> <aside class="dfn-panel" data-for="current-input-code-point"> <b><a href="#current-input-code-point">#current-input-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-current-input-code-point">4.2. Definitions</a> <a href="#ref-for-current-input-code-point①">(2)</a> <li><a href="#ref-for-current-input-code-point②">4.3.1. Consume a token</a> <a href="#ref-for-current-input-code-point③">(2)</a> <a href="#ref-for-current-input-code-point④">(3)</a> <a href="#ref-for-current-input-code-point⑤">(4)</a> <a href="#ref-for-current-input-code-point⑥">(5)</a> <a href="#ref-for-current-input-code-point⑦">(6)</a> <a href="#ref-for-current-input-code-point⑧">(7)</a> <a href="#ref-for-current-input-code-point⑨">(8)</a> <li><a href="#ref-for-current-input-code-point①⓪">4.3.5. Consume a string token</a> <a href="#ref-for-current-input-code-point①①">(2)</a> <li><a href="#ref-for-current-input-code-point①②">4.3.6. Consume a url token</a> <li><a href="#ref-for-current-input-code-point①③">4.3.7. Consume an escaped code point</a> <li><a href="#ref-for-current-input-code-point①④">4.3.8. Check if two code points are a valid escape</a> <li><a href="#ref-for-current-input-code-point①⑤">4.3.9. Check if three code points would start an ident sequence</a> <li><a href="#ref-for-current-input-code-point①⑥">4.3.10. Check if three code points would start a number</a> </ul> </aside> <aside class="dfn-panel" data-for="reconsume-the-current-input-code-point"> <b><a href="#reconsume-the-current-input-code-point">#reconsume-the-current-input-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-reconsume-the-current-input-code-point">4.3.1. Consume a token</a> <a href="#ref-for-reconsume-the-current-input-code-point①">(2)</a> <a href="#ref-for-reconsume-the-current-input-code-point②">(3)</a> <a href="#ref-for-reconsume-the-current-input-code-point③">(4)</a> <a href="#ref-for-reconsume-the-current-input-code-point④">(5)</a> <a href="#ref-for-reconsume-the-current-input-code-point⑤">(6)</a> <a href="#ref-for-reconsume-the-current-input-code-point⑥">(7)</a> <li><a href="#ref-for-reconsume-the-current-input-code-point⑦">4.3.5. Consume a string token</a> <li><a href="#ref-for-reconsume-the-current-input-code-point⑧">4.3.11. Consume an ident sequence</a> </ul> </aside> <aside class="dfn-panel" data-for="digit"> <b><a href="#digit">#digit</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-digit">4.2. Definitions</a> <a href="#ref-for-digit①">(2)</a> <li><a href="#ref-for-digit②">4.3.1. Consume a token</a> <li><a href="#ref-for-digit③">4.3.10. Check if three code points would start a number</a> <a href="#ref-for-digit④">(2)</a> <a href="#ref-for-digit⑤">(3)</a> <a href="#ref-for-digit⑥">(4)</a> <li><a href="#ref-for-digit⑦">4.3.12. Consume a number</a> <a href="#ref-for-digit⑧">(2)</a> <a href="#ref-for-digit⑨">(3)</a> <a href="#ref-for-digit①⓪">(4)</a> <a href="#ref-for-digit①①">(5)</a> <li><a href="#ref-for-digit①②">4.3.13. Convert a string to a number</a> <a href="#ref-for-digit①③">(2)</a> <a href="#ref-for-digit①④">(3)</a> <li><a href="#ref-for-digit①⑤">6.2. The <an+b> type</a> <a href="#ref-for-digit①⑥">(2)</a> <a href="#ref-for-digit①⑦">(3)</a> <a href="#ref-for-digit①⑧">(4)</a> </ul> </aside> <aside class="dfn-panel" data-for="hex-digit"> <b><a href="#hex-digit">#hex-digit</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-hex-digit">2.1. Escaping</a> <a href="#ref-for-hex-digit①">(2)</a> <li><a href="#ref-for-hex-digit②">4.3.7. Consume an escaped code point</a> <a href="#ref-for-hex-digit③">(2)</a> <a href="#ref-for-hex-digit④">(3)</a> <li><a href="#ref-for-hex-digit⑤">7. The Unicode-Range microsyntax</a> <li><a href="#ref-for-hex-digit⑥">7.1. The <urange> type</a> <a href="#ref-for-hex-digit⑦">(2)</a> <a href="#ref-for-hex-digit⑧">(3)</a> <a href="#ref-for-hex-digit⑨">(4)</a> </ul> </aside> <aside class="dfn-panel" data-for="uppercase-letter"> <b><a href="#uppercase-letter">#uppercase-letter</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-uppercase-letter">4.2. Definitions</a> </ul> </aside> <aside class="dfn-panel" data-for="lowercase-letter"> <b><a href="#lowercase-letter">#lowercase-letter</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-lowercase-letter">4.2. Definitions</a> </ul> </aside> <aside class="dfn-panel" data-for="letter"> <b><a href="#letter">#letter</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-letter">4.2. Definitions</a> </ul> </aside> <aside class="dfn-panel" data-for="non-ascii-code-point"> <b><a href="#non-ascii-code-point">#non-ascii-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-non-ascii-code-point">4.2. Definitions</a> <li><a href="#ref-for-non-ascii-code-point①">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-non-ascii-code-point②">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="ident-start-code-point"> <b><a href="#ident-start-code-point">#ident-start-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-ident-start-code-point">2. Description of CSS’s Syntax</a> <li><a href="#ref-for-ident-start-code-point①">4.2. Definitions</a> <li><a href="#ref-for-ident-start-code-point②">4.3.1. Consume a token</a> <li><a href="#ref-for-ident-start-code-point③">4.3.9. Check if three code points would start an ident sequence</a> <a href="#ref-for-ident-start-code-point④">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="ident-code-point"> <b><a href="#ident-code-point">#ident-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-ident-code-point">2. Description of CSS’s Syntax</a> <li><a href="#ref-for-ident-code-point①">4.3.1. Consume a token</a> <li><a href="#ref-for-ident-code-point②">4.3.11. Consume an ident sequence</a> <li><a href="#ref-for-ident-code-point③">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="non-printable-code-point"> <b><a href="#non-printable-code-point">#non-printable-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-non-printable-code-point">4.3.6. Consume a url token</a> </ul> </aside> <aside class="dfn-panel" data-for="newline"> <b><a href="#newline">#newline</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-newline">2.1. Escaping</a> <li><a href="#ref-for-newline①">4.2. Definitions</a> <li><a href="#ref-for-newline②">4.3.5. Consume a string token</a> <li><a href="#ref-for-newline③">4.3.8. Check if two code points are a valid escape</a> <li><a href="#ref-for-newline④">10. Serialization</a> </ul> </aside> <aside class="dfn-panel" data-for="whitespace"> <b><a href="#whitespace">#whitespace</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-whitespace">2.1. Escaping</a> <li><a href="#ref-for-whitespace①">4.3.1. Consume a token</a> <a href="#ref-for-whitespace②">(2)</a> <li><a href="#ref-for-whitespace③">4.3.4. Consume an ident-like token</a> <a href="#ref-for-whitespace④">(2)</a> <li><a href="#ref-for-whitespace⑤">4.3.6. Consume a url token</a> <a href="#ref-for-whitespace⑥">(2)</a> <a href="#ref-for-whitespace⑦">(3)</a> <li><a href="#ref-for-whitespace⑧">4.3.7. Consume an escaped code point</a> </ul> </aside> <aside class="dfn-panel" data-for="maximum-allowed-code-point"> <b><a href="#maximum-allowed-code-point">#maximum-allowed-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-maximum-allowed-code-point">4.3.7. Consume an escaped code point</a> <li><a href="#ref-for-maximum-allowed-code-point①">7.1. The <urange> type</a> </ul> </aside> <aside class="dfn-panel" data-for="ident-sequence"> <b><a href="#ident-sequence">#ident-sequence</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-ident-sequence">2. Description of CSS’s Syntax</a> <li><a href="#ref-for-ident-sequence①">2.1. Escaping</a> <a href="#ref-for-ident-sequence②">(2)</a> <li><a href="#ref-for-ident-sequence③">4.2. Definitions</a> <li><a href="#ref-for-ident-sequence④">4.3.9. Check if three code points would start an ident sequence</a> <li><a href="#ref-for-ident-sequence⑤">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="representation"> <b><a href="#representation">#representation</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-representation">4.2. Definitions</a> <a href="#ref-for-representation①">(2)</a> <a href="#ref-for-representation②">(3)</a> <li><a href="#ref-for-representation③">6.2. The <an+b> type</a> <a href="#ref-for-representation④">(2)</a> <li><a href="#ref-for-representation⑤">7.1. The <urange> type</a> <li><a href="#ref-for-representation⑥">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-token"> <b><a href="#consume-a-token">#consume-a-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-token">4. Tokenization</a> <a href="#ref-for-consume-a-token①">(2)</a> <li><a href="#ref-for-consume-a-token②">4.2. Definitions</a> <li><a href="#ref-for-consume-a-token③">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-comments"> <b><a href="#consume-comments">#consume-comments</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-comments">4.3.1. Consume a token</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-numeric-token"> <b><a href="#consume-a-numeric-token">#consume-a-numeric-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-numeric-token">4.3.1. Consume a token</a> <a href="#ref-for-consume-a-numeric-token①">(2)</a> <a href="#ref-for-consume-a-numeric-token②">(3)</a> <a href="#ref-for-consume-a-numeric-token③">(4)</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-an-ident-like-token"> <b><a href="#consume-an-ident-like-token">#consume-an-ident-like-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-an-ident-like-token">4.3.1. Consume a token</a> <a href="#ref-for-consume-an-ident-like-token①">(2)</a> <a href="#ref-for-consume-an-ident-like-token②">(3)</a> <li><a href="#ref-for-consume-an-ident-like-token③">4.3.6. Consume a url token</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-string-token"> <b><a href="#consume-a-string-token">#consume-a-string-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-string-token">4.3.1. Consume a token</a> <a href="#ref-for-consume-a-string-token①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-url-token"> <b><a href="#consume-a-url-token">#consume-a-url-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-url-token">4.3.4. Consume an ident-like token</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-an-escaped-code-point"> <b><a href="#consume-an-escaped-code-point">#consume-an-escaped-code-point</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-an-escaped-code-point">4.3.5. Consume a string token</a> <li><a href="#ref-for-consume-an-escaped-code-point①">4.3.6. Consume a url token</a> <li><a href="#ref-for-consume-an-escaped-code-point②">4.3.11. Consume an ident sequence</a> <li><a href="#ref-for-consume-an-escaped-code-point③">4.3.14. Consume the remnants of a bad url</a> </ul> </aside> <aside class="dfn-panel" data-for="check-if-two-code-points-are-a-valid-escape"> <b><a href="#check-if-two-code-points-are-a-valid-escape">#check-if-two-code-points-are-a-valid-escape</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape">4.3.1. Consume a token</a> <a href="#ref-for-check-if-two-code-points-are-a-valid-escape①">(2)</a> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape②">4.3.5. Consume a string token</a> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape③">4.3.6. Consume a url token</a> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape④">4.3.9. Check if three code points would start an ident sequence</a> <a href="#ref-for-check-if-two-code-points-are-a-valid-escape⑤">(2)</a> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape⑥">4.3.11. Consume an ident sequence</a> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape⑦">4.3.14. Consume the remnants of a bad url</a> <li><a href="#ref-for-check-if-two-code-points-are-a-valid-escape⑧">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="check-if-three-code-points-would-start-an-ident-sequence"> <b><a href="#check-if-three-code-points-would-start-an-ident-sequence">#check-if-three-code-points-would-start-an-ident-sequence</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-check-if-three-code-points-would-start-an-ident-sequence">4.3.1. Consume a token</a> <a href="#ref-for-check-if-three-code-points-would-start-an-ident-sequence①">(2)</a> <a href="#ref-for-check-if-three-code-points-would-start-an-ident-sequence②">(3)</a> <li><a href="#ref-for-check-if-three-code-points-would-start-an-ident-sequence③">4.3.3. Consume a numeric token</a> <li><a href="#ref-for-check-if-three-code-points-would-start-an-ident-sequence④">4.3.11. Consume an ident sequence</a> </ul> </aside> <aside class="dfn-panel" data-for="check-if-three-code-points-would-start-a-number"> <b><a href="#check-if-three-code-points-would-start-a-number">#check-if-three-code-points-would-start-a-number</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-check-if-three-code-points-would-start-a-number">4.3.1. Consume a token</a> <a href="#ref-for-check-if-three-code-points-would-start-a-number①">(2)</a> <a href="#ref-for-check-if-three-code-points-would-start-a-number②">(3)</a> <li><a href="#ref-for-check-if-three-code-points-would-start-a-number③">4.3.12. Consume a number</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-an-ident-sequence"> <b><a href="#consume-an-ident-sequence">#consume-an-ident-sequence</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-an-ident-sequence">4.3.1. Consume a token</a> <a href="#ref-for-consume-an-ident-sequence①">(2)</a> <li><a href="#ref-for-consume-an-ident-sequence②">4.3.3. Consume a numeric token</a> <li><a href="#ref-for-consume-an-ident-sequence③">4.3.4. Consume an ident-like token</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-number"> <b><a href="#consume-a-number">#consume-a-number</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-number">4.3.3. Consume a numeric token</a> </ul> </aside> <aside class="dfn-panel" data-for="convert-a-string-to-a-number"> <b><a href="#convert-a-string-to-a-number">#convert-a-string-to-a-number</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-convert-a-string-to-a-number">4.3.12. Consume a number</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-the-remnants-of-a-bad-url"> <b><a href="#consume-the-remnants-of-a-bad-url">#consume-the-remnants-of-a-bad-url</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-the-remnants-of-a-bad-url">4.3.6. Consume a url token</a> <a href="#ref-for-consume-the-remnants-of-a-bad-url①">(2)</a> <a href="#ref-for-consume-the-remnants-of-a-bad-url②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="qualified-rule"> <b><a href="#qualified-rule">#qualified-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-qualified-rule">2. Description of CSS’s Syntax</a> <a href="#ref-for-qualified-rule①">(2)</a> <a href="#ref-for-qualified-rule②">(3)</a> <a href="#ref-for-qualified-rule③">(4)</a> <li><a href="#ref-for-qualified-rule④">5. Parsing</a> <li><a href="#ref-for-qualified-rule⑤">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <li><a href="#ref-for-qualified-rule⑥">9. CSS stylesheets</a> <li><a href="#ref-for-qualified-rule⑦">9.1. Style rules</a> <a href="#ref-for-qualified-rule⑧">(2)</a> <li><a href="#ref-for-qualified-rule⑨">9.2. At-rules</a> <a href="#ref-for-qualified-rule①⓪">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="declaration"> <b><a href="#declaration">#declaration</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-declaration">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <li><a href="#ref-for-declaration①">9.2. At-rules</a> <li><a href="#ref-for-declaration②">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="css-property-declarations"> <b><a href="#css-property-declarations">#css-property-declarations</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-property-declarations">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="css-descriptor-declarations"> <b><a href="#css-descriptor-declarations">#css-descriptor-declarations</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-descriptor-declarations">9.2. At-rules</a> <li><a href="#ref-for-css-descriptor-declarations①">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="component-value"> <b><a href="#component-value">#component-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-component-value">5.2. Definitions</a> <a href="#ref-for-component-value①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="preserved-tokens"> <b><a href="#preserved-tokens">#preserved-tokens</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-preserved-tokens">5. Parsing</a> <a href="#ref-for-preserved-tokens①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="function"> <b><a href="#function">#function</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-function">5. Parsing</a> <li><a href="#ref-for-function①">5.4. Parser Algorithms</a> </ul> </aside> <aside class="dfn-panel" data-for="simple-block"> <b><a href="#simple-block">#simple-block</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-simple-block">5. Parsing</a> <a href="#ref-for-simple-block①">(2)</a> <li><a href="#ref-for-simple-block②">5.4. Parser Algorithms</a> <li><a href="#ref-for-simple-block③">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-simple-block④">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-simple-block⑤">5.4.8. Consume a simple block</a> </ul> </aside> <aside class="dfn-panel" data-for="curly-block"> <b><a href="#curly-block">#curly-block</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-curly-block">5. Parsing</a> <li><a href="#ref-for-curly-block①">9.2. At-rules</a> </ul> </aside> <aside class="dfn-panel" data-for="square-block"> <b><a href="#square-block">#square-block</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-square-block">5. Parsing</a> </ul> </aside> <aside class="dfn-panel" data-for="paren-block"> <b><a href="#paren-block">#paren-block</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-paren-block">5. Parsing</a> </ul> </aside> <aside class="dfn-panel" data-for="current-input-token"> <b><a href="#current-input-token">#current-input-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-current-input-token">5.2. Definitions</a> <a href="#ref-for-current-input-token①">(2)</a> <a href="#ref-for-current-input-token②">(3)</a> <a href="#ref-for-current-input-token③">(4)</a> <li><a href="#ref-for-current-input-token④">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-current-input-token⑤">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-current-input-token⑥">5.4.5. Consume a list of declarations</a> <li><a href="#ref-for-current-input-token⑦">5.4.6. Consume a declaration</a> <li><a href="#ref-for-current-input-token⑧">5.4.7. Consume a component value</a> <a href="#ref-for-current-input-token⑨">(2)</a> <a href="#ref-for-current-input-token①⓪">(3)</a> <li><a href="#ref-for-current-input-token①①">5.4.8. Consume a simple block</a> <a href="#ref-for-current-input-token①②">(2)</a> <a href="#ref-for-current-input-token①③">(3)</a> <li><a href="#ref-for-current-input-token①④">5.4.9. Consume a function</a> <a href="#ref-for-current-input-token①⑤">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="next-input-token"> <b><a href="#next-input-token">#next-input-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-next-input-token">5.2. Definitions</a> <a href="#ref-for-next-input-token①">(2)</a> <a href="#ref-for-next-input-token②">(3)</a> <a href="#ref-for-next-input-token③">(4)</a> <li><a href="#ref-for-next-input-token④">5.3.5. Parse a rule</a> <a href="#ref-for-next-input-token⑤">(2)</a> <a href="#ref-for-next-input-token⑥">(3)</a> <a href="#ref-for-next-input-token⑦">(4)</a> <a href="#ref-for-next-input-token⑧">(5)</a> <li><a href="#ref-for-next-input-token⑨">5.3.6. Parse a declaration</a> <a href="#ref-for-next-input-token①⓪">(2)</a> <li><a href="#ref-for-next-input-token①①">5.3.9. Parse a component value</a> <a href="#ref-for-next-input-token①②">(2)</a> <a href="#ref-for-next-input-token①③">(3)</a> <a href="#ref-for-next-input-token①④">(4)</a> <li><a href="#ref-for-next-input-token①⑤">5.4.1. Consume a list of rules</a> <li><a href="#ref-for-next-input-token①⑥">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-next-input-token①⑦">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-next-input-token①⑧">5.4.4. Consume a style block’s contents</a> <a href="#ref-for-next-input-token①⑨">(2)</a> <a href="#ref-for-next-input-token②⓪">(3)</a> <li><a href="#ref-for-next-input-token②①">5.4.5. Consume a list of declarations</a> <a href="#ref-for-next-input-token②②">(2)</a> <a href="#ref-for-next-input-token②③">(3)</a> <li><a href="#ref-for-next-input-token②④">5.4.6. Consume a declaration</a> <a href="#ref-for-next-input-token②⑤">(2)</a> <a href="#ref-for-next-input-token②⑥">(3)</a> <a href="#ref-for-next-input-token②⑦">(4)</a> <a href="#ref-for-next-input-token②⑧">(5)</a> <li><a href="#ref-for-next-input-token②⑨">5.4.8. Consume a simple block</a> <li><a href="#ref-for-next-input-token③⓪">5.4.9. Consume a function</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-eof-token"> <b><a href="#typedef-eof-token">#typedef-eof-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-eof-token">4. Tokenization</a> <li><a href="#ref-for-typedef-eof-token①">4.3.1. Consume a token</a> <li><a href="#ref-for-typedef-eof-token②">5.2. Definitions</a> <a href="#ref-for-typedef-eof-token③">(2)</a> <a href="#ref-for-typedef-eof-token④">(3)</a> <li><a href="#ref-for-typedef-eof-token⑤">5.3.5. Parse a rule</a> <a href="#ref-for-typedef-eof-token⑥">(2)</a> <li><a href="#ref-for-typedef-eof-token⑦">5.3.9. Parse a component value</a> <a href="#ref-for-typedef-eof-token⑧">(2)</a> <li><a href="#ref-for-typedef-eof-token⑨">5.3.10. Parse a list of component values</a> <a href="#ref-for-typedef-eof-token①⓪">(2)</a> <li><a href="#ref-for-typedef-eof-token①①">5.3.11. Parse a comma-separated list of component values</a> <a href="#ref-for-typedef-eof-token①②">(2)</a> <li><a href="#ref-for-typedef-eof-token①③">5.4. Parser Algorithms</a> <a href="#ref-for-typedef-eof-token①④">(2)</a> <li><a href="#ref-for-typedef-eof-token①⑤">5.4.1. Consume a list of rules</a> <li><a href="#ref-for-typedef-eof-token①⑥">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-typedef-eof-token①⑦">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-typedef-eof-token①⑧">5.4.4. Consume a style block’s contents</a> <a href="#ref-for-typedef-eof-token①⑨">(2)</a> <a href="#ref-for-typedef-eof-token②⓪">(3)</a> <li><a href="#ref-for-typedef-eof-token②①">5.4.5. Consume a list of declarations</a> <a href="#ref-for-typedef-eof-token②②">(2)</a> <a href="#ref-for-typedef-eof-token②③">(3)</a> <li><a href="#ref-for-typedef-eof-token②④">5.4.6. Consume a declaration</a> <li><a href="#ref-for-typedef-eof-token②⑤">5.4.8. Consume a simple block</a> <li><a href="#ref-for-typedef-eof-token②⑥">5.4.9. Consume a function</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-the-next-input-token"> <b><a href="#consume-the-next-input-token">#consume-the-next-input-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-the-next-input-token">5.2. Definitions</a> <li><a href="#ref-for-consume-the-next-input-token①">5.3.5. Parse a rule</a> <a href="#ref-for-consume-the-next-input-token②">(2)</a> <li><a href="#ref-for-consume-the-next-input-token③">5.3.6. Parse a declaration</a> <li><a href="#ref-for-consume-the-next-input-token④">5.3.9. Parse a component value</a> <a href="#ref-for-consume-the-next-input-token⑤">(2)</a> <li><a href="#ref-for-consume-the-next-input-token⑥">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-consume-the-next-input-token⑦">5.4.6. Consume a declaration</a> <a href="#ref-for-consume-the-next-input-token⑧">(2)</a> <a href="#ref-for-consume-the-next-input-token⑨">(3)</a> <a href="#ref-for-consume-the-next-input-token①⓪">(4)</a> <li><a href="#ref-for-consume-the-next-input-token①①">5.4.7. Consume a component value</a> </ul> </aside> <aside class="dfn-panel" data-for="reconsume-the-current-input-token"> <b><a href="#reconsume-the-current-input-token">#reconsume-the-current-input-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-reconsume-the-current-input-token">5.4.1. Consume a list of rules</a> <a href="#ref-for-reconsume-the-current-input-token①">(2)</a> <a href="#ref-for-reconsume-the-current-input-token②">(3)</a> <li><a href="#ref-for-reconsume-the-current-input-token③">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-reconsume-the-current-input-token④">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-reconsume-the-current-input-token⑤">5.4.4. Consume a style block’s contents</a> <a href="#ref-for-reconsume-the-current-input-token⑥">(2)</a> <a href="#ref-for-reconsume-the-current-input-token⑦">(3)</a> <li><a href="#ref-for-reconsume-the-current-input-token⑧">5.4.5. Consume a list of declarations</a> <a href="#ref-for-reconsume-the-current-input-token⑨">(2)</a> <li><a href="#ref-for-reconsume-the-current-input-token①⓪">5.4.8. Consume a simple block</a> <li><a href="#ref-for-reconsume-the-current-input-token①①">5.4.9. Consume a function</a> </ul> </aside> <aside class="dfn-panel" data-for="normalize-into-a-token-stream"> <b><a href="#normalize-into-a-token-stream">#normalize-into-a-token-stream</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-normalize-into-a-token-stream">5.3.1. Parse something according to a CSS grammar</a> <li><a href="#ref-for-normalize-into-a-token-stream①">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> <li><a href="#ref-for-normalize-into-a-token-stream②">5.3.3. Parse a stylesheet</a> <li><a href="#ref-for-normalize-into-a-token-stream③">5.3.4. Parse a list of rules</a> <li><a href="#ref-for-normalize-into-a-token-stream④">5.3.5. Parse a rule</a> <li><a href="#ref-for-normalize-into-a-token-stream⑤">5.3.6. Parse a declaration</a> <li><a href="#ref-for-normalize-into-a-token-stream⑥">5.3.7. Parse a style block’s contents</a> <li><a href="#ref-for-normalize-into-a-token-stream⑦">5.3.8. Parse a list of declarations</a> <li><a href="#ref-for-normalize-into-a-token-stream⑧">5.3.9. Parse a component value</a> <li><a href="#ref-for-normalize-into-a-token-stream⑨">5.3.10. Parse a list of component values</a> <li><a href="#ref-for-normalize-into-a-token-stream①⓪">5.3.11. Parse a comma-separated list of component values</a> </ul> </aside> <aside class="dfn-panel" data-for="css-parse-something-according-to-a-css-grammar"> <b><a href="#css-parse-something-according-to-a-css-grammar">#css-parse-something-according-to-a-css-grammar</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-parse-something-according-to-a-css-grammar">5.3.1. Parse something according to a CSS grammar</a> <li><a href="#ref-for-css-parse-something-according-to-a-css-grammar①">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> <a href="#ref-for-css-parse-something-according-to-a-css-grammar②">(2)</a> <a href="#ref-for-css-parse-something-according-to-a-css-grammar③">(3)</a> <li><a href="#ref-for-css-parse-something-according-to-a-css-grammar④">9.1. Style rules</a> <li><a href="#ref-for-css-parse-something-according-to-a-css-grammar⑤">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="css-parse-a-comma-separated-list-according-to-a-css-grammar"> <b><a href="#css-parse-a-comma-separated-list-according-to-a-css-grammar">#css-parse-a-comma-separated-list-according-to-a-css-grammar</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-parse-a-comma-separated-list-according-to-a-css-grammar">5.3.1. Parse something according to a CSS grammar</a> <li><a href="#ref-for-css-parse-a-comma-separated-list-according-to-a-css-grammar①">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-stylesheet"> <b><a href="#parse-a-stylesheet">#parse-a-stylesheet</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-stylesheet">5.3. Parser Entry Points</a> <a href="#ref-for-parse-a-stylesheet①">(2)</a> <li><a href="#ref-for-parse-a-stylesheet②">9. CSS stylesheets</a> <li><a href="#ref-for-parse-a-stylesheet③">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> <a href="#ref-for-parse-a-stylesheet④">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-list-of-rules"> <b><a href="#parse-a-list-of-rules">#parse-a-list-of-rules</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-list-of-rules">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-rule"> <b><a href="#parse-a-rule">#parse-a-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-rule">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-declaration"> <b><a href="#parse-a-declaration">#parse-a-declaration</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-declaration">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-style-blocks-contents"> <b><a href="#parse-a-style-blocks-contents">#parse-a-style-blocks-contents</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-style-blocks-contents">5.3.8. Parse a list of declarations</a> <li><a href="#ref-for-parse-a-style-blocks-contents①">9.1. Style rules</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-list-of-declarations"> <b><a href="#parse-a-list-of-declarations">#parse-a-list-of-declarations</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-list-of-declarations">5. Parsing</a> <li><a href="#ref-for-parse-a-list-of-declarations①">5.3. Parser Entry Points</a> <li><a href="#ref-for-parse-a-list-of-declarations②">5.3.6. Parse a declaration</a> <li><a href="#ref-for-parse-a-list-of-declarations③">5.3.7. Parse a style block’s contents</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-component-value"> <b><a href="#parse-a-component-value">#parse-a-component-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-component-value">5.3. Parser Entry Points</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-list-of-component-values"> <b><a href="#parse-a-list-of-component-values">#parse-a-list-of-component-values</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-list-of-component-values">5.3. Parser Entry Points</a> <li><a href="#ref-for-parse-a-list-of-component-values①">5.3.1. Parse something according to a CSS grammar</a> </ul> </aside> <aside class="dfn-panel" data-for="parse-a-comma-separated-list-of-component-values"> <b><a href="#parse-a-comma-separated-list-of-component-values">#parse-a-comma-separated-list-of-component-values</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-parse-a-comma-separated-list-of-component-values">5.3.2. Parse A Comma-Separated List According To A CSS Grammar</a> <li><a href="#ref-for-parse-a-comma-separated-list-of-component-values①">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-list-of-rules"> <b><a href="#consume-a-list-of-rules">#consume-a-list-of-rules</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-list-of-rules">5.3.3. Parse a stylesheet</a> <li><a href="#ref-for-consume-a-list-of-rules①">5.3.4. Parse a list of rules</a> <li><a href="#ref-for-consume-a-list-of-rules②">5.4.8. Consume a simple block</a> <li><a href="#ref-for-consume-a-list-of-rules③">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-an-at-rule"> <b><a href="#consume-an-at-rule">#consume-an-at-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-an-at-rule">5.3.5. Parse a rule</a> <li><a href="#ref-for-consume-an-at-rule①">5.4.1. Consume a list of rules</a> <li><a href="#ref-for-consume-an-at-rule②">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-consume-an-at-rule③">5.4.5. Consume a list of declarations</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-qualified-rule"> <b><a href="#consume-a-qualified-rule">#consume-a-qualified-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-qualified-rule">5.3.5. Parse a rule</a> <li><a href="#ref-for-consume-a-qualified-rule①">5.4.1. Consume a list of rules</a> <a href="#ref-for-consume-a-qualified-rule②">(2)</a> <li><a href="#ref-for-consume-a-qualified-rule③">5.4.4. Consume a style block’s contents</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-style-blocks-contents"> <b><a href="#consume-a-style-blocks-contents">#consume-a-style-blocks-contents</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-style-blocks-contents">5.3.7. Parse a style block’s contents</a> <li><a href="#ref-for-consume-a-style-blocks-contents①">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-list-of-declarations"> <b><a href="#consume-a-list-of-declarations">#consume-a-list-of-declarations</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-list-of-declarations">5.3.8. Parse a list of declarations</a> <li><a href="#ref-for-consume-a-list-of-declarations①">5.4.8. Consume a simple block</a> <li><a href="#ref-for-consume-a-list-of-declarations②">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-declaration"> <b><a href="#consume-a-declaration">#consume-a-declaration</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-declaration">5.3.6. Parse a declaration</a> <li><a href="#ref-for-consume-a-declaration①">5.4.4. Consume a style block’s contents</a> <li><a href="#ref-for-consume-a-declaration②">5.4.5. Consume a list of declarations</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-component-value"> <b><a href="#consume-a-component-value">#consume-a-component-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-component-value">5.3.9. Parse a component value</a> <li><a href="#ref-for-consume-a-component-value①">5.3.10. Parse a list of component values</a> <li><a href="#ref-for-consume-a-component-value②">5.3.11. Parse a comma-separated list of component values</a> <li><a href="#ref-for-consume-a-component-value③">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-consume-a-component-value④">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-consume-a-component-value⑤">5.4.4. Consume a style block’s contents</a> <a href="#ref-for-consume-a-component-value⑥">(2)</a> <li><a href="#ref-for-consume-a-component-value⑦">5.4.5. Consume a list of declarations</a> <a href="#ref-for-consume-a-component-value⑧">(2)</a> <li><a href="#ref-for-consume-a-component-value⑨">5.4.6. Consume a declaration</a> <li><a href="#ref-for-consume-a-component-value①⓪">5.4.8. Consume a simple block</a> <li><a href="#ref-for-consume-a-component-value①①">5.4.9. Consume a function</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-simple-block"> <b><a href="#consume-a-simple-block">#consume-a-simple-block</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-simple-block">5.4.2. Consume an at-rule</a> <li><a href="#ref-for-consume-a-simple-block①">5.4.3. Consume a qualified rule</a> <li><a href="#ref-for-consume-a-simple-block②">5.4.7. Consume a component value</a> </ul> </aside> <aside class="dfn-panel" data-for="ending-token"> <b><a href="#ending-token">#ending-token</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-ending-token">5.4.8. Consume a simple block</a> <a href="#ref-for-ending-token①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="consume-a-function"> <b><a href="#consume-a-function">#consume-a-function</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-consume-a-function">5.4.7. Consume a component value</a> </ul> </aside> <aside class="dfn-panel" data-for="anb-production"> <b><a href="#anb-production">#anb-production</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-anb-production">10.1. Serializing <an+b></a> <li><a href="#ref-for-anb-production①">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-urange"> <b><a href="#typedef-urange">#typedef-urange</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-urange">4.2. Definitions</a> <li><a href="#ref-for-typedef-urange①">7. The Unicode-Range microsyntax</a> <li><a href="#ref-for-typedef-urange②">7.1. The <urange> type</a> <a href="#ref-for-typedef-urange③">(2)</a> <a href="#ref-for-typedef-urange④">(3)</a> <a href="#ref-for-typedef-urange⑤">(4)</a> <a href="#ref-for-typedef-urange⑥">(5)</a> <a href="#ref-for-typedef-urange⑦">(6)</a> <a href="#ref-for-typedef-urange⑧">(7)</a> <a href="#ref-for-typedef-urange⑨">(8)</a> <a href="#ref-for-typedef-urange①⓪">(9)</a> <a href="#ref-for-typedef-urange①①">(10)</a> <a href="#ref-for-typedef-urange①②">(11)</a> <a href="#ref-for-typedef-urange①③">(12)</a> <a href="#ref-for-typedef-urange①④">(13)</a> <a href="#ref-for-typedef-urange①⑤">(14)</a> <a href="#ref-for-typedef-urange①⑥">(15)</a> <a href="#ref-for-typedef-urange①⑦">(16)</a> <a href="#ref-for-typedef-urange①⑧">(17)</a> <a href="#ref-for-typedef-urange①⑨">(18)</a> <a href="#ref-for-typedef-urange②⓪">(19)</a> <a href="#ref-for-typedef-urange②①">(20)</a> <a href="#ref-for-typedef-urange②②">(21)</a> <li><a href="#ref-for-typedef-urange②③">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> <li><a href="#ref-for-typedef-urange②④">12.5. Changes from CSS 2.1 and Selectors Level 3</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-style-block"> <b><a href="#typedef-style-block">#typedef-style-block</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-style-block">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-typedef-style-block①">(2)</a> <a href="#ref-for-typedef-style-block②">(3)</a> <li><a href="#ref-for-typedef-style-block③">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-declaration-list"> <b><a href="#typedef-declaration-list">#typedef-declaration-list</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-declaration-list">5.4.8. Consume a simple block</a> <li><a href="#ref-for-typedef-declaration-list①">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-typedef-declaration-list②">(2)</a> <a href="#ref-for-typedef-declaration-list③">(3)</a> <a href="#ref-for-typedef-declaration-list④">(4)</a> <a href="#ref-for-typedef-declaration-list⑤">(5)</a> <a href="#ref-for-typedef-declaration-list⑥">(6)</a> <a href="#ref-for-typedef-declaration-list⑦">(7)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-rule-list"> <b><a href="#typedef-rule-list">#typedef-rule-list</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-rule-list">5.4.8. Consume a simple block</a> <li><a href="#ref-for-typedef-rule-list①">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-typedef-rule-list②">(2)</a> <a href="#ref-for-typedef-rule-list③">(3)</a> <a href="#ref-for-typedef-rule-list④">(4)</a> <a href="#ref-for-typedef-rule-list⑤">(5)</a> <a href="#ref-for-typedef-rule-list⑥">(6)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-stylesheet"> <b><a href="#typedef-stylesheet">#typedef-stylesheet</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-stylesheet">5.4.8. Consume a simple block</a> <li><a href="#ref-for-typedef-stylesheet①">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-typedef-stylesheet②">(2)</a> <a href="#ref-for-typedef-stylesheet③">(3)</a> <a href="#ref-for-typedef-stylesheet④">(4)</a> <a href="#ref-for-typedef-stylesheet⑤">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-declaration-value"> <b><a href="#typedef-declaration-value">#typedef-declaration-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-declaration-value">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> <a href="#ref-for-typedef-declaration-value①">(2)</a> <li><a href="#ref-for-typedef-declaration-value②">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-any-value"> <b><a href="#typedef-any-value">#typedef-any-value</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-any-value">8.2. Defining Arbitrary Contents: the <declaration-value> and <any-value> productions</a> <li><a href="#ref-for-typedef-any-value①">12.2. Changes from the 20 February 2014 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="style-rule"> <b><a href="#style-rule">#style-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-style-rule">2. Description of CSS’s Syntax</a> <a href="#ref-for-style-rule①">(2)</a> <li><a href="#ref-for-style-rule②">5.3.7. Parse a style block’s contents</a> <a href="#ref-for-style-rule③">(2)</a> <li><a href="#ref-for-style-rule④">5.3.8. Parse a list of declarations</a> <li><a href="#ref-for-style-rule⑤">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-style-rule⑥">(2)</a> <li><a href="#ref-for-style-rule⑦">9. CSS stylesheets</a> <li><a href="#ref-for-style-rule⑧">9.1. Style rules</a> <a href="#ref-for-style-rule⑨">(2)</a> <li><a href="#ref-for-style-rule①⓪">9.2. At-rules</a> <a href="#ref-for-style-rule①①">(2)</a> <li><a href="#ref-for-style-rule①②">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="at-rule"> <b><a href="#at-rule">#at-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-rule">2. Description of CSS’s Syntax</a> <a href="#ref-for-at-rule①">(2)</a> <a href="#ref-for-at-rule②">(3)</a> <a href="#ref-for-at-rule③">(4)</a> <a href="#ref-for-at-rule④">(5)</a> <a href="#ref-for-at-rule⑤">(6)</a> <a href="#ref-for-at-rule⑥">(7)</a> <a href="#ref-for-at-rule⑦">(8)</a> <a href="#ref-for-at-rule⑧">(9)</a> <a href="#ref-for-at-rule⑨">(10)</a> <li><a href="#ref-for-at-rule①⓪">3.2. The input byte stream</a> <li><a href="#ref-for-at-rule①①">5. Parsing</a> <a href="#ref-for-at-rule①②">(2)</a> <a href="#ref-for-at-rule①③">(3)</a> <li><a href="#ref-for-at-rule①④">5.3.7. Parse a style block’s contents</a> <li><a href="#ref-for-at-rule①⑤">8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions</a> <a href="#ref-for-at-rule①⑥">(2)</a> <li><a href="#ref-for-at-rule①⑦">9.2. At-rules</a> <a href="#ref-for-at-rule①⑧">(2)</a> <a href="#ref-for-at-rule①⑨">(3)</a> <a href="#ref-for-at-rule②⓪">(4)</a> <a href="#ref-for-at-rule②①">(5)</a> <a href="#ref-for-at-rule②②">(6)</a> <li><a href="#ref-for-at-rule②③">9.3. The @charset Rule</a> <a href="#ref-for-at-rule②④">(2)</a> <li><a href="#ref-for-at-rule②⑤">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="statement-at-rule"> <b><a href="#statement-at-rule">#statement-at-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-statement-at-rule">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="block-at-rule"> <b><a href="#block-at-rule">#block-at-rule</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-block-at-rule">9.2. At-rules</a> <li><a href="#ref-for-block-at-rule①">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="css-descriptor"> <b><a href="#css-descriptor">#css-descriptor</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-descriptor">5. Parsing</a> <li><a href="#ref-for-css-descriptor①">12.1. Changes from the 16 August 2019 Candidate Recommendation</a> </ul> </aside> <aside class="dfn-panel" data-for="at-ruledef-charset"> <b><a href="#at-ruledef-charset">#at-ruledef-charset</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-at-ruledef-charset">3.2. The input byte stream</a> <a href="#ref-for-at-ruledef-charset①">(2)</a> <li><a href="#ref-for-at-ruledef-charset②">9.3. The @charset Rule</a> <a href="#ref-for-at-ruledef-charset③">(2)</a> <a href="#ref-for-at-ruledef-charset④">(3)</a> <a href="#ref-for-at-ruledef-charset⑤">(4)</a> <li><a href="#ref-for-at-ruledef-charset⑥">12.5. Changes from CSS 2.1 and Selectors Level 3</a> <a href="#ref-for-at-ruledef-charset⑦">(2)</a> </ul> </aside> <script>/* script-dfn-panel */ document.body.addEventListener("click", function(e) { var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); } // Find the dfn element or panel, if any, that was clicked on. var el = e.target; var target; var hitALink = false; while(el.parentElement) { if(el.tagName == "A") { // Clicking on a link in a <dfn> shouldn't summon the panel hitALink = true; } if(el.classList.contains("dfn-paneled")) { target = "dfn"; break; } if(el.classList.contains("dfn-panel")) { target = "dfn-panel"; break; } el = el.parentElement; } if(target != "dfn-panel") { // Turn off any currently "on" or "activated" panels. queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){ el.classList.remove("on"); el.classList.remove("activated"); }); } if(target == "dfn" && !hitALink) { // open the panel var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']"); if(dfnPanel) { dfnPanel.classList.add("on"); var rect = el.getBoundingClientRect(); dfnPanel.style.left = window.scrollX + rect.right + 5 + "px"; dfnPanel.style.top = window.scrollY + rect.top + "px"; var panelRect = dfnPanel.getBoundingClientRect(); var panelWidth = panelRect.right - panelRect.left; if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) { // Reposition, because the panel is overflowing dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px"; } } else { console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']"); } } else if(target == "dfn-panel") { // Switch it to "activated" state, which pins it. el.classList.add("activated"); el.style.left = null; el.style.top = null; } }); </script> <script>/* script-var-click-highlighting */ document.addEventListener("click", e=>{ if(e.target.nodeName == "VAR") { highlightSameAlgoVars(e.target); } }); { const indexCounts = new Map(); const indexNames = new Map(); function highlightSameAlgoVars(v) { // Find the algorithm container. let algoContainer = null; let searchEl = v; while(algoContainer == null && searchEl != document.body) { searchEl = searchEl.parentNode; if(searchEl.hasAttribute("data-algorithm")) { algoContainer = searchEl; } } // Not highlighting document-global vars, // too likely to be unrelated. if(algoContainer == null) return; const algoName = algoContainer.getAttribute("data-algorithm"); const varName = getVarName(v); const addClass = !v.classList.contains("selected"); let highlightClass = null; if(addClass) { const index = chooseHighlightIndex(algoName, varName); indexCounts.get(algoName)[index] += 1; indexNames.set(algoName+"///"+varName, index); highlightClass = nameFromIndex(index); } else { const index = previousHighlightIndex(algoName, varName); indexCounts.get(algoName)[index] -= 1; highlightClass = nameFromIndex(index); } // Find all same-name vars, and toggle their class appropriately. for(const el of algoContainer.querySelectorAll("var")) { if(getVarName(el) == varName) { el.classList.toggle("selected", addClass); el.classList.toggle(highlightClass, addClass); } } } function getVarName(el) { return el.textContent.replace(/(\s|\xa0)+/, " ").trim(); } function chooseHighlightIndex(algoName, varName) { let indexes = null; if(indexCounts.has(algoName)) { indexes = indexCounts.get(algoName); } else { // 7 classes right now indexes = [0,0,0,0,0,0,0]; indexCounts.set(algoName, indexes); } // If the element was recently unclicked, // *and* that color is still unclaimed, // give it back the same color. const lastIndex = previousHighlightIndex(algoName, varName); if(indexes[lastIndex] === 0) return lastIndex; // Find the earliest index with the lowest count. const minCount = Math.min.apply(null, indexes); let index = null; for(var i = 0; i < indexes.length; i++) { if(indexes[i] == minCount) { return i; } } } function previousHighlightIndex(algoName, varName) { return indexNames.get(algoName+"///"+varName); } function nameFromIndex(index) { return "selected" + index; } } </script>