cssom/Overview.html

Mon, 22 Apr 2013 12:09:10 +0200

author
Simon Pieters <simonp@opera.com>
date
Mon, 22 Apr 2013 12:09:10 +0200
changeset 7972
f2b03be2c8d5
parent 7971
abdd9e2238b6
child 7974
8aa80407ee99
permissions
-rw-r--r--

[cssom] CSSStyleDeclaration properties need [TreatNullAs=EmptyString]; specify cssFloat

glenn@6257 1 <!DOCTYPE html><html lang="en-US"><head>
glenn@6257 2 <meta charset="utf-8">
glenn@6247 3 <title>CSS Object Model (CSSOM)</title>
glenn@6257 4 <link href="cssom.css" rel="stylesheet">
simonp@7765 5 <link href="https://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet">
glenn@6257 6 </head>
glenn@6257 7 <body class="draft">
glenn@6257 8 <div class="head">
glenn@6257 9
glenn@6257 10 <!--begin-logo-->
simonp@7765 11 <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72"></a></p>
glenn@6257 12 <!--end-logo-->
glenn@6257 13
fantasai@6256 14 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 15 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 16
glenn@6257 17 <h1 id="cssom">CSS Object Model (CSSOM)</h1>
glenn@6257 18
glenn@6257 19 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 20
simonp@7971 21 <h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 22 April 2013</h2>
fantasai@6256 22
fantasai@6256 23 <dl>
glenn@6257 24
glenn@6257 25 <dt>This Version:</dt>
simonp@7765 26 <dd class="dontpublish"><a href="https://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html">https://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html</a></dd>
glenn@6257 27 <dt class="dontpublish">Participate:</dt>
glenn@6257 28 <dd class="dontpublish"><a href="mailto:www-style@w3.org?subject==%5Bcssom%5D%20">www-style@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)</dd>
simonp@7765 29 <dd class="dontpublish"><a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&amp;component=CSSOM">File a bug</a> (<a href="https://www.w3.org/Bugs/Public/buglist.cgi?component=CSSOM&amp;product=CSS&amp;resolution=---">open bugs</a>) <script async="" src="https://w3c-test.org/resources.whatwg.org/file-bug.js"></script></dd>
simonp@7764 30 <dd class="dontpublish"><a href="irc://irc.w3.org:6665/css">IRC: #css on W3C</a></dd>
glenn@6257 31
glenn@6257 32 <dt class="dontpublish">Previous Version:</dt>
glenn@6257 33 <dd class="dontpublish"><a href="http://www.w3.org/TR/2011/WD-cssom-20110712/">http://www.w3.org/TR/2011/WD-cssom-20110712/</a></dd>
glenn@6257 34 <dd class="dontpublish"><a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/">http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/</a></dd>
glenn@6257 35
glenn@6257 36 <dt>Editors:</dt>
glenn@6257 37 <dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a>
glenn@6257 38 (<a href="http://www.cox.com/">Cox Communications, Inc.</a>)
glenn@6257 39 &lt;<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>&gt;</dd>
glenn@7728 40 <dd><a>Simon Pieters</a>
glenn@7728 41 (<a href="http://www.opera.com/">Opera Software ASA</a>)
glenn@7728 42 &lt;<a href="mailto:simponp@opera.com">simonp@opera.com</a>&gt;</dd>
glenn@6257 43
glenn@6257 44 <dt>Previous Editor:</dt>
glenn@6257 45 <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
glenn@6257 46 (<a href="http://www.opera.com/">Opera Software ASA</a>)
glenn@6257 47 &lt;<a href="mailto:annevk@opera.com">annevk@opera.com</a>&gt;</dd>
fantasai@6256 48 </dl>
fantasai@6256 49
glenn@6344 50
glenn@6344 51 <!--begin-copyright-->
glenn@7758 52 <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
glenn@6344 53 <!--end-copyright-->
glenn@6344 54
glenn@6344 55 </div>
glenn@6257 56
glenn@6257 57 <hr class="top">
glenn@6257 58
fantasai@6256 59 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
fantasai@6256 60
glenn@6257 61 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
fantasai@6256 62
fantasai@6256 63 <p>CSSOM defines APIs (including generic parsing and serialization rules)
glenn@6257 64 for Media Queries, Selectors, and of course CSS itself.</p>
glenn@6257 65
fantasai@6256 66 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
fantasai@6256 67
glenn@6257 68 <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
glenn@6257 69
glenn@6257 70 <p>This is a public copy of the editors' draft. It is provided for discussion only and may change at any moment.
glenn@6257 71 Its publication here does not imply endorsement of its contents by W3C or by the CSS Working Group. Don't cite
glenn@6257 72 this document other than as work in progress.</p>
glenn@6257 73
glenn@6257 74 <p class="note">Implementers should note well that this specification is an ongoing effort to sort out
glenn@6794 75 what has been widely implemented and deployed from <a href="#refsDOM2STYLE">[DOM2STYLE]</a> as well as common extensions thereto, some details
glenn@6257 76 of which are currently interoperable and others which are not currently interoperable. As this specification moves
glenn@6257 77 forward, it is hoped that these differences will be resolved and an unambiguous and adequate consensus-based
glenn@6257 78 specification will emerge.</p>
fantasai@6256 79
fantasai@6256 80 <p><em>This section describes the status of this document at the time of
glenn@6257 81 its publication. Other documents may supersede this document. A list of
glenn@6257 82 current W3C publications and the latest revision of this technical report
glenn@6257 83 can be found in the
glenn@6257 84 <a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
glenn@6257 85
simonp@7971 86 <p class="dontpublish">This is the 22 April 2013 Editor's Draft of CSSOM. Please send comments to
glenn@6257 87 <a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
glenn@6257 88 (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
glenn@6257 89 with <samp>[cssom]</samp> at the start of the subject line.
glenn@6257 90
glenn@6257 91 <p>This document was produced by a group operating under the
glenn@6257 92 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
glenn@6257 93 W3C maintains a
glenn@6257 94 <a href="http://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a>
glenn@6257 95 made in connection with the deliverables of the group; that page also
glenn@6257 96 includes instructions for disclosing a patent. An individual who has
glenn@6257 97 actual knowledge of a patent which the individual believes contains
glenn@6257 98 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
glenn@6257 99 must disclose the information in accordance with
glenn@6257 100 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>
glenn@6257 101
fantasai@6256 102 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
fantasai@6256 103
glenn@6257 104 <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
glenn@6257 105
glenn@6257 106
glenn@6257 107 <!--begin-toc-->
glenn@6257 108 <ol class="toc">
glenn@6794 109 <li><a href="#introduction"><span class="secno">1 </span>Introduction</a></li>
glenn@6257 110 <li><a href="#conformance"><span class="secno">2 </span>Conformance</a></li>
glenn@6257 111 <li><a href="#terminology"><span class="secno">3 </span>Terminology</a>
glenn@6257 112 <ol class="toc">
glenn@6257 113 <li><a href="#common-serializing-idioms"><span class="secno">3.1 </span>Common Serializing Idioms</a></ol></li>
glenn@6257 114 <li><a href="#media-queries"><span class="secno">4 </span>Media Queries</a>
glenn@6257 115 <ol class="toc">
glenn@6257 116 <li><a href="#parsing-media-queries"><span class="secno">4.1 </span>Parsing Media Queries</a></li>
glenn@6257 117 <li><a href="#serializing-media-queries"><span class="secno">4.2 </span>Serializing Media Queries</a>
glenn@6257 118 <ol class="toc">
glenn@6257 119 <li><a href="#serializing-media-feature-values"><span class="secno">4.2.1 </span>Serializing Media Feature Values</a></ol></li>
glenn@6257 120 <li><a href="#comparing-media-queries"><span class="secno">4.3 </span>Comparing Media Queries</a></li>
glenn@6257 121 <li><a href="#the-medialist-interface"><span class="secno">4.4 </span>The <code>MediaList</code> Interface</a></ol></li>
glenn@6257 122 <li><a href="#selectors"><span class="secno">5 </span>Selectors</a>
glenn@6257 123 <ol class="toc">
glenn@6257 124 <li><a href="#parsing-selectors"><span class="secno">5.1 </span>Parsing Selectors</a></li>
glenn@6257 125 <li><a href="#serializing-selectors"><span class="secno">5.2 </span>Serializing Selectors</a></ol></li>
glenn@6257 126 <li><a href="#css"><span class="secno">6 </span>CSS</a>
glenn@6257 127 <ol class="toc">
glenn@6794 128 <li><a href="#css-style-sheets"><span class="secno">6.1 </span>CSS Style Sheets</a>
glenn@6257 129 <ol class="toc">
glenn@6257 130 <li><a href="#the-stylesheet-interface"><span class="secno">6.1.1 </span>The <code>StyleSheet</code> Interface</a></li>
glenn@6257 131 <li><a href="#the-cssstylesheet-interface"><span class="secno">6.1.2 </span>The <code>CSSStyleSheet</code> Interface</a></ol></li>
glenn@6257 132 <li><a href="#style-sheet-collections"><span class="secno">6.2 </span>Style Sheet Collections</a>
glenn@6257 133 <ol class="toc">
glenn@6257 134 <li><a href="#the-http-default-style-header"><span class="secno">6.2.1 </span>The HTTP <code>Default-Style</code> Header</a></li>
glenn@6257 135 <li><a href="#the-stylesheetlist-sequence"><span class="secno">6.2.2 </span>The <code>StyleSheetList</code> Sequence</a></li>
glenn@6257 136 <li><a href="#extensions-to-the-document-interface"><span class="secno">6.2.3 </span>Extensions to the <code>Document</code> Interface</a></li>
glenn@6257 137 <li><a href="#interaction-with-the-user-interface"><span class="secno">6.2.4 </span>Interaction with the User Interface</a>
glenn@6257 138 <ol class="toc">
glenn@6257 139 <li><a href="#persisting-the-selected-style-sheet-set"><span class="secno">6.2.4.1 </span>Persisting the selected style sheet set</a></ol></li>
glenn@6257 140 <li><a href="#examples"><span class="secno">6.2.5 </span>Examples</a></ol></li>
glenn@6257 141 <li><a href="#style-sheet-association"><span class="secno">6.3 </span>Style Sheet Association</a>
glenn@6257 142 <ol class="toc">
glenn@6257 143 <li><a href="#the-linkstyle-interface"><span class="secno">6.3.1 </span>The <code>LinkStyle</code> Interface</a></li>
glenn@6257 144 <li><a href="#requirements-on-specifications"><span class="secno">6.3.2 </span>Requirements on specifications</a></li>
glenn@6257 145 <li><a href="#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction"><span class="secno">6.3.3 </span>Requirements on User Agents Implementing the
glenn@6257 146 <span><code>xml-stylesheet</code> processing instruction</span></a></li>
glenn@6257 147 <li><a href="#requirements-on-user-agents-implementing-the-http-link-header"><span class="secno">6.3.4 </span>Requirements on User Agents Implementing the HTTP
glenn@6257 148 <code>Link</code> Header</a></ol></li>
glenn@6257 149 <li><a href="#css-rules"><span class="secno">6.4 </span>CSS Rules</a>
glenn@6257 150 <ol class="toc">
glenn@6257 151 <li><a href="#the-cssrulelist-sequence"><span class="secno">6.4.1 </span>The <code>CSSRuleList</code> Sequence</a></li>
glenn@6257 152 <li><a href="#the-cssrule-interface"><span class="secno">6.4.2 </span>The <code>CSSRule</code> Interface</a></li>
glenn@6257 153 <li><a href="#the-cssstylerule-interface"><span class="secno">6.4.3 </span>The <code>CSSStyleRule</code> Interface</a></li>
glenn@6523 154 <li><a href="#the-csscharsetrule-interface"><span class="secno">6.4.4 </span>The <code>CSSCharsetRule</code> Interface</a></li>
glenn@6523 155 <li><a href="#the-cssimportrule-interface"><span class="secno">6.4.5 </span>The <code>CSSImportRule</code> Interface</a></li>
glenn@6523 156 <li><a href="#the-cssmediarule-interface"><span class="secno">6.4.6 </span>The <code>CSSMediaRule</code> Interface</a></li>
glenn@6523 157 <li><a href="#the-cssfontfacerule-interface"><span class="secno">6.4.7 </span>The <code>CSSFontFaceRule</code> Interface</a></li>
glenn@6523 158 <li><a href="#the-csspagerule-interface"><span class="secno">6.4.8 </span>The <code>CSSPageRule</code> Interface</a></li>
glenn@6523 159 <li><a href="#the-cssnamespacerule-interface"><span class="secno">6.4.9 </span>The <code>CSSNamespaceRule</code> Interface</a></ol></li>
glenn@6257 160 <li><a href="#css-declaration-blocks"><span class="secno">6.5 </span>CSS Declaration Blocks</a>
glenn@6257 161 <ol class="toc">
glenn@6257 162 <li><a href="#the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The <code>CSSStyleDeclaration</code> Interface</a></ol></li>
glenn@6257 163 <li><a href="#css-values"><span class="secno">6.6 </span>CSS Values</a>
glenn@6257 164 <ol class="toc">
glenn@6257 165 <li><a href="#parsing-css-values"><span class="secno">6.6.1 </span>Parsing CSS Values</a></li>
glenn@6257 166 <li><a href="#serializing-css-values"><span class="secno">6.6.2 </span>Serializing CSS Values</a>
glenn@6257 167 <ol class="toc">
glenn@6257 168 <li><a href="#examples-0"><span class="secno">6.6.2.1 </span>Examples</a></ol></ol></ol></li>
glenn@6257 169 <li><a href="#dom-access-to-css-declaration-blocks"><span class="secno">7 </span>DOM Access to CSS Declaration Blocks</a>
glenn@6257 170 <ol class="toc">
glenn@6257 171 <li><a href="#the-elementcssinlinestyle-interface"><span class="secno">7.1 </span>The <code>ElementCSSInlineStyle</code> Interface</a></li>
glenn@6257 172 <li><a href="#extensions-to-the-window-interface"><span class="secno">7.2 </span>Extensions to the <code>Window</code> Interface</a></ol></li>
glenn@6257 173 <li><a href="#resolved-values"><span class="secno">8 </span>Resolved Values</a></li>
glenn@6257 174 <li><a href="#iana-considerations"><span class="secno">9 </span>IANA Considerations</a>
glenn@6257 175 <ol class="toc">
glenn@6257 176 <li><a href="#default-style"><span class="secno">9.1 </span><code>Default-Style</code></a></ol></li>
glenn@6257 177 <li><a class="no-num" href="#references">References</a>
glenn@6257 178 <ol class="toc">
glenn@6257 179 <li><a class="no-num" href="#normative-references">Normative references</a></li>
glenn@6257 180 <li><a class="no-num" href="#informative-references">Informative references</a></ol></li>
glenn@6794 181 <li><a class="no-num" href="#changes">Change History</a>
glenn@6794 182 <ol class="toc">
glenn@6794 183 <li><a class="no-num" href="#changes-from-dom2">Changes From DOM-2 Style</a></ol></li>
glenn@6257 184 <li><a class="no-num" href="#acknowledgments">Acknowledgments</a></ol>
glenn@6257 185 <!--end-toc-->
glenn@6257 186
glenn@6257 187 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 188
glenn@6257 189 <h2 id="introduction"><span class="secno">1 </span>Introduction</h2>
glenn@6257 190
glenn@6794 191 <p>This document formally specifies the core features of the CSS Object Model (CSSOM). Other documents in the CSSOM family of specifications
glenn@6794 192 as well as other CSS related specifications define extensions to these core features.</p>
glenn@6794 193
glenn@6794 194 <p>The core features of the CSSOM are oriented towards providing basic capabilities to author-defined scripts to permit access to
glenn@6794 195 and manipulation of style related state information and processes.</p>
glenn@6794 196
glenn@6794 197 <p>The features defined below are fundamentally based on prior specifications of the W3C DOM Working Group, primarily
glenn@6794 198 <a href="#refsDOM2STYLE">[DOM2STYLE]</a>. The purposes of the present document are (1) to improve on that prior work by providing
glenn@6794 199 more technical specificity (so as to improve testability and interoperability), (2) to deprecate or remove certain less-widely implemented
glenn@6794 200 features no longer considered to be essential in this context, and (3) to newly specify certain extensions that have been
glenn@6794 201 or expected to be widely implemented.</p>
glenn@6794 202
glenn@6794 203 <p>A full list of the changes to API signatures can be found in <a href="#changes-from-dom2"><cite>Changes from DOM-2 Style</cite></a>.</p>
glenn@6257 204
glenn@6257 205 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 206
glenn@6257 207 <h2 id="conformance"><span class="secno">2 </span>Conformance</h2>
glenn@6257 208
glenn@6257 209 <p>All diagrams, examples, and notes in this specification are
glenn@6257 210 non-normative, as are all sections explicitly marked non-normative.
glenn@6257 211 Everything else in this specification is normative.
glenn@6257 212
glenn@6257 213 <p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
glenn@6257 214 NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
glenn@6257 215 "OPTIONAL" in the normative parts of this document are to be
glenn@6257 216 interpreted as described in RFC2119. For readability, these words do
glenn@6257 217 not appear in all uppercase letters in this specification.
glenn@6257 218 <a href="#refsRFC2119">[RFC2119]</a>
glenn@6257 219
glenn@6257 220 <p>Requirements phrased in the imperative as part of algorithms
glenn@6257 221 (such as "strip any leading space characters" or "return false and
glenn@6257 222 terminate these steps") are to be interpreted with the meaning of the
glenn@6257 223 key word ("must", "should", "may", etc) used in introducing the
glenn@6257 224 algorithm.
glenn@6257 225
glenn@6257 226 <p>Conformance requirements phrased as algorithms or specific steps
glenn@6257 227 may be implemented in any manner, so long as the end result is
glenn@6257 228 equivalent. (In particular, the algorithms defined in this
glenn@6257 229 specification are intended to be easy to follow, and not intended to
glenn@6257 230 be performant.)
glenn@6257 231
glenn@6257 232 <p id="hardwareLimitations">User agents may impose
glenn@6257 233 implementation-specific limits on otherwise unconstrained inputs,
glenn@6257 234 e.g. to prevent denial of service attacks, to guard against running
glenn@6257 235 out of memory, or to work around platform-specific limitations.
glenn@6257 236
glenn@6257 237 <p>When a method or an attribute is said to call another method or attribute, the user agent must invoke its internal API for that attribute or method so that e.g. the author can't change the behavior by overriding attributes or methods with custom properties or functions in ECMAScript.
glenn@6257 238
glenn@6257 239 <p>Unless otherwise stated, string comparisons are done in a
glenn@6935 240 <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> manner.
glenn@6257 241
glenn@6257 242 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 243
glenn@6257 244 <h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
glenn@6257 245
glenn@6794 246 <p>This specification employs certain terminology from the following documents:
glenn@6257 247 <cite>DOM4</cite>,
glenn@6257 248 <cite>HTML</cite>,
glenn@6257 249 <cite>Associating Style Sheets with XML documents</cite>
glenn@6257 250 and
glenn@6257 251 <cite>XML</cite>
glenn@6257 252 <a href="#refsDOM">[DOM]</a>
glenn@6257 253 <a href="#refsHTML">[HTML]</a>
glenn@6257 254 <a href="#refsXMLSS">[XMLSS]</a>
glenn@6794 255 <a href="#refsXML">[XML]</a>.
glenn@6257 256
glenn@6257 257 <p>When this specification talks about object
glenn@6257 258 <code><var>A</var></code> where <code><var>A</var></code> is actually an interface, it generally means an object implementing interface
glenn@6257 259 <code><var>A</var></code>.</p>
glenn@6257 260
glenn@6794 261 <p>The term <dfn id="whitespace">whitespace</dfn> is used as defined in <a href="#refsCSS">[CSS]</a>.
glenn@6257 262
glenn@6933 263 <p>The terms <dfn id="set">set</dfn> and <dfn id="clear">clear</dfn> to refer to the <code>true</code> and
glenn@6933 264 <code>false</code> values of binary flags or variables, respectively. These terms are also used as verbs in which case they refer to
glenn@6933 265 mutating some value to make it <code>true</code> or <code>false</code>, respectively.</p>
glenn@6933 266
glenn@6257 267 <!-- ........................................................................................................................ -->
glenn@6257 268 <!-- ........................................................................................................................ -->
glenn@6257 269
glenn@6257 270 <h3 id="common-serializing-idioms"><span class="secno">3.1 </span>Common Serializing Idioms</h3>
glenn@6257 271
glenn@6524 272 <p>To <dfn id="escape-a-character">escape a character</dfn> means to create a string of
glenn@6257 273 "<code>\</code>" (U+005C), followed by the character.</p>
glenn@6257 274
glenn@6524 275 <p>To <dfn id="escape-a-character-as-code-point">escape a character as code point</dfn> means to create a
glenn@6257 276 string of "<code>\</code>" (U+005C), followed by the Unicode code point as
glenn@6257 277 the smallest possible number of hexadecimal digits in the range 0-9 a-f
glenn@6257 278 (U+0030 to U+0039 and U+0061 to U+0066) to represent the code point in
glenn@6934 279 base 16, followed by a single SPACE (U+0020).</p>
glenn@6257 280
glenn@6257 281 <p>To <dfn id="serialize-an-identifier">serialize an identifier</dfn> means to create a string represented
glenn@6257 282 by the concatenation of, for each character of the identifier:</p>
glenn@6257 283
glenn@6257 284 <ul>
glenn@6942 285 <li>If the character is NULL (U+0000), then <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an
glenn@6935 286 <code class="external"><a href="http://dom.spec.whatwg.org/#invalidcharactererror">InvalidCharacterError</a></code> exception and terminate these steps.</li>
glenn@6933 287 <li>If the character is in the range [\1-\1f] (U+0001 to U+001F) or
glenn@6933 288 [\7f-\9f] (U+007F to U+009F), then the character
glenn@6524 289 <a href="#escape-a-character-as-code-point" title="escape a character as code point">escaped as code point</a>.</li>
glenn@6933 290 <li>If the character is the first character and is in the range [0-9]
glenn@6933 291 (U+0030 to U+0039), then the character
glenn@6524 292 <a href="#escape-a-character-as-code-point" title="escape a character as code point">escaped as code point</a>.</li>
glenn@6933 293 <li>If the character is the second character and is in the range [0-9]
glenn@6257 294 (U+0030 to U+0039) and the first character is a "<code>-</code>"
glenn@6933 295 (U+002D), then the character
glenn@6524 296 <a href="#escape-a-character-as-code-point" title="escape a character as code point">escaped as code point</a>.</li>
glenn@6257 297 <li>If the character is the second character and is "<code>-</code>"
glenn@6933 298 (U+002D) and the first character is "<code>-</code>" as well, then the
glenn@6524 299 <a href="#escape-a-character" title="escape a character">escaped</a> character.</li>
glenn@6257 300 <li>If the character is not handled by one of the above rules and is
glenn@6257 301 greater than or equal to U+0080, is "<code>-</code>" (U+002D) or
glenn@6933 302 "<code>_</code>" (U+005F), or is in one of the ranges [0-9] (U+0030 to
glenn@6933 303 U+0039), [A-Z] (U+0041 to U+005A), or [a-z] (U+0061 to U+007A), then the character
glenn@6257 304 itself.</li>
glenn@6524 305 <li>Otherwise, the <a href="#escape-a-character" title="escape a character">escaped</a>
glenn@6257 306 character.</li>
fantasai@6256 307 </ul>
glenn@6257 308
glenn@6257 309 <p>To <dfn id="serialize-a-string">serialize a string</dfn> means to create a string represented
glenn@6257 310 by '<code>"</code>' (U+0022), followed by the result of applying the rules
glenn@6257 311 below to each character of the given string, followed by
glenn@6257 312 '<code>"</code>' (U+0022):</p>
glenn@6257 313
glenn@6257 314 <ul>
glenn@6942 315 <li>If the character is NULL (U+0000), then <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an
glenn@6935 316 <code class="external"><a href="http://dom.spec.whatwg.org/#invalidcharactererror">InvalidCharacterError</a></code> exception and terminate these steps.</li>
glenn@6933 317 <li>If the character is in the range [\1-\1f] (U+0001 to U+001F) or [\7f-\9f] (U+007F to
glenn@6933 318 U+009F), the character <a href="#escape-a-character-as-code-point" title="escape a character as code point">escaped as code point</a>.</li>
glenn@6257 319 <li>If the character is '<code>"</code>' (U+0022) or '<code>\</code>'
glenn@6524 320 (U+005C), the <a href="#escape-a-character" title="escape a character">escaped</a> character.</li>
glenn@6257 321 <li>Otherwise, the character itself.</li>
glenn@6257 322 </ul>
glenn@6257 323
glenn@6257 324 <p class="note">"<code>'</code>" (U+0027) is not escaped because strings
glenn@6257 325 are always serialized with '<code>"</code>' (U+0022).</p>
glenn@6257 326
glenn@6257 327 <p>To <dfn id="serialize-a-url">serialize a URL</dfn> means to create a string represented by
glenn@6257 328 "<code>url(</code>", followed by the
glenn@6257 329 <a href="#serialize-a-string" title="serialize a string">string escaped</a> value of the given
glenn@6257 330 string, followed by "<code>)</code>".</p>
glenn@6257 331
glenn@6257 332 <p>To <dfn id="serialize-a-comma-separated-list">serialize a comma-separated list</dfn> concatenate all items of
glenn@6933 333 the list in list order while separating them by "<code>, </code>", i.e.,
glenn@6933 334 COMMA (U+002C) followed by a single SPACE (U+0020).</p>
glenn@6257 335
glenn@6257 336 <p>To <dfn id="serialize-a-whitespace-separated-list">serialize a whitespace-separated list</dfn> concatenate all
glenn@6933 337 items of the list in list order while separating them by "<code> </code>", i.e.,
glenn@6933 338 a single SPACE (U+0020).</p>
glenn@6933 339
glenn@6933 340 <p class="note">When serializing a list according to the above rules,
glenn@6933 341 extraneous whitespace is not inserted prior to the first item or subsequent to
glenn@6933 342 the last item. Unless otherwise specified, an empty list is serialized as the
glenn@6933 343 empty string.</p>
glenn@6257 344
fantasai@6256 345 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
fantasai@6256 346
glenn@6257 347 <h2 id="media-queries"><span class="secno">4 </span>Media Queries</h2>
glenn@6257 348
glenn@6257 349 <p>Media queries are defined by the Media Queries specification. This
glenn@6257 350 section defines various concepts around media queries, including their API
glenn@6257 351 and serialization form.</p>
glenn@6257 352
glenn@6257 353 <!-- XXX ref -->
glenn@6257 354
fantasai@6256 355 <!-- ........................................................................................................................ -->
fantasai@6256 356 <!-- ........................................................................................................................ -->
fantasai@6256 357
glenn@6257 358 <h3 id="parsing-media-queries"><span class="secno">4.1 </span>Parsing Media Queries</h3>
glenn@6257 359
glenn@6257 360 <p>To
glenn@6257 361 <dfn id="parse-a-media-query-list">parse a media query list</dfn> for a
glenn@6257 362 given string <var>s</var> into a media query list is defined in
glenn@6257 363 the Media Queries specification. Return the list of one or more media
glenn@6257 364 queries that the algorithm defined there gives.</p> <!-- XXX ref -->
glenn@6257 365
glenn@6257 366 <p class="note">A media query that ends up being "ignored" will turn
glenn@6257 367 into "<code>not all</code>".</p>
glenn@6257 368
glenn@6257 369 <p>To
glenn@6257 370 <dfn id="parse-a-media-query">parse a media query</dfn> for a given string
glenn@6257 371 <var>s</var> means to follow the
glenn@6933 372 <a href="#parse-a-media-query-list">parse a media query list</a> steps and return <code>null</code> if more
glenn@6257 373 than one media query is returned or a media query if a
glenn@6257 374 single media query is returned.</p>
glenn@6257 375
glenn@6257 376 <p class="note">Again, a media query that ends up being "ignored" will
glenn@6257 377 turn into "<code>not all</code>".</p>
glenn@6257 378
fantasai@6256 379 <!-- ........................................................................................................................ -->
glenn@6257 380
glenn@6257 381 <h3 id="serializing-media-queries"><span class="secno">4.2 </span>Serializing Media Queries</h3>
glenn@6257 382
glenn@6257 383 <p>To
glenn@6257 384 <dfn id="serialize-a-media-query-list">serialize a media query list</dfn>
glenn@6257 385 run these steps:</p>
glenn@6247 386
glenn@6247 387 <ol>
glenn@6257 388 <li><p>If the media query list is empty return the empty string and
glenn@6257 389 terminate these steps.</li>
glenn@6257 390
glenn@6257 391 <li><p><a href="#serialize-a-media-query" title="serialize a media query">Serialize</a> each
glenn@6257 392 media query in the list of media queries, sort them in lexicographical
glenn@6257 393 order, and then
glenn@6257 394 <a href="#serialize-a-comma-separated-list" title="serialize a comma-separated list">serialize</a> the
glenn@6257 395 list.</li>
glenn@6247 396 </ol>
glenn@6247 397
glenn@6257 398 <p>To
glenn@6257 399 <dfn id="serialize-a-media-query">serialize a media query</dfn> let
glenn@6257 400 <var>s</var> be the empty string, run the steps below, and
glenn@6257 401 finally return <var>s</var>:</p>
glenn@6247 402
glenn@6247 403 <ol>
glenn@6257 404 <li><p>If the media query is negated append "<code>not</code>", followed
glenn@6934 405 by a single SPACE (U+0020), to <var>s</var>.</li>
glenn@6257 406
glenn@6257 407 <li><p>Let <var>type</var> be the media type of the media query,
glenn@6257 408 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a> and
glenn@6935 409 <a class="external" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.</li>
glenn@6257 410
glenn@6257 411 <li><p>If the media query does not contain media features append
glenn@6257 412 <var>type</var>, to <var>s</var>,
glenn@6257 413 then return <var>s</var> and terminate this algorithm.</li>
glenn@6257 414
glenn@6257 415 <li><p>If <var>type</var> is not "<code>all</code>" or if the
glenn@6257 416 media query is negated append <var>type</var>, followed by a
glenn@6934 417 single SPACE (U+0020), followed by "<code>and</code>", followed by a single SPACE
glenn@6257 418 (U+0020), to <var>s</var>.</li>
glenn@6257 419
glenn@6257 420 <li><p>Sort the media features in lexicographical order.</li>
glenn@6247 421
glenn@6247 422 <li>
glenn@6247 423 <p>Then, for each media feature:</p>
glenn@6247 424
glenn@6247 425 <ol>
glenn@6247 426 <li>Append a "<code>(</code>" (U+0028), followed by the media feature
glenn@6935 427 name, <a class="external" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>,
glenn@6257 428 to <var>s</var>.<p></li>
glenn@6257 429
glenn@6257 430 <li><p>If a value is given append a "<code>:</code>" (U+003A), followed
glenn@6934 431 by a single SPACE (U+0020), followed by the
glenn@6257 432 <a href="#serialize-a-media-feature-value" title="serialize a media feature value">serialized media feature value</a>,
glenn@6257 433 to <var>s</var>.</li>
glenn@6257 434
glenn@6257 435 <li><p>Append a "<code>)</code>" (U+0029) to
glenn@6257 436 <var>s</var>.</li>
glenn@6257 437
glenn@6934 438 <li><p>If this is not the last media feature append a single SPACE (U+0020),
glenn@6934 439 followed by "<code>and</code>", followed by a single SPACE (U+0020), to
glenn@6257 440 <var>s</var>.</li>
glenn@6247 441 </ol>
glenn@6257 442 </li>
glenn@6247 443 </ol>
glenn@6247 444
glenn@6257 445 <div class="example">
glenn@6247 446 <p>Here are some examples of input (first column) and output (second
glenn@6257 447 column):</p>
glenn@6247 448
glenn@6247 449 <table>
glenn@6247 450 <thead>
glenn@6257 451 <tr><th>Input<th>Output
glenn@6247 452 <tbody>
glenn@6247 453 <tr>
glenn@7306 454 <td><pre>not screen and (min-WIDTH:5px) AND (max-width:40px)</pre>
glenn@7306 455 <td><pre>not screen and (max-width: 40px) and (min-width: 5px)</pre>
glenn@6247 456 <tr>
glenn@7306 457 <td><pre>all and (color) and (color)</pre>
glenn@7306 458 <td><pre>(color)</pre>
glenn@6247 459 </table>
glenn@6247 460 </div>
glenn@6257 461
glenn@6257 462
glenn@6247 463 <!-- ........................................................................................................................ -->
glenn@6247 464
glenn@6257 465 <h4 id="serializing-media-feature-values"><span class="secno">4.2.1 </span>Serializing Media Feature Values</h4>
glenn@6257 466
glenn@6344 467 <p class="issue">This should probably be done in terms of mapping it to
glenn@6257 468 serializing CSS values as media features are defined in terms of CSS
glenn@6257 469 values after all.</p>
glenn@6257 470
glenn@6257 471 <p>To <dfn id="serialize-a-media-feature-value">serialize a media feature value</dfn>
glenn@6257 472 named <var>v</var> locate <var>v</var> in the first
glenn@6257 473 column of the table below and use the serialization format described in
glenn@6257 474 the second column:</p>
glenn@6247 475
glenn@6247 476 <table>
glenn@6257 477 <tr>
glenn@6257 478 <th>Media Feature
glenn@6257 479 <th>Serialization
glenn@6257 480 <tr>
glenn@6257 481 <td><code>width</code>
glenn@6257 482 <td>...
glenn@6257 483 <tr>
glenn@6257 484 <td><code>height</code>
glenn@6257 485 <td>...
glenn@6257 486 <tr>
glenn@6257 487 <td><code>device-width</code>
glenn@6257 488 <td>...
glenn@6257 489 <tr>
glenn@6257 490 <td><code>device-height</code>
glenn@6257 491 <td>...
glenn@6257 492 <tr>
glenn@6257 493 <td><code>orientation</code>
glenn@6257 494 <td>
glenn@6257 495 <p>If the value is `<code>portrait</code>`: "<code>portrait</code>".</p>
glenn@6257 496 <p>If the value is `<code>landscape</code>`: "<code>landscape</code>".</p>
glenn@6257 497 <tr>
glenn@6257 498 <td><code>aspect-ratio</code>
glenn@6257 499 <td>...
glenn@6257 500 <tr>
glenn@6257 501 <td><code>device-aspect-ratio</code>
glenn@6257 502 <td>...
glenn@6257 503 <tr>
glenn@6257 504 <td><code>color</code>
glenn@6257 505 <td>...
glenn@6257 506 <tr>
glenn@6257 507 <td><code>color-index</code>
glenn@6257 508 <td>...
glenn@6257 509 <tr>
glenn@6257 510 <td><code>monochrome</code>
glenn@6257 511 <td>...
glenn@6257 512 <tr>
glenn@6257 513 <td><code>resolution</code>
glenn@6257 514 <td>...
glenn@6257 515 <tr>
glenn@6257 516 <td><code>scan</code>
glenn@6257 517 <td>
glenn@6257 518 <p>If the value is `<code>progressive</code>`: "<code>progressive</code>".</p>
glenn@6257 519 <p>If the value is `<code>interlace</code>`: "<code>interlace</code>".</p>
glenn@6257 520 <tr>
glenn@6257 521 <td><code>grid</code>
glenn@6257 522 <td>...
glenn@6247 523 </table>
glenn@6247 524
glenn@6247 525 <p>Other specifications can extend this table and vendor-prefixed media
glenn@6257 526 features can have custom serialization formats as well.</p>
glenn@6257 527
glenn@6247 528 <!-- ........................................................................................................................ -->
glenn@6247 529 <!-- ........................................................................................................................ -->
glenn@6247 530
glenn@6257 531 <h3 id="comparing-media-queries"><span class="secno">4.3 </span>Comparing Media Queries</h3>
glenn@6257 532
glenn@6257 533 <p>To
glenn@6257 534 <dfn id="compare-media-queries">compare media queries</dfn>
glenn@6257 535 <var>m1</var> and <var>m2</var> means to
glenn@6257 536 <a href="#serialize-a-media-query" title="serialize a media query">serialize</a> them both and
glenn@6257 537 return true if they are a
glenn@6935 538 <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match and false if they
glenn@6257 539 are not.</p>
glenn@6257 540
glenn@6247 541 <!-- ........................................................................................................................ -->
glenn@6247 542 <!-- ........................................................................................................................ -->
glenn@6247 543
glenn@6257 544 <h3 id="the-medialist-interface"><span class="secno">4.4 </span>The <code>MediaList</code> Interface</h3>
glenn@6257 545
glenn@6257 546 <p>An object that implements the <a class="idlType" href="#widl-def-MediaList"><code>MediaList</code></a> interface has an associated <dfn id="collection-of-media-queries">collection of media queries</dfn>.</p>
glenn@6523 547 <pre class="idl"><span class="idlInterface" id="widl-def-MediaList">[Constructor(DOMString text)]
glenn@6437 548 interface <span class="idlInterfaceID">MediaList</span> {
glenn@6257 549 <span class="idlAttribute"> stringifier attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-MediaList-mediaText">mediaText</a></span>;</span>
glenn@6257 550 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned long</a></span> <span class="idlAttrName"><a href="#widl-MediaList-length">length</a></span>;</span>
glenn@6257 551 <span class="idlMethod"> <span class="idlMethType"><a>DOMString</a></span> <span class="idlMethName"><a href="#widl-MediaList-item-DOMString-unsigned-long-index">item</a></span> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
glenn@6257 552 <span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MediaList-appendMedium-void-DOMString-medium">appendMedium</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">medium</span></span>);</span>
glenn@6257 553 <span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MediaList-deleteMedium-void-DOMString-medium">deleteMedium</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">medium</span></span>);</span>
glenn@6247 554 };</span></pre>
glenn@6437 555 <dl class="constructors">
glenn@6523 556 <dt class="constructor" id="widl-MediaList-DOMString-text">
glenn@6642 557 <code>MediaList</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">text</span></span>)</dt>
glenn@6437 558 <dd>
glenn@6523 559 <p>To <dfn id="create-a-medialist-object">create a <code>MediaList</code> object</dfn> from a string <var>text</var>, run these steps:</p> <ol> <li><p>Create a new <code>MediaList</code> object.</li> <li><p>Set its <span title="dom-MediaList-mediaText">mediaText</span> attribute to <var>text</var>.</li> <li><p>Return the newly created <code><code>MediaList</code></code> object.</li> </ol></dd>
glenn@6437 560 </dl>
glenn@6257 561 <dl class="attributes">
glenn@6257 562 <dt class="attribute" id="widl-MediaList-mediaText">
glenn@6257 563 <code>mediaText</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt>
glenn@6257 564 <dd>
glenn@6257 565 <p>The <code>mediaText</code> attribute must return a <a href="#serialize-a-media-query-list" title="serialize a media query list">serialization</a> of the <a href="#collection-of-media-queries">collection of media queries</a>.</p> <p>Setting the <code>mediaText</code> attribute must run these steps: <ol> <li><p>Empty the <a href="#collection-of-media-queries">collection of media queries</a>.</li> <li><p>If the given value is the empty string terminate these steps.</li> <li><p>Append all the media queries as a result of <a href="#parse-a-media-query-list" title="parse a media query list">parsing</a> the given value to the <a href="#collection-of-media-queries">collection of media queries</a>.</li> </ol></dd>
glenn@6257 566 <dt class="attribute" id="widl-MediaList-length">
glenn@6257 567 <code>length</code> of type <span class="idlAttrType"><a>unsigned long</a></span>, readonly</dt>
glenn@6257 568 <dd>
glenn@6257 569 <p>The <code>length</code> attribute must return the number of media queries in the <a href="#collection-of-media-queries">collection of media queries</a>.</dd>
glenn@6257 570 </dl>
glenn@6257 571 <dl class="methods">
glenn@6257 572 <dt class="method" id="widl-MediaList-item-DOMString-unsigned-long-index">
glenn@6642 573 <code>item</code> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
glenn@6257 574 <dd>
glenn@6942 575 <p>The <code>item</code> method must return the media query in the <a href="#collection-of-media-queries">collection of media queries</a> given by <var>index</var>, or <code>null</code>, if <var>index</var> is greater than or equal to the number of media queries in the <a href="#collection-of-media-queries">collection of media queries</a>.</dd>
glenn@6257 576 <dt class="method" id="widl-MediaList-appendMedium-void-DOMString-medium">
glenn@6642 577 <code>appendMedium</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">medium</span></span>), returns <span class="idlMethType"><a>void</a></span></dt>
glenn@6257 578 <dd>
glenn@6942 579 <p>The <code>appendMedium</code> method must run these steps:</p> <ol> <li><p>Let <var>m</var> be the result of <a href="#parse-a-media-query" title="parse a media query">parsing</a> the given value.</li> <li><p>If <var>m</var> is <code>null</code> terminate these steps.</li> <li><p>If <a href="#compare-media-queries" title="compare media queries">comparing</a> <var>m</var> with any of the media queries in the <a href="#collection-of-media-queries">collection of media queries</a> returns true terminate these steps.</li> <li><p>Append <var>m</var> to the <a href="#collection-of-media-queries">collection of media queries</a>.</li> </ol></dd>
glenn@6257 580 <dt class="method" id="widl-MediaList-deleteMedium-void-DOMString-medium">
glenn@6642 581 <code>deleteMedium</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">medium</span></span>), returns <span class="idlMethType"><a>void</a></span></dt>
glenn@6257 582 <dd>
glenn@6942 583 <p>The <code>deleteMedium</code> method must run these steps:</p> <ol> <li><p>Let <var>m</var> be the result of <a href="#parse-a-media-query" title="parse a media query">parsing</a> the given value.</li> <li><p>If <var>m</var> is <code>null</code> terminate these steps.</li> <li><p>Remove any media query from the <a href="#collection-of-media-queries">collection of media queries</a> for which <a href="#compare-media-queries" title="compare media queries">comparing</a> the media query with <var>m</var> returns true.</li> </ol></dd>
glenn@6257 584 </dl>
glenn@6437 585
glenn@6257 586
glenn@6257 587 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6257 588
glenn@6257 589 <h2 id="selectors"><span class="secno">5 </span>Selectors</h2>
glenn@6257 590
glenn@6257 591 <p>Selectors are defined in the Selectors specification. This section
glenn@6257 592 mainly defines how to serialize them.</p> <!-- XXX ref -->
glenn@6257 593
glenn@6257 594 <!-- XXX ref universal selector etc? some are in <span> some not -->
glenn@6257 595
glenn@6257 596 <!-- ........................................................................................................................ -->
glenn@6257 597 <!-- ........................................................................................................................ -->
glenn@6257 598
glenn@6257 599 <h3 id="parsing-selectors"><span class="secno">5.1 </span>Parsing Selectors</h3>
glenn@6257 600
glenn@6257 601 <p>To
glenn@6257 602 <dfn id="parse-a-group-of-selectors">parse a group of selectors</dfn>
glenn@6257 603 means to parse the value using the <code>selectors_group</code>
glenn@6257 604 production defined in the Selectors specification and return either a
glenn@6933 605 group of selectors if parsing did not fail or <code>null</code> if parsing did
glenn@6257 606 fail.</p> <!-- XXX ref -->
glenn@6257 607
glenn@6257 608 <!-- ........................................................................................................................ -->
glenn@6257 609 <!-- ........................................................................................................................ -->
glenn@6257 610
glenn@6257 611 <h3 id="serializing-selectors"><span class="secno">5.2 </span>Serializing Selectors</h3>
glenn@6257 612 <!-- http://dump.testsuite.org/2009/cssom/serializing-selectors.htm -->
glenn@6257 613
glenn@6257 614 <p>To
glenn@6257 615 <dfn id="serialize-a-group-of-selectors">serialize a group of selectors</dfn>
glenn@6257 616 <a href="#serialize-a-selector" title="serialize a selector">serialize</a> each selector in the
glenn@6257 617 group of selectors and then
glenn@6257 618 <a href="#serialize-a-comma-separated-list" title="serialize a comma-separated list">serialize</a> the
glenn@6257 619 group.</p>
glenn@6257 620
glenn@6257 621 <p>To <dfn id="serialize-a-selector">serialize a selector</dfn> let
glenn@6257 622 <var>s</var> be the empty string, run the steps below for each
glenn@6257 623 part of the chain of the selector, and finally return
glenn@6257 624 <var>s</var>:</p>
fantasai@6256 625
fantasai@6256 626 <ol>
glenn@6257 627 <li><p>If there is only one <span>simple selector</span> in the
glenn@6257 628 <span>sequence of simple selectors</span> which is a
glenn@6257 629 <span>universal selector</span>, append the result of
glenn@6257 630 <a href="#serialize-a-simple-selector" title="serialize a simple selector">serializing</a> the
glenn@6257 631 <span>universal selector</span> to <var>s</var>.</li>
glenn@6257 632
glenn@6257 633 <li><p>Otherwise, for each <span>simple selector</span> in the
glenn@6257 634 <span>sequence of simple selectors</span> that is not a
glenn@6257 635 universal selector of which the <span>namespace prefix</span> maps to
glenn@6257 636 the null namespace (not in a namespace) or of which the
glenn@6257 637 <span>namespace prefix</span> maps to a namespace that is not the
glenn@6257 638 <span>default namespace</span>
glenn@6257 639 <a href="#serialize-a-simple-selector" title="serialize a simple selector">serialize</a> the
glenn@6257 640 <span>simple selector</span> and append the result to
glenn@6257 641 <var>s</var>.</li>
glenn@6257 642
glenn@6257 643 <li><p>If this is not the last part of the chain of the selector append a
glenn@6934 644 single SPACE (U+0020), followed by the combinator
glenn@6257 645 "<code>&gt;</code>",
glenn@6257 646 "<code>+</code>", or
glenn@6257 647 "<code>~</code>"
glenn@6934 648 as appropriate, followed by another single SPACE (U+0020) if the combinator was
glenn@6257 649 not whitespace, to <var>s</var>.</li>
glenn@6257 650
glenn@6257 651 <li><p>If this is the last part of the chain of the selector and there is
glenn@6257 652 a pseudo-element, append "<code>::</code>" followed by the name of the
glenn@6257 653 pseudo-class, to <var>s</var>.</li>
fantasai@6256 654 </ol>
glenn@6257 655
glenn@6257 656
glenn@6257 657 <p>To
glenn@6257 658 <dfn id="serialize-a-simple-selector">serialize a simple selector</dfn>
glenn@6257 659 let <var>s</var> be the empty string, run the steps below, and
glenn@6257 660 finally return <var>s</var>:</p>
glenn@6257 661
glenn@6257 662 <dl class="switch">
glenn@6257 663 <dt>type selector</dt>
glenn@6257 664 <dt>universal selector</dt>
glenn@6247 665 <dd>
glenn@6247 666 <ol>
glenn@6257 667 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
glenn@6257 668 not the <span>default namespace</span> and is not the
glenn@6257 669 null namespace (not in a namespace) append the
glenn@6257 670 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a>
glenn@6257 671 <span>namespace prefix</span>, followed by a "<code>|</code>" (U+007C)
glenn@6257 672 to <var>s</var>.</li>
glenn@6257 673
glenn@6257 674 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
glenn@6257 675 the null namespace (not in a namespace) append
glenn@6257 676 "<code>|</code>" (U+007C) to <var>s</var>.</li>
glenn@6247 677 <!-- This includes |* -->
glenn@6247 678
glenn@6257 679 <li><p>If this is a type selector append the
glenn@6257 680 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a> element name to
glenn@6257 681 <var>s</var>.</li>
glenn@6257 682
glenn@6257 683 <li><p>If this is a universal selector append "<code>*</code>" (U+002A)
glenn@6257 684 to <var>s</var>.</li>
glenn@6247 685 </ol>
glenn@6257 686 </dd>
glenn@6257 687
glenn@6257 688 <dt>attribute selector</dt>
glenn@6247 689 <dd>
glenn@6247 690 <ol>
glenn@6257 691 <li><p>Append "<code>[</code>" (U+005B) to
glenn@6257 692 <var>s</var>.</li>
glenn@6257 693
glenn@6257 694 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
glenn@6257 695 not the null namespace (not in a namespace) append the
glenn@6257 696 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a>
glenn@6257 697 <span>namespace prefix</span>, followed by a "<code>|</code>" (U+007C)
glenn@6257 698 to <var>s</var>.</li>
glenn@6257 699
glenn@6257 700 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
glenn@6257 701 the null namespace (not in a namespace) append
glenn@6257 702 "<code>|</code>" (U+007C) to <var>s</var>.</li>
glenn@6247 703 <!-- This includes |* -->
glenn@6247 704
glenn@6257 705 <li><p>Append the <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a>
glenn@6257 706 attribute name to <var>s</var>.</li>
glenn@6257 707
glenn@6257 708 <li><p>If there is an attribute value specified, append
glenn@6257 709 "<code>=</code>",
glenn@6257 710 "<code>~=</code>",
glenn@6257 711 "<code>|=</code>",
glenn@6257 712 "<code>^=</code>",
glenn@6257 713 "<code>$=</code>", or
glenn@6257 714 "<code>*=</code>"
glenn@6257 715 as appropriate (depending on the type of attribute selector), followed
glenn@6257 716 by the <a href="#serialize-a-string" title="serialize a string">string escaped</a>
glenn@6257 717 attribute value, to <var>s</var>.</li>
glenn@6257 718
glenn@6257 719 <li><p>Append "<code>]</code>" (U+005D) to
glenn@6257 720 <var>s</var>.</li>
glenn@6247 721 </ol>
glenn@6257 722 </dd>
glenn@6257 723
glenn@6257 724 <dt>class selector</dt>
glenn@6257 725 <dd><p>Append a "<code>.</code>" (U+002E), followed by the
glenn@6257 726 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a> class name to
glenn@6257 727 <var>s</var>.</dd>
glenn@6257 728
glenn@6257 729 <dt>ID selector</dt>
glenn@6257 730 <dd><p>Append a "<code>#</code>" (U+0023), followed by the
glenn@6257 731 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a> ID to
glenn@6257 732 <var>s</var>.</dd>
glenn@6257 733
glenn@6257 734 <dt>pseudo-class</dt>
glenn@6247 735 <dd>
glenn@6257 736 <p>If the pseudo-class does not accept arguments append
glenn@6257 737 "<code>:</code>" (U+003A), followed by the name of the pseudo-class, to
glenn@6257 738 <var>s</var>.</p>
glenn@6247 739
glenn@6247 740 <p>Otherwise, append "<code>:</code>" (U+003A), followed by the name of
glenn@6257 741 the pseudo-class, followed by "<code>(</code>" (U+0028), followed by the
glenn@6257 742 value of the pseudo-class argument determined as per below, followed by
glenn@6257 743 "<code>)</code>" (U+0029), to <var>s</var>.</p>
glenn@6257 744
glenn@6257 745 <dl class="switch">
glenn@6257 746 <dt><code>:lang()</code></dt>
glenn@6257 747 <dd><p>The <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a>
glenn@6257 748 value.</dd>
glenn@6257 749
glenn@6257 750 <dt><code>:nth-child()</code></dt>
glenn@6257 751 <dt><code>:nth-last-child()</code></dt>
glenn@6257 752 <dt><code>:nth-of-type()</code></dt>
glenn@6257 753 <dt><code>:nth-last-of-type()</code></dt>
glenn@6247 754 <dd>
glenn@6247 755 <ol>
glenn@6257 756 <li><p>If the value is odd let the value be
glenn@6257 757 "<code>2n+1</code>".</li>
glenn@6257 758
glenn@6257 759 <li><p>If the value is even let the value be
glenn@6257 760 "<code>2n</code>".</li>
glenn@6257 761
glenn@6257 762 <li><p>If <var>a</var> is zero let the value be
glenn@6257 763 <var>b</var>
glenn@6257 764 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a> as &lt;integer&gt;.</li>
glenn@6257 765
glenn@6257 766 <li><p>If <var>a</var> is one or minus one and
glenn@6257 767 <var>b</var> is zero let the value be
glenn@6257 768 "<code>n</code>" (U+006E).</li>
glenn@6257 769
glenn@6257 770 <li><p>If <var>a</var> is one or minus one let the value be
glenn@6257 771 "<code>n</code>" (U+006E), followed by
glenn@6257 772 "<code>+</code>" (U+002B) if <var>b</var> is positive,
glenn@6257 773 followed by <var>b</var>
glenn@6257 774 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a> as &lt;integer&gt;.</li>
glenn@6257 775
glenn@6257 776 <li><p>If <var>b</var> is zero let the value be
glenn@6257 777 <var>a</var>
glenn@6257 778 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a> as &lt;integer&gt;,
glenn@6257 779 followed by "<code>n</code>" (U+006E).</li>
glenn@6257 780
glenn@6257 781 <li><p>Otherwise let the value be
glenn@6257 782 <var>a</var>
glenn@6257 783 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a> as &lt;integer&gt;,
glenn@6257 784 followed by "<code>n</code>" (U+006E), followed by
glenn@6257 785 "<code>+</code>" (U+002B) if <var>b</var> is positive,
glenn@6257 786 followed by <var>b</var>
glenn@6257 787 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a> as &lt;integer&gt;.</li>
glenn@6247 788 </ol>
glenn@6257 789 </dd>
glenn@6257 790
glenn@6257 791 <dt><code>:not()</code></dt>
glenn@6257 792 <dd><p>The result of serializing the value using the rules for
glenn@6257 793 <a href="#serialize-a-group-of-selectors" title="serialize a group of selectors">serializing a group of selectors</a>.</dd>
glenn@6247 794 </dl>
glenn@6257 795 </dd>
glenn@6247 796 </dl>
glenn@6257 797
glenn@6247 798 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6247 799
glenn@6257 800 <h2 id="css"><span class="secno">6 </span>CSS</h2>
glenn@6257 801
glenn@6247 802 <!-- ........................................................................................................................ -->
glenn@6247 803 <!-- ........................................................................................................................ -->
glenn@6247 804
glenn@6794 805 <h3 id="css-style-sheets"><span class="secno">6.1 </span>CSS Style Sheets</h3>
glenn@6257 806
glenn@6247 807 <!-- XXX
glenn@6247 808 element inserted into the DOM, style sheet created, element removed from
glenn@6247 809 the DOM, what happens to StyleSheet?
glenn@6247 810 -->
glenn@6247 811
glenn@6794 812 <p>A <dfn id="css-style-sheet">CSS style sheet</dfn> is an abstract concept that
glenn@6794 813 represents a style sheet as defined by the CSS specification. In the CSSOM a
glenn@6794 814 <a href="#css-style-sheet">CSS style sheet</a> is represented as a <code>CSSStyleSheet</code> object. A
glenn@6794 815 <a href="#css-style-sheet">CSS style sheet</a> has a number of associated state items:</p>
glenn@6247 816
glenn@6247 817 <dl>
glenn@6257 818 <dt><dfn id="style-sheet-type">style sheet type</dfn></dt>
glenn@6257 819 <dd><p>The literal string "<code>text/css</code>".</dd>
glenn@6257 820
glenn@6257 821 <dt><dfn id="style-sheet-location">style sheet location</dfn></dt>
glenn@6935 822 <dd><p>The <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#url">URL</a> of the
glenn@6933 823 <span>style sheet</span> or <code>null</code> if the <span>style sheet</span> was
glenn@6257 824 embedded.</dd>
glenn@6257 825
glenn@6257 826 <dt><dfn id="style-sheet-parent">style sheet parent</dfn></dt>
glenn@6794 827 <dd><p>The <span>style sheet</span> that is the parent of the
glenn@6933 828 <span>style sheet</span> or <code>null</code> if there is no associated parent.</dd>
glenn@6257 829
glenn@6257 830 <dt><dfn id="style-sheet-owner-node">style sheet owner node</dfn></dt>
glenn@6794 831 <dd><p>The DOM node associated with the <span>style sheet</span> or
glenn@6933 832 <code>null</code> if there is no associated DOM node.</dd>
glenn@6257 833
glenn@6257 834 <dt><dfn id="style-sheet-owner-css-rule">style sheet owner CSS rule</dfn></dt>
glenn@6794 835 <dd><p>The <a href="#rule">CSS rule</a> in the <a href="#style-sheet-parent">style sheet parent</a>
glenn@6933 836 that caused the inclusion of the <span>style sheet</span> or <code>null</code> if
glenn@6933 837 there is no associated rule.</dd>
glenn@6257 838
glenn@6257 839 <dt><dfn id="style-sheet-media">style sheet media</dfn></dt>
glenn@6247 840 <dd>
glenn@6257 841 <p>The <code>MediaList</code> object associated with the
glenn@6794 842 <span>style sheet</span>.</p>
glenn@6257 843
glenn@6257 844 <p>If this property is set to a string run the
glenn@6257 845 <a href="#create-a-medialist-object">create a <code>MediaList</code> object</a> steps for that
glenn@6257 846 string and associate the returned object with the
glenn@6794 847 <span>style sheet</span>.</p>
glenn@6257 848 </dd>
glenn@6257 849
glenn@6257 850 <dt><dfn id="style-sheet-title">style sheet title</dfn></dt>
glenn@6247 851 <dd>
glenn@6933 852 <p>The title of the <span>style sheet</span> or <code>null</code> if no title
glenn@6933 853 is specified or is the empty string, in which case the title is referred to
glenn@6933 854 as an empty title.</p>
glenn@6257 855
glenn@6257 856 <div class="example">
glenn@6933 857 <p>In the following, the <a href="#style-sheet-title">style sheet title</a> is non-empty
glenn@6933 858 for the first style sheet, but is empty for the second and third style sheets.</p>
glenn@7306 859 <pre>&lt;style title="papaya whip"&gt;
glenn@7306 860 body { background: #ffefd5; }
glenn@6933 861 &lt;/style&gt;</pre>
glenn@6933 862 <pre>&lt;style title=""&gt;
glenn@6942 863 body { background: orange; }
glenn@6933 864 &lt;/style&gt;</pre>
glenn@6933 865 <pre>&lt;style&gt;
glenn@6942 866 body { background: brown; }
glenn@6933 867 &lt;/style&gt;</pre>
glenn@6247 868 </div>
glenn@6257 869 </dd>
glenn@6257 870
glenn@6257 871 <dt><dfn id="style-sheet-alternate-flag">style sheet alternate flag</dfn></dt>
glenn@6247 872 <dd>
glenn@6933 873 <p>Either set or clear. Clear by default.</p>
glenn@6247 874
glenn@6257 875 <div class="example">
glenn@6794 876 <p>The following <span title="style sheet">style sheets</span> have
glenn@6257 877 their <a href="#style-sheet-alternate-flag">style sheet alternate flag</a> set:</p>
glenn@6247 878
glenn@7306 879 <pre>&lt;?xml-stylesheet alternate="yes" title="x" href="data:text/css,…"?&gt;</pre>
glenn@7306 880
glenn@7306 881 <pre>&lt;link rel="alternate stylesheet" title="x" href="data:text/css,…"&gt;</pre>
glenn@6247 882 </div>
glenn@6257 883 </dd>
glenn@6257 884
glenn@6257 885 <dt><dfn id="style-sheet-disabled-flag">style sheet disabled flag</dfn></dt>
glenn@6247 886 <dd>
glenn@6933 887 <p>Either set or clear. Clear by default.</p>
glenn@6933 888
glenn@6933 889 <p class="note">Even when clear it does not necessarily mean that the
glenn@6794 890 <span>style sheet</span> is actually used for rendering.</p>
glenn@6257 891 </dd>
glenn@6257 892
glenn@6257 893
glenn@6257 894 <dt><dfn id="style-sheet-css-rules">style sheet CSS rules</dfn></dt>
glenn@6794 895 <dd><p>The <a href="#rule" title="CSS rule">CSS rules</a> associated with the
glenn@6794 896 <span>style sheet</span>.</dd>
glenn@6247 897 </dl>
glenn@6247 898
glenn@6257 899 <p>When you are to <a href="#create-a-style-sheet">create a style sheet</a> the above properties,
glenn@6257 900 with the exception of <a href="#style-sheet-type">style sheet type</a> and
glenn@6257 901 <a href="#style-sheet-css-rules">style sheet CSS rules</a>, are to be set to
glenn@6257 902 their proper values.</p>
glenn@6257 903
glenn@6247 904 <!-- same-origin restrictions -->
glenn@6257 905
glenn@6247 906 <!-- ........................................................................................................................ -->
glenn@6247 907
glenn@6257 908 <h4 id="the-stylesheet-interface"><span class="secno">6.1.1 </span>The <code>StyleSheet</code> Interface</h4>
glenn@6257 909
glenn@6257 910 <p>The <code>StyleSheet</code> interface represents an abstract, base style sheet.</p>
glenn@6257 911 <pre class="idl"><span class="idlInterface" id="widl-def-StyleSheet">interface <span class="idlInterfaceID">StyleSheet</span> {
glenn@6257 912 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-StyleSheet-type">type</a></span>;</span>
glenn@6426 913 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-StyleSheet-href">href</a></span>;</span>
glenn@6257 914 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>Node</a></span> <span class="idlAttrName"><a href="#widl-StyleSheet-ownerNode">ownerNode</a></span>;</span>
glenn@6426 915 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>StyleSheet</a>?</span> <span class="idlAttrName"><a href="#widl-StyleSheet-parentStyleSheet">parentStyleSheet</a></span>;</span>
glenn@6426 916 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-StyleSheet-title">title</a></span>;</span>
glenn@6257 917 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>MediaList</a></span> <span class="idlAttrName"><a href="#widl-StyleSheet-media">media</a></span>;</span>
glenn@6257 918 <span class="idlAttribute"> attribute <span class="idlAttrType"><a>boolean</a></span> <span class="idlAttrName"><a href="#widl-StyleSheet-disabled">disabled</a></span>;</span>
glenn@6247 919 };</span></pre>
glenn@6257 920 <dl class="attributes">
glenn@6257 921 <dt class="attribute" id="widl-StyleSheet-type">
glenn@6257 922 <code>type</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt>
glenn@6257 923 <dd>
glenn@6257 924 <p>The <code>type</code> attribute must return the <a href="#style-sheet-type">style sheet type</a>.</dd>
glenn@6257 925 <dt class="attribute" id="widl-StyleSheet-href">
glenn@6642 926 <code>href</code> of type <span class="idlAttrType"><a>DOMString</a>?</span>, readonly</dt>
glenn@6257 927 <dd>
glenn@6942 928 <p>The <code>href</code> attribute must return the <a href="#style-sheet-location">style sheet location</a> or <code>null</code> if none.</p> <p class="issue">What should the default value be if not known or specified upon creation? an empty string or <code>null</code>?</dd>
glenn@6257 929 <dt class="attribute" id="widl-StyleSheet-ownerNode">
glenn@6257 930 <code>ownerNode</code> of type <span class="idlAttrType"><a>Node</a></span>, readonly</dt>
glenn@6257 931 <dd>
glenn@6426 932 <p>The <code>ownerNode</code> attribute must return the <a href="#style-sheet-owner-node">style sheet owner node</a>.</p> <p class="issue">Should <code>ownerNode</code> be nullable?</dd>
glenn@6257 933 <dt class="attribute" id="widl-StyleSheet-parentStyleSheet">
glenn@6642 934 <code>parentStyleSheet</code> of type <span class="idlAttrType"><a>StyleSheet</a>?</span>, readonly</dt>
glenn@6257 935 <dd>
glenn@6942 936 <p>The <code>parentStyleSheet</code> attribute must return the <a href="#style-sheet-parent">style sheet parent</a> or <code>null</code> if there is none.</dd>
glenn@6257 937 <dt class="attribute" id="widl-StyleSheet-title">
glenn@6642 938 <code>title</code> of type <span class="idlAttrType"><a>DOMString</a>?</span>, readonly</dt>
glenn@6257 939 <dd>
glenn@6942 940 <p>The <code>title</code> attribute must return the <a href="#style-sheet-title">style sheet title</a> or <code>null</code> if none.</p> <p class="issue">What should the default value be if not known or specified upon creation? an empty string or <code>null</code>?</dd>
glenn@6257 941 <dt class="attribute" id="widl-StyleSheet-media">
glenn@6257 942 <code>media</code> of type <span class="idlAttrType"><a>MediaList</a></span>, readonly</dt>
glenn@6257 943 <dd>
glenn@6426 944 <p>The <code>media</code> attribute must return the <a href="#style-sheet-media">style sheet media</a>.</p> <p class="issue">Should <code>media</code> be nullable?</p> <p class="issue">Need to define a setter that implements the semantics of setting this attribute to a string representing a MediaList.</dd>
glenn@6257 945 <dt class="attribute" id="widl-StyleSheet-disabled">
glenn@6257 946 <code>disabled</code> of type <span class="idlAttrType"><a>boolean</a></span></dt>
glenn@6257 947 <dd>
glenn@6257 948 <p>The <code>disabled</code> attribute must return true if the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> is set, or false otherwise.</p> <p>Setting the <code>disabled</code> attribute must set the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> if the new value is true, or unset the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> otherwise.</dd>
glenn@6257 949 </dl>
glenn@6257 950
glenn@6257 951
glenn@6247 952 <!-- ........................................................................................................................ -->
glenn@6247 953
glenn@6257 954 <h4 id="the-cssstylesheet-interface"><span class="secno">6.1.2 </span>The <code>CSSStyleSheet</code> Interface</h4>
glenn@6257 955
glenn@6794 956 <p>The <code>CSSStyleSheet</code> interface represents a CSS <span>style sheet</span> rule.</p>
glenn@6437 957 <pre class="idl"><span class="idlInterface" id="widl-def-CSSStyleSheet">interface <span class="idlInterfaceID">CSSStyleSheet</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-StyleSheet"><code>StyleSheet</code></a></span> {
glenn@6426 958 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSRule</a>?</span> <span class="idlAttrName"><a href="#widl-CSSStyleSheet-ownerRule">ownerRule</a></span>;</span>
glenn@6257 959 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSRuleList</a></span> <span class="idlAttrName"><a href="#widl-CSSStyleSheet-cssRules">cssRules</a></span>;</span>
glenn@6257 960 <span class="idlMethod"> <span class="idlMethType"><a>unsigned long</a></span> <span class="idlMethName"><a href="#widl-CSSStyleSheet-insertRule-unsigned-long-DOMString-rule-unsigned-long-index">insertRule</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">rule</span></span>, <span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
glenn@6257 961 <span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CSSStyleSheet-deleteRule-void-unsigned-long-index">deleteRule</a></span> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
glenn@6247 962 };</span></pre>
glenn@6257 963 <dl class="attributes">
glenn@6257 964 <dt class="attribute" id="widl-CSSStyleSheet-ownerRule">
glenn@6642 965 <code>ownerRule</code> of type <span class="idlAttrType"><a>CSSRule</a>?</span>, readonly</dt>
glenn@6257 966 <dd>
glenn@6642 967 <p>The <code>ownerRule</code> attribute must return the <a href="#style-sheet-owner-css-rule">style sheet owner CSS rule</a> or <code>null</code> if none. If a value other than <code>null</code> is ever returned, than that same value must always be returned on each get access.</dd>
glenn@6257 968 <dt class="attribute" id="widl-CSSStyleSheet-cssRules">
glenn@6257 969 <code>cssRules</code> of type <span class="idlAttrType"><a>CSSRuleList</a></span>, readonly</dt>
glenn@6257 970 <dd>
glenn@6642 971 <p>The <code>cssRules</code> attribute must return a read-only, live <code>CSSRuleList</code> object representing the <a href="#style-sheet-css-rules">style sheet CSS rules</a>. The same object must be returned on each get access.</p> <p class="note">Even though the returned <code>CSSRuleList</code> object is read-only (from the perspective of client-authored script), it may nevertheless change over time due to its liveness status. For example, invoking the <code>insertRule</code> or <code>deleteRule</code> operation may result in mutations reflected in the returned object.</dd>
glenn@6257 972 </dl>
glenn@6257 973 <dl class="methods">
glenn@6257 974 <dt class="method" id="widl-CSSStyleSheet-insertRule-unsigned-long-DOMString-rule-unsigned-long-index">
glenn@6642 975 <code>insertRule</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">rule</span></span>, <span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>), returns <span class="idlMethType"><a>unsigned long</a></span></dt>
glenn@6257 976 <dd>
glenn@6935 977 <p>The <code>insertRule</code> operation performs <dfn id="insert-a-css-rule">insert a CSS rule</dfn> <var>rule</var> as follows:</p> <ol> <li><p>Set <var>newRule</var> to the results of performing <a href="#parse-a-css-rule">parse a CSS rule</a> on argument <var>rule</var>, <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throwing</a> a "<code class="external"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code>" exception if a parse error occurs.</li> <li><p>Set <var>N</var> to <code>cssLength.length</code>.</li> <li><p>If argument <var>index</var> is greater than <var>N</var>, then <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an "<code class="external"><a href="http://dom.spec.whatwg.org/#indexsizeerror">IndexSizeError</a></code>" exception.</li> <li><p>If the rule <var>newRule</var> cannot be inserted into the specified <var>index</var> due to constraints specified by <a href="#refsCSS">[CSS]</a>, then <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> a "<code class="external"><a href="http://dom.spec.whatwg.org/#hierarchyrequesterror">HierarchyRequestError</a></code>" exception.</p> <p class="note">For example, a CSS style sheet cannot contain more than one <code>@charset</code> rule, which, if present, must be the first rule.</li> <li><p>Set <var>newRule</var><code>.parentStyleSheet</code> to <code>this</code> (i.e., this <code>CSSStyleSheet</code> instance object).</li> <li><p>Insert rule <var>newRule</var> into <code>cssRules</code> at the zero-indexed position <var>index</var>.<p></li> <li><p>Return <var>index</var>.</li> </ol> <p class="note">If a new rule is inserted, then any rule previously located at position <var>index</var> through <var>N</var> minus 1 is shifted to position <var>index</var> plus 1 through <var>N</var>, In addition, <code>cssRules.length</code> is (internally) incremented.</p> <p class="issue">DOM-2 CSS specifies that a <code>NO_MODIFICATION_ALLOWED_ERR</code> exception is thrown if the style sheet is read-only. Are there any read-only style sheets?</dd>
glenn@6257 978 <dt class="method" id="widl-CSSStyleSheet-deleteRule-void-unsigned-long-index">
glenn@6642 979 <code>deleteRule</code> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>), returns <span class="idlMethType"><a>void</a></span></dt>
glenn@6257 980 <dd>
glenn@6935 981 <p>The <code>deleteRule</code> operation performs <dfn id="remove-a-css-rule">remove a CSS rule</dfn> as follows:</p> <ol> <li><p>Set <var>N</var> to <code>cssLength.length</code>.</li> <li><p>If argument <var>index</var> is greater than or equal to <var>N</var>, then <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an "<code class="external"><a href="http://dom.spec.whatwg.org/#indexsizeerror">IndexSizeError</a></code>" exception.</li> <li><p>Set <var>oldRule</var> to <code>cssRules.prototype.item(<var>index</var>)</code>.</li> <li><p>Set <var>oldRule</var><code>.parentStyleSheet</code> to <code>null</code>.</li> <li><p>Remove rule <var>oldRule</var> from <code>cssRules</code> at the zero-indexed position <var>index</var>.<p></li> </ol> <p class="note">If an existing rule is deleted, then any rule previously located at position <var>index</var> plus 1 through <var>N</var> minus 1 is shifted to position <var>index</var> through <var>N</var> minus 2, In addition, <code>cssRules.length</code> is (internally) decremented.</dd>
glenn@6257 982 </dl>
glenn@6257 983
glenn@6257 984
glenn@6247 985 <!-- ........................................................................................................................ -->
glenn@6247 986 <!-- ........................................................................................................................ -->
glenn@6247 987
glenn@6257 988 <h3 id="style-sheet-collections"><span class="secno">6.2 </span>Style Sheet Collections</h3>
glenn@6247 989
glenn@6247 990 <p>Below various new concepts are defined that are associated with each
glenn@6935 991 <code class="external"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> object.</p>
glenn@6935 992
glenn@6935 993 <p>Each <code class="external"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> has an associated list of zero or more
glenn@6794 994 <span title="style sheet">style sheets</span>, named the
glenn@6257 995 <dfn id="document-style-sheets">document style sheets</dfn>. This is
glenn@6257 996 an ordered list that contains all
glenn@6794 997 <span title="style sheet">style sheets</span> associated with the
glenn@6935 998 <code class="external"><a href="http://dom.spec.whatwg.org/#document">Document</a></code>, in
glenn@6935 999 <a class="external" href="http://dom.spec.whatwg.org/#concept-tree-order" title="concept-tree-order">tree order</a>, with
glenn@6794 1000 <span title="style sheet">style sheets</span> created from HTTP
glenn@6257 1001 <code title="http-link">Link</code> headers first, if any, in header
glenn@6257 1002 order.</p>
glenn@6257 1003
glenn@6257 1004 <p>To <dfn id="create-a-style-sheet">create a style sheet</dfn>, run these
glenn@6257 1005 steps:</p>
glenn@6247 1006
glenn@6247 1007 <ol>
glenn@6794 1008 <li><p>Create a new <span>style sheet</span> object and set its
glenn@6257 1009 properties as specified.</li>
glenn@6257 1010
glenn@6257 1011 <li><p>Then run the <a href="#add-a-style-sheet">add a style sheet</a> steps for the newly
glenn@6794 1012 created <span>style sheet</span>.</li>
glenn@6257 1013 </ol>
glenn@6257 1014
glenn@6257 1015 <p>To <dfn id="add-a-style-sheet">add a style sheet</dfn>, run these
glenn@6257 1016 steps:</p>
glenn@6257 1017
glenn@6257 1018 <ol>
glenn@6794 1019 <li><p>Add the <span>style sheet</span> to the list of
glenn@6257 1020 <a href="#document-style-sheets">document style sheets</a> at the appropriate location. The
glenn@6257 1021 remainder of these steps deal with the
glenn@6257 1022 <a href="#style-sheet-disabled-flag">style sheet disabled flag</a>.</li>
glenn@6257 1023
glenn@6257 1024 <li><p>If the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> is set, terminate
glenn@6257 1025 these steps.</li>
glenn@6257 1026
glenn@6257 1027 <li><p>If the <a href="#style-sheet-title">style sheet title</a> is non-empty, the
glenn@6933 1028 <a href="#style-sheet-alternate-flag">style sheet alternate flag</a> is clear, and
glenn@6257 1029 <a href="#preferred-style-sheet-set-name">preferred style sheet set name</a> is the empty string
glenn@6257 1030 <a href="#change-the-preferred-style-sheet-set-name">change the preferred style sheet set name</a> to the
glenn@6257 1031 <a href="#style-sheet-title">style sheet title</a>.</li>
glenn@6257 1032
fantasai@6256 1033 <li>
glenn@6933 1034 <p>If any of the following is true clear the
glenn@6257 1035 <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> and terminate these steps:
glenn@6257 1036
glenn@6257 1037 <ul>
glenn@6257 1038 <li><p>The <a href="#style-sheet-title">style sheet title</a> is empty.</li>
glenn@6933 1039 <li><p>The <a href="#last-style-sheet-set-name">last style sheet set name</a> is <code>null</code> and the
glenn@6257 1040 <a href="#style-sheet-title">style sheet title</a> is a
glenn@6935 1041 <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match
glenn@6257 1042 for the <a href="#preferred-style-sheet-set-name">preferred style sheet set name</a>.</li>
glenn@6257 1043 <li><p>The <a href="#style-sheet-title">style sheet title</a> is a
glenn@6935 1044 <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for the
glenn@6257 1045 <a href="#last-style-sheet-set-name">last style sheet set name</a>.</li>
glenn@6257 1046 </ul>
glenn@6257 1047 </li>
glenn@6257 1048
glenn@6257 1049 <li><p>Set the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a>.</li>
glenn@6247 1050 </ol>
glenn@6247 1051
glenn@6257 1052 <p>A <dfn id="persistent-style-sheet">persistent style sheet</dfn> is a
glenn@6794 1053 <span>style sheet</span> from the <a href="#document-style-sheets">document style sheets</a>
glenn@6257 1054 whose <a href="#style-sheet-title">style sheet title</a> is the empty string and whose
glenn@6933 1055 <a href="#style-sheet-alternate-flag">style sheet alternate flag</a> is clear.</p>
glenn@6257 1056
glenn@6257 1057 <p>A <dfn id="style-sheet-set">style sheet set</dfn> is an ordered
glenn@6794 1058 collection of one or more <span title="style sheet">style sheets</span>
glenn@6257 1059 from the <a href="#document-style-sheets">document style sheets</a> which have an identical
glenn@6257 1060 <a href="#style-sheet-title">style sheet title</a> that is not the empty string.</p>
glenn@6257 1061
glenn@6257 1062 <p>A <dfn id="style-sheet-set-name">style sheet set name</dfn> is the
glenn@6257 1063 <a href="#style-sheet-title">style sheet title</a> the <a href="#style-sheet-set">style sheet set</a> has in
glenn@6257 1064 common.</p>
glenn@6257 1065
glenn@6257 1066 <p>An <dfn id="enabled-style-sheet-set">enabled style sheet set</dfn> is a
glenn@6794 1067 <a href="#style-sheet-set">style sheet set</a> of which each <span>style sheet</span> has
glenn@6933 1068 its <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> clear.</p>
glenn@6257 1069
glenn@6257 1070 <p>To <dfn id="enable-a-style-sheet-set">enable a style sheet set</dfn>
glenn@6257 1071 with name <var>name</var>, run these steps:</p>
glenn@6247 1072
glenn@6247 1073 <ol>
glenn@6257 1074 <li><p>If <var>name</var> is the empty string, set the
glenn@6794 1075 <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> for each <span>style sheet</span>
glenn@6257 1076 that is in a <a href="#style-sheet-set">style sheet set</a> and terminate these steps.</li>
glenn@6257 1077
glenn@6933 1078 <li><p>Clear the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> for each
glenn@6794 1079 <span>style sheet</span> in a <a href="#style-sheet-set">style sheet set</a> whose
glenn@6257 1080 <a href="#style-sheet-set-name">style sheet set name</a> is a
glenn@6935 1081 <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for
glenn@6257 1082 <var>name</var> and set it for all other
glenn@6794 1083 <span title="style sheet">style sheets</span> in a
glenn@6257 1084 <a href="#style-sheet-set">style sheet set</a>.</li>
glenn@6247 1085 </ol>
glenn@6247 1086
glenn@6257 1087 <p>To <dfn id="select-a-style-sheet-set">select a style sheet set</dfn>
glenn@6257 1088 with name <var>name</var>, run these steps:</p>
glenn@6247 1089
glenn@6247 1090 <ol>
glenn@6257 1091 <li><p><a href="#enable-a-style-sheet-set">Enable a style sheet set</a> with name
glenn@6257 1092 <var>name</var>.</li>
glenn@6257 1093
glenn@6257 1094 <li><p>Set <a href="#last-style-sheet-set-name">last style sheet set name</a> to
glenn@6257 1095 <var>name</var>.</li>
glenn@6247 1096 </ol>
glenn@6247 1097
glenn@6257 1098 <p>A <dfn id="last-style-sheet-set-name">last style sheet set name</dfn>
glenn@6257 1099 is a concept to determine what <a href="#style-sheet-set">style sheet set</a> was last
glenn@6257 1100 <a href="#select-a-style-sheet-set" title="select a style sheet set">selected</a>. Initially its
glenn@6933 1101 value is <code>null</code>.</p>
glenn@6257 1102
glenn@6257 1103 <p>A
glenn@6257 1104 <dfn id="preferred-style-sheet-set-name">preferred style sheet set name</dfn>
glenn@6257 1105 is a concept to determine which
glenn@6794 1106 <span title="style sheet">style sheets</span> need to have their
glenn@6933 1107 <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> clear. Initially its value
glenn@6257 1108 is the empty string.
glenn@6257 1109
glenn@6257 1110 <p>To
glenn@6257 1111 <dfn id="change-the-preferred-style-sheet-set-name">change the preferred style sheet set name</dfn>
glenn@6257 1112 with name <var>name</var>, run these steps:</p>
glenn@6247 1113
glenn@6247 1114 <ol>
glenn@6427 1115 <li><p>Let <var>current</var> be the <a href="#preferred-style-sheet-set-name">preferred style sheet set name</a>.</li>
glenn@6257 1116
glenn@6257 1117 <li><p>Set <a href="#preferred-style-sheet-set-name">preferred style sheet set name</a> to
glenn@6257 1118 <var>name</var>.</li>
glenn@6257 1119
glenn@6257 1120 <li><p>If <var>name</var> is not a
glenn@6935 1121 <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for
glenn@6257 1122 <var>current</var> and
glenn@6933 1123 <a href="#last-style-sheet-set-name">last style sheet set name</a> is <code>null</code>
glenn@6257 1124 <a href="#enable-a-style-sheet-set">enable a style sheet set</a> with name
glenn@6427 1125 <var>name</var>.</li>
glenn@6247 1126 </ol>
glenn@6247 1127
glenn@6247 1128 <!-- XXX ought to define "applied"
glenn@6247 1129
glenn@6247 1130 thoughts:
glenn@6247 1131 depends on disabled flag, alternate flag, media queries, sheesh
glenn@6247 1132 -->
glenn@6257 1133
glenn@6247 1134 <!-- ........................................................................................................................ -->
glenn@6247 1135
glenn@6257 1136 <h4 id="the-http-default-style-header"><span class="secno">6.2.1 </span>The HTTP <code>Default-Style</code> Header</h4>
glenn@6257 1137
glenn@6257 1138 <p>The HTTP <code title="http-default-style"><a href="#default-style">Default-Style</a></code> header
glenn@6257 1139 can be used to set the <a href="#preferred-style-sheet-set-name">preferred style sheet set name</a>
glenn@6257 1140 influencing which <a href="#style-sheet-set">style sheet set</a> is (initially) the
glenn@6257 1141 <a href="#enabled-style-sheet-set">enabled style sheet set</a>.</p>
glenn@6257 1142
glenn@6257 1143 <p>For each HTTP <code title="http-default-style"><a href="#default-style">Default-Style</a></code>
glenn@6257 1144 header, in header order, the user agent must
glenn@6257 1145 <a href="#change-the-preferred-style-sheet-set-name">change the preferred style sheet set name</a> with name being the
glenn@6257 1146 value of the header.</p>
glenn@6257 1147
glenn@6247 1148 <!-- ........................................................................................................................ -->
glenn@6247 1149
glenn@6257 1150 <h4 id="the-stylesheetlist-sequence"><span class="secno">6.2.2 </span>The <code>StyleSheetList</code> Sequence</h4>
glenn@6257 1151
glenn@6257 1152 <p>The <code>StyleSheetList</code> sequence represents an ordered collection of <span title="style sheets">style sheets</span>.</p>
glenn@6257 1153 <pre class="idl">[[TBD - TYPEDEF]]
glenn@6247 1154 </pre>
glenn@6257 1155
glenn@6257 1156
glenn@6247 1157 <!-- ........................................................................................................................ -->
glenn@6247 1158
glenn@6257 1159 <h4 id="extensions-to-the-document-interface"><span class="secno">6.2.3 </span>Extensions to the <code>Document</code> Interface</h4>
glenn@6257 1160
glenn@6257 1161
glenn@6257 1162 <pre class="idl"><span class="idlInterface" id="widl-def-Document">partial interface <span class="idlInterfaceID">Document</span> {
glenn@6257 1163 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>StyleSheetList</a></span> <span class="idlAttrName"><a href="#widl-Document-styleSheets">styleSheets</a></span>;</span>
glenn@6257 1164 <span class="idlAttribute"> attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-Document-selectedStyleSheetSet">selectedStyleSheetSet</a></span>;</span>
glenn@6257 1165 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-Document-lastStyleSheetSet">lastStyleSheetSet</a></span>;</span>
glenn@6257 1166 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-Document-preferredStyleSheetSet">preferredStyleSheetSet</a></span>;</span>
glenn@6257 1167 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMStringList</a></span> <span class="idlAttrName"><a href="#widl-Document-styleSheetSets">styleSheetSets</a></span>;</span>
glenn@6257 1168 <span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-Document-enableStyleSheetsForSet-void-DOMString-name">enableStyleSheetsForSet</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a>?</span> <span class="idlParamName">name</span></span>);</span>
glenn@6247 1169 };</span></pre>
glenn@6257 1170 <dl class="attributes">
glenn@6257 1171 <dt class="attribute" id="widl-Document-styleSheets">
glenn@6257 1172 <code>styleSheets</code> of type <span class="idlAttrType"><a>StyleSheetList</a></span>, readonly</dt>
glenn@6257 1173 <dd>
glenn@6257 1174 <p>The <code>styleSheets</code> attribute must return a <code>StyleSheetList</code> sequence representing the <a href="#document-style-sheets">document style sheets</a>.</p> <p class="note">Because of historical IDL limitations the <code>styleSheets</code> attribute used to be on a separate interface, <code>DocumentStyle</code>.</dd>
glenn@6257 1175 <dt class="attribute" id="widl-Document-selectedStyleSheetSet">
glenn@6642 1176 <code>selectedStyleSheetSet</code> of type <span class="idlAttrType"><a>DOMString</a>?</span></dt>
glenn@6257 1177 <dd>
glenn@6942 1178 <p>The <code>selectedStyleSheetSet</code> attribute must, on getting, must run these steps:</p> <ol> <li><p>If there is a single <a href="#enabled-style-sheet-set">enabled style sheet set</a> and no other <a href="#document-style-sheets">document style sheets</a> with a non-empty <a href="#style-sheet-title">style sheet title</a> have the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> unset, return the <a href="#style-sheet-set-name">style sheet set name</a> of the <a href="#enabled-style-sheet-set">enabled style sheet set</a> and terminate these steps.</li> <li><p>Otherwise, if <span title="style sheet">style sheets</span> from different <a href="#style-sheet-set" title="style sheet set">style sheet sets</a> have their <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> unset, return <code>null</code> and terminate these steps.</li> <li> <p>Otherwise, return the empty string.</p> <p class="note">At this point either all <span title="style sheet">style sheets</span> with a non-empty <a href="#style-sheet-title">style sheet title</a> have the <a href="#style-sheet-disabled-flag">style sheet disabled flag</a> set, or there are no such <span title="style sheet">style sheets</span>.</p> </li> </ol> <p>On setting the <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code> attribute these steps must be run:</p> <ol> <li><p>If the value is <code>null</code> terminate this set of steps.</li> <li><p>Otherwise, <a href="#select-a-style-sheet-set">select a style sheet set</a> with as name the value passed.</li> </ol> <p>From the DOM's perspective, all views have the same <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>. If a user agent supports multiple views with different selected alternative style sheets, then this attribute (and the <code>StyleSheet</code> interface's <code title="dom-StyleSheet-disabled">disabled</code> attribute) must return and set the value for the default view.</dd>
glenn@6257 1179 <dt class="attribute" id="widl-Document-lastStyleSheetSet">
glenn@6642 1180 <code>lastStyleSheetSet</code> of type <span class="idlAttrType"><a>DOMString</a>?</span>, readonly</dt>
glenn@6257 1181 <dd>
glenn@6942 1182 <p>The <code>lastStyleSheetSet</code> attribute must return the <a href="#last-style-sheet-set-name">last style sheet set name</a>.</p> <p class="note">This attribute is initially <code>null</code>.</dd>
glenn@6257 1183 <dt class="attribute" id="widl-Document-preferredStyleSheetSet">
glenn@6642 1184 <code>preferredStyleSheetSet</code> of type <span class="idlAttrType"><a>DOMString</a>?</span>, readonly</dt>
glenn@6257 1185 <dd>
glenn@6257 1186 <p>The <code>preferredStyleSheetSet</code> attribute must return the <a href="#preferred-style-sheet-set-name">preferred style sheet set name</a>.</p> <p class="note">Unlike <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>, this attribute is initially the empty string.</dd>
glenn@6257 1187 <dt class="attribute" id="widl-Document-styleSheetSets">
glenn@6257 1188 <code>styleSheetSets</code> of type <span class="idlAttrType"><a>DOMStringList</a></span>, readonly</dt>
glenn@6257 1189 <dd>
glenn@6257 1190 <p>The <code>styleSheetSets</code> attribute must return a list of the <a href="#style-sheet-set-name" title="style sheet set name">style sheet set names</a> of the <a href="#style-sheet-set" title="style sheet set">style sheet sets</a>, in order of the <a href="#document-style-sheets">document style sheets</a>.</dd>
glenn@6257 1191 </dl>
glenn@6257 1192 <dl class="methods">
glenn@6257 1193 <dt class="method" id="widl-Document-enableStyleSheetsForSet-void-DOMString-name">
glenn@6642 1194 <code>enableStyleSheetsForSet</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a>?</span> <span class="idlParamName">name</span></span>), returns <span class="idlMethType"><a>void</a></span></dt>
glenn@6257 1195 <dd>
glenn@6942 1196 <p>The <code>enableStyleSheetsForSet</code> operation must, when invoked, run these steps:</p> <ol> <li><p>If <var>name</var> is <code>null</code> terminate these steps.</li> <li><p><a href="#enable-a-style-sheet-set">Enable a style sheet set</a> with name <var>name</var>.</li> </ol> <p class="note"><span title="Style sheet">Style sheets</span> with an empty <a href="#style-sheet-title">style sheet title</a> are never affected by this method. This method does not change the values of the <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code> or <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code> attributes.</dd>
glenn@6257 1197 </dl>
glenn@6257 1198
glenn@6257 1199
glenn@6247 1200 <!-- ........................................................................................................................ -->
glenn@6247 1201
glenn@6257 1202 <h4 id="interaction-with-the-user-interface"><span class="secno">6.2.4 </span>Interaction with the User Interface</h4>
glenn@6257 1203
glenn@6257 1204 <p>The user interface of Web browsers that support style sheets
glenn@6257 1205 should list the style sheet titles given in the
glenn@6257 1206 <code title="dom-Document-styleSheetSets">styleSheetSets</code> list,
glenn@6257 1207 showing the
glenn@6257 1208 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
glenn@6257 1209 as the selected style sheet set, leaving none selected if it is
glenn@6933 1210 <code>null</code> or the empty string, and selecting an extra option
glenn@6257 1211 "Basic Page Style" (or similar) if it is the empty string and the
glenn@6257 1212 <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code>
glenn@6257 1213 is the empty string as well.</p>
glenn@6257 1214
glenn@6257 1215 <p>Selecting a style sheet from this list should
glenn@6257 1216 use the <a href="#select-a-style-sheet-set">select a style sheet set</a> set of steps. This
glenn@6257 1217 (by definition) affects the
glenn@6257 1218 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>
glenn@6257 1219 attribute.</p>
glenn@6257 1220
glenn@6257 1221 <h5 id="persisting-the-selected-style-sheet-set"><span class="secno">6.2.4.1 </span>Persisting the selected style sheet set</h5>
glenn@6247 1222
glenn@6247 1223 <p>If a user agent persist the selected style sheet set, they should use
glenn@6257 1224 the value of the
glenn@6257 1225 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
glenn@6933 1226 attribute, or if that is <code>null</code>, the
glenn@6257 1227 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>
glenn@6257 1228 attribute, when leaving the page (or at some other time) to determine the
glenn@6933 1229 set name to store. If that is <code>null</code> then the style sheet set should not be
glenn@6257 1230 persisted.</p>
glenn@6247 1231
glenn@6247 1232 <p>When re-setting the style sheet set to the persisted value (which can
glenn@6257 1233 happen at any time, typically at the first time the style sheets are
glenn@6257 1234 needed for styling the document, after the <code>&lt;head&gt;</code> of
glenn@6257 1235 the document has been parsed, after any scripts that are not dependent on
glenn@6257 1236 computed style have executed), the style sheet set
glenn@6257 1237 should be set by using the
glenn@6257 1238 <a href="#select-a-style-sheet-set">select a style sheet set</a> set of steps as if the user had
glenn@6257 1239 selected the set manually.</p>
glenn@6257 1240
glenn@6257 1241 <p class="note">This specification does not give any suggestions on
glenn@6257 1242 how user agents should decide to persist the style sheet set or whether or
glenn@6257 1243 how to persist the selected set across pages.</p>
glenn@6257 1244
glenn@6247 1245 <!-- XXX this UI section suggests we may want to introduce a few more
glenn@6247 1246 idioms -->
glenn@6257 1247
glenn@6247 1248 <!-- ........................................................................................................................ -->
glenn@6247 1249
glenn@6257 1250 <h4 id="examples"><span class="secno">6.2.5 </span>Examples</h4>
glenn@6257 1251
glenn@6257 1252 <div class="example">
glenn@6247 1253 <p>Thus, in the following HTML snippet:</p>
glenn@6247 1254
glenn@6346 1255 <pre>&lt;link rel="alternate stylesheet" title="foo" href="a"&gt;
glenn@6247 1256 &lt;link rel="alternate stylesheet" title="bar" href="b"&gt;
glenn@6247 1257 &lt;script&gt;
glenn@6247 1258 document.selectedStyleSheetSet = 'foo';
glenn@6247 1259 document.styleSheets[1].disabled = false;
glenn@6247 1260 &lt;/script&gt;
glenn@6247 1261 &lt;link rel="alternate stylesheet" title="foo" href="c"&gt;
glenn@6247 1262 &lt;link rel="alternate stylesheet" title="bar" href="d"&gt;</pre>
glenn@6247 1263
glenn@6257 1264 <p>...the style sheets that end up enabled are style sheets "a", "b",
glenn@6257 1265 and "c", the
glenn@6257 1266 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
glenn@6933 1267 attribute would return <code>null</code>,
glenn@6257 1268 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>
glenn@6257 1269 would return "foo", and
glenn@6257 1270 <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code>
glenn@6257 1271 would return the empty string.</p>
glenn@6247 1272
glenn@6247 1273 <p>Similarly, in the following HTML snippet:</p>
glenn@6247 1274
glenn@6346 1275 <pre>&lt;link rel="alternate stylesheet" title="foo" href="a"&gt;
glenn@6247 1276 &lt;link rel="alternate stylesheet" title="bar" href="b"&gt;
glenn@6247 1277 &lt;script&gt;
glenn@6247 1278 var before = document.preferredStyleSheetSet;
glenn@6247 1279 document.styleSheets[1].disabled = false;
glenn@6247 1280 &lt;/script&gt;
glenn@6247 1281 &lt;link rel="stylesheet" title="foo" href="c"&gt;
glenn@6247 1282 &lt;link rel="alternate stylesheet" title="bar" href="d"&gt;
glenn@6247 1283 &lt;script&gt;
glenn@6247 1284 var after = document.preferredStyleSheetSet;
glenn@6247 1285 &lt;/script&gt;</pre>
glenn@6247 1286
glenn@6257 1287 <p>...the "before" variable will be equal to the empty string, the
glenn@6257 1288 "after" variable will be equal to "foo", and style sheets "a" and "c"
glenn@6257 1289 will be enabled. This is the case even though the first script block
glenn@6257 1290 sets style sheet "b" to be enabled, because upon parsing the
glenn@6257 1291 following <code>&lt;link&gt;</code> element, the
glenn@6257 1292 <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code>
glenn@6257 1293 is set and the
glenn@6257 1294 <code title="dom-Document-enableStyleSheetsForSet">enableStyleSheetsForSet()</code>
glenn@6257 1295 method is called (since
glenn@6257 1296 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
glenn@6257 1297 was never set
glenn@6257 1298 explicitly, leaving
glenn@6257 1299 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code> at
glenn@6933 1300 <code>null</code> throughout), which changes which style sheets are enabled and which
glenn@6257 1301 are not.</p>
glenn@6247 1302 </div>
glenn@6257 1303
glenn@6247 1304 <!-- ........................................................................................................................ -->
glenn@6247 1305 <!-- ........................................................................................................................ -->
glenn@6247 1306
glenn@6257 1307 <h3 id="style-sheet-association"><span class="secno">6.3 </span>Style Sheet Association</h3>
glenn@6257 1308
glenn@6257 1309 <p>This section defines the interface a
glenn@6794 1310 <a href="#style-sheet-owner-node">style sheet owner node</a> of a <span>style sheet</span> has to
glenn@6257 1311 implement and defines the requirements for
glenn@6257 1312 <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-xml-stylesheet" title="xml-stylesheet processing instruction">xml-stylesheet processing instructions</a>
glenn@6257 1313 and HTTP <code title="http-link">Link</code> headers when the link
glenn@6257 1314 relation type is an
glenn@6935 1315 <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for
glenn@6257 1316 "<code>stylesheet</code>" since nobody else was interested in
glenn@6257 1317 defining this.</p>
glenn@6257 1318
glenn@6257 1319 <p class="note">The editor is in good hope that HTML and SVG will define the
glenn@6257 1320 appropriate processing in their respective specifications, in terms of
glenn@6257 1321 this specification, in due course.</p>
glenn@6257 1322
glenn@6257 1323
glenn@6247 1324 <!-- ........................................................................................................................ -->
glenn@6247 1325
glenn@6257 1326 <h4 id="the-linkstyle-interface"><span class="secno">6.3.1 </span>The <code>LinkStyle</code> Interface</h4>
glenn@6257 1327
glenn@6794 1328 <p>The <dfn id="associated-style-sheet">associated style sheet</dfn> of a node is the <span>style sheet</span> in the list of <a href="#document-style-sheets">document style sheets</a> of which the <a href="#style-sheet-owner-node">style sheet owner node</a> implements the <code>LinkStyle</code> interface.</p>
glenn@6437 1329 <pre class="idl"><span class="idlInterface" id="widl-def-LinkStyle">[NoInterfaceObject]
glenn@6437 1330 interface <span class="idlInterfaceID">LinkStyle</span> {
glenn@7307 1331 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>StyleSheet</a>?</span> <span class="idlAttrName"><a href="#widl-LinkStyle-sheet">sheet</a></span>;</span>
glenn@6247 1332 };</span></pre>
glenn@6257 1333 <dl class="attributes">
glenn@6257 1334 <dt class="attribute" id="widl-LinkStyle-sheet">
glenn@7307 1335 <code>sheet</code> of type <span class="idlAttrType"><a>StyleSheet</a>?</span>, readonly</dt>
glenn@6257 1336 <dd>
glenn@7307 1337 <p>The <code>sheet</code> attribute must return the <a href="#associated-style-sheet">associated style sheet</a> for the node or <code>null</code> if there is no <a href="#associated-style-sheet">associated style sheet</a>.</dd>
glenn@6257 1338 </dl>
glenn@6257 1339
glenn@6257 1340
glenn@6257 1341 <div class="example">
glenn@7307 1342 <p>In the following fragment, the first <code>style</code>
glenn@6257 1343 element has a <code>sheet</code> attribute that returns a
glenn@6257 1344 <code>StyleSheet</code> object representing the style sheet, but for
glenn@7307 1345 the second <code>style</code> element, the <code>style</code> attribute returns <code>null</code>,
glenn@7307 1346 assuming the user agent supports CSS (<code>text/css</code>), but does
glenn@7307 1347 not support the (hypothetical) ExampleSheets (<code>text/example-sheets</code>).</p>
glenn@7307 1348
glenn@7307 1349 <pre>&lt;style type="text/css"&gt;
glenn@7307 1350 body { background:lime }
glenn@7307 1351 &lt;/style&gt;</pre>
glenn@7307 1352 <pre>&lt;style type="text/example-sheets"&gt;
glenn@7307 1353 $(body).background := lime
glenn@7307 1354 &lt;/style&gt;</pre>
glenn@6247 1355 </div>
glenn@6247 1356
glenn@6257 1357 <p class="note">Whether or not the node refers to a style sheet is defined
glenn@6257 1358 by the specification that defines the semantics of said node.</p>
glenn@6257 1359
glenn@6247 1360 <!-- ........................................................................................................................ -->
glenn@6247 1361
glenn@6257 1362 <h4 id="requirements-on-specifications"><span class="secno">6.3.2 </span>Requirements on specifications</h4>
glenn@6247 1363
glenn@6247 1364 <p>Specifications introducing new ways of associating style sheets through
glenn@6257 1365 the DOM should define which nodes implement the
glenn@6257 1366 <code>LinkStyle</code> interface. When doing so, they
glenn@6794 1367 must also define when a <span>style sheet</span> is
glenn@6257 1368 <a href="#create-a-style-sheet" title="create a style sheet">created</a>.</p>
glenn@6257 1369
glenn@6257 1370
glenn@6257 1371
glenn@6257 1372
glenn@6247 1373 <!-- ........................................................................................................................ -->
glenn@6247 1374
glenn@6257 1375 <h4 id="requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction"><span class="secno">6.3.3 </span>Requirements on User Agents Implementing the
glenn@6257 1376 <span><code>xml-stylesheet</code> processing instruction</span></h4>
glenn@6257 1377
glenn@6247 1378 <!-- XXX load/error events, reparse -->
glenn@6247 1379
glenn@6257 1380
glenn@6257 1381 <pre class="idl">[[TBD - IMPLEMENTS]]
glenn@6247 1382 </pre>
glenn@6257 1383
glenn@6257 1384
glenn@6247 1385 <!--
glenn@6247 1386 <pre class="idl"><span data-anolis-spec=dom>ProcessingInstruction</span> implements <span>LinkStyle</span>;</pre>
glenn@6247 1387 -->
glenn@6247 1388
glenn@6257 1389 <p>For each
glenn@6257 1390 <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-xml-stylesheet"><code>xml-stylesheet</code> processing instruction</a>
glenn@6257 1391 that is not part of the
glenn@6257 1392 <a class="external" href="http://www.w3.org/TR/xml/#dt-doctype">document type declaration</a> and has an
glenn@6257 1393 <code>href</code>
glenn@6257 1394 <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a> these steps must
glenn@6257 1395 (unless otherwise stated) be run:</p>
glenn@6247 1396
glenn@6247 1397 <ol>
glenn@6257 1398 <li><p>Let <var>title</var> be the value of the
glenn@6257 1399 <code>title</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a> or the empty string if the
glenn@6257 1400 <code>title</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a> is not specified.</li>
glenn@6257 1401
glenn@6257 1402 <li><p>If there is an <code>alternate</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a>
glenn@6935 1403 whose value is a <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match
glenn@6257 1404 for "<code>yes</code>" and <var>title</var> is the
glenn@6257 1405 empty string terminate these steps.</li>
glenn@6257 1406
glenn@6257 1407 <li><p>If there is a <code>type</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a> whose
glenn@6794 1408 value is not a <span>supported styling language</span> the user agent
glenn@6257 1409 may terminate these steps.</li>
glenn@6257 1410
glenn@6935 1411 <li><p><a class="external" href="http://dev.w3.org/html5/spec/single-page.html#resolve-a-url" title="Resolve a URL">Resolve</a>
glenn@6935 1412 the <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#url">URL</a> specified by the
glenn@6257 1413 <code>href</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a> and then
glenn@6935 1414 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#fetch">fetch</a> it.</li>
glenn@6257 1415
glenn@6247 1416 <li>
glenn@6257 1417 <p>When the resource is available, the document is in
glenn@6935 1418 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#quirks-mode">quirks mode</a>
glenn@6257 1419 and the
glenn@6935 1420 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#content-type" title="content-type">Content-Type metadata</a> of
glenn@6794 1421 the resource is not a <span>supported styling language</span> change the
glenn@6935 1422 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#content-type" title="content-type">Content-Type metadata</a> of the resource
glenn@6257 1423 to <code>text/css</code>.</p>
glenn@6257 1424
glenn@6257 1425 <p class="note">This step might never actually happen, but is included
glenn@6257 1426 here in case other specifications change, to keep things consistent.</p>
glenn@6257 1427 </li>
glenn@6257 1428
glenn@6257 1429 <li><p>If the resource is not in a
glenn@6794 1430 <span>supported styling language</span> terminate these steps.</li>
glenn@6247 1431
glenn@6247 1432 <li>
glenn@6257 1433 <p><a href="#create-a-style-sheet">Create a style sheet</a> with the following properties:</p>
glenn@6257 1434
glenn@6257 1435 <dl>
glenn@6257 1436 <dt><a href="#style-sheet-location">style sheet location</a></dt>
glenn@6935 1437 <dd><p>The <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#absolute-url">absolute URL</a> of the
glenn@6257 1438 resource.</dd>
glenn@6257 1439
glenn@6257 1440 <dt><a href="#style-sheet-parent">style sheet parent</a></dt>
glenn@6933 1441 <dd><p><code>null</code></dd>
glenn@6257 1442
glenn@6257 1443 <dt><a href="#style-sheet-owner-node">style sheet owner node</a></dt>
glenn@6257 1444 <dd><p>The node.</dd>
glenn@6257 1445
glenn@6257 1446 <dt><a href="#style-sheet-owner-css-rule">style sheet owner CSS rule</a></dt>
glenn@6933 1447 <dd><p><code>null</code></dd>
glenn@6257 1448
glenn@6257 1449 <dt><a href="#style-sheet-media">style sheet media</a></dt>
glenn@6257 1450 <dd><p>The value of the <code>media</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a>
glenn@6257 1451 if any, or the empty string otherwise.</dd>
glenn@6257 1452
glenn@6257 1453 <dt><a href="#style-sheet-title">style sheet title</a></dt>
glenn@6257 1454 <dd><p><var>title</var></dd>
glenn@6257 1455
glenn@6257 1456 <dt><a href="#style-sheet-alternate-flag">style sheet alternate flag</a></dt>
glenn@6257 1457 <dd><p>Set if the <code>alternate</code> <a class="external" href="http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute">pseudo-attribute</a>
glenn@6935 1458 value is a <a class="external" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for
glenn@6933 1459 "<code>yes</code>", or clear otherwise.
glenn@6257 1460 </dl>
glenn@6257 1461 </li>
glenn@6257 1462 </ol>
glenn@6257 1463
glenn@6257 1464
glenn@6257 1465
glenn@6257 1466 <!-- ........................................................................................................................ -->
glenn@6257 1467
glenn@6257 1468 <h4 id="requirements-on-user-agents-implementing-the-http-link-header"><span class="secno">6.3.4 </span>Requirements on User Agents Implementing the HTTP
glenn@6257 1469 <code>Link</code> Header</h4>
glenn@6257 1470
glenn@6257 1471 <!-- XXX ref, one day -->
glenn@6257 1472
glenn@6257 1473 <!-- XXX deal with media param -->
glenn@6257 1474
glenn@6257 1475 <p>For each HTTP <code title="http-link">Link</code> header of which one
glenn@6257 1476 of the link relation types is an
glenn@6935 1477 <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match
glenn@6257 1478 for "<code>stylesheet</code>" these steps
glenn@6257 1479 must be run:</p>
glenn@6257 1480
glenn@6257 1481 <ol>
glenn@6257 1482 <li><p>Let <var>title</var> be the value of the first of all the
glenn@6257 1483 <code>title</code> and <code>title*</code> parameters.
glenn@6257 1484 If there are no such parameters it is the empty string.</li>
glenn@6257 1485
glenn@6257 1486 <li><p>If one of the (other) link relation types is an
glenn@6935 1487 <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for
glenn@6257 1488 "<code>alternate</code>" and <var>title</var> is the
glenn@6257 1489 empty string terminate these steps.</li>
glenn@6257 1490
glenn@6935 1491 <li><p><a class="external" href="http://dev.w3.org/html5/spec/single-page.html#resolve-a-url" title="Resolve a URL">Resolve</a>
glenn@6935 1492 the specified <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#url">URL</a> and
glenn@6935 1493 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#fetch">fetch</a> it.</li>
glenn@6257 1494
glenn@6257 1495 <li><p>When the resource is available, the document is in
glenn@6935 1496 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#quirks-mode">quirks mode</a>
glenn@6935 1497 and the <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#content-type" title="content-type">Content-Type metadata</a> of
glenn@6794 1498 the resource is not a <span>supported styling language</span> change the
glenn@6935 1499 <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#content-type" title="content-type">Content-Type metadata</a> of the resource
glenn@6257 1500 to <code>text/css</code>.</li>
glenn@6257 1501
glenn@6257 1502 <li><p>If the resource is not in a
glenn@6794 1503 <span>supported styling language</span> terminate these steps.</li>
fantasai@6256 1504
fantasai@6256 1505 <li>
glenn@6257 1506 <p><a href="#create-a-style-sheet">Create a style sheet</a> with the following properties:</p>
glenn@6247 1507
glenn@6247 1508 <dl>
glenn@6257 1509 <dt><a href="#style-sheet-location">style sheet location</a></dt>
glenn@6935 1510 <dd><p>The <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#absolute-url">absolute URL</a> of the
glenn@6257 1511 resource.</dd>
glenn@6257 1512
glenn@6257 1513 <dt><a href="#style-sheet-owner-node">style sheet owner node</a></dt>
glenn@6933 1514 <dd><p><code>null</code></dd>
glenn@6257 1515
glenn@6257 1516 <dt><a href="#style-sheet-parent">style sheet parent</a></dt>
glenn@6933 1517 <dd><p><code>null</code></dd>
glenn@6257 1518
glenn@6257 1519 <dt><a href="#style-sheet-owner-css-rule">style sheet owner CSS rule</a></dt>
glenn@6933 1520 <dd><p><code>null</code></dd>
glenn@6257 1521
glenn@6257 1522 <dt><a href="#style-sheet-media">style sheet media</a></dt>
glenn@6257 1523 <dd><p>The value of the first <code>media</code> parameter.</dd>
glenn@6257 1524 <!-- XXX register media parameter? bah -->
glenn@6257 1525
glenn@6257 1526 <dt><a href="#style-sheet-title">style sheet title</a></dt>
glenn@6257 1527 <dd><p><var>title</var></dd>
glenn@6257 1528
glenn@6257 1529 <dt><a href="#style-sheet-alternate-flag">style sheet alternate flag</a></dt>
glenn@6257 1530 <dd><p>Set if one of the specified link relation type for this HTTP
glenn@6257 1531 <code title="http-link">Link</code> header is an
glenn@6935 1532 <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for
glenn@6257 1533 "<code>alternate</code>", or false otherwise.
glenn@6247 1534 </dl>
glenn@6257 1535 </li>
glenn@6247 1536 </ol>
glenn@6257 1537
glenn@6247 1538 <!-- ........................................................................................................................ -->
glenn@6247 1539 <!-- ........................................................................................................................ -->
glenn@6257 1540
glenn@6257 1541 <h3 id="css-rules"><span class="secno">6.4 </span>CSS Rules</h3>
glenn@6257 1542
glenn@6794 1543 <p>A <dfn id="rule">CSS rule</dfn> is an abstract concept that
glenn@6933 1544 denotes a rule as defined by the CSS specification. A
glenn@6794 1545 <a href="#rule">CSS rule</a> is represented as an object that implements a subclass of
glenn@6933 1546 the <code>CSSRule</code> interface, and which has the following
glenn@6794 1547 associated state items:</p>
glenn@6794 1548
glenn@6794 1549 <dl>
glenn@6794 1550 <dt><dfn id="rule-type">rule type</dfn></dt>
glenn@6794 1551 <dd><p>A non-negative integer associated with a particular type of rule.
glenn@6794 1552 This item is initialized when a rule is created and must never change.</dd>
glenn@6794 1553
glenn@6794 1554 <dt><dfn id="rule-text">rule text</dfn></dt>
glenn@6794 1555 <dd><p>A text representation of the rule suitable for direct use in a style sheet.
glenn@6794 1556 This item is initialized when a rule is created, and may change over the lifetime of the rule.</dd>
glenn@6794 1557
glenn@6794 1558 <dt><dfn id="rule-parent">rule parent</dfn></dt>
glenn@6794 1559 <dd><p>An optional reference to another, enclosing <a href="#rule">CSS rule</a>.
glenn@6933 1560 If the rule has an enclosing rule when it is created, then this item is initialized to the enclosing rule; otherwise it is <code>null</code>.
glenn@6933 1561 Subsequent to initialization, this item is reset to <code>null</code> if the rule becomes non-enclosed. Once reset to <code>null</code>, it must never change.</dd>
glenn@6794 1562
glenn@6794 1563 <dt><dfn id="rule-style-sheet">rule parent style sheet</dfn></dt>
glenn@6794 1564 <dd><p>An optional reference to an associated <a href="#css-style-sheet">CSS style sheet</a>.
glenn@6794 1565 This item is initialized to reference an associated style sheet when the rule is created. Subsequent to initialization, this item
glenn@6933 1566 is reset to <code>null</code> if the rule becomes disassociated from its initial style sheet. Once reset to <code>null</code>, it must never change.</dd>
glenn@6794 1567 </dl>
glenn@6794 1568
glenn@6794 1569 <p>In addition to the above state, each <a href="#rule">CSS rule</a> may be associated
glenn@6933 1570 with other state in accordance with its <a href="#rule-type">rule type</a>.</p>
glenn@6794 1571
glenn@6257 1572 <p>To <dfn id="parse-a-css-rule">parse a CSS rule</dfn> ...</p>
glenn@6257 1573
glenn@6899 1574 <p class="issue">Should a rule be instantiated in OM if there is a parse error? To
glenn@6899 1575 what extent should original (but non-valid) CSS text be captured in cssText?</p>
glenn@6899 1576
glenn@6942 1577 <p>To <dfn id="serialize-a-css-rule">serialize a CSS rule</dfn>, perform one of the following in accordance with the <a href="#rule-type" title="rule type">rule's type</a>:</p>
glenn@6257 1578
glenn@6257 1579 <dl class="switch">
glenn@6257 1580 <dt><code>CSSStyleRule</code></dt>
glenn@6935 1581 <dd>
glenn@6935 1582 <p>The result of concatenating the following:</p>
glenn@6935 1583 <ol>
glenn@6935 1584 <li>The result of performing <a href="#serialize-a-group-of-selectors">serialize a group of selectors</a> on the rule's associated selectors.</li>
glenn@6935 1585 <li>The string "<code> { </code>", i.e., a single SPACE (U+0020), followed by LEFT CURLY BRACKET (U+007B),
glenn@6935 1586 followed by a single SPACE (U+0020).</li>
glenn@6935 1587 <li>The result of performing <a href="#serialize-a-css-declaration-block">serialize a CSS declaration block</a> on the rule's associated declarations.</li>
glenn@6935 1588 <li>If the rule is associated with one or more declarations, the string "<code> </code>", i.e., a single SPACE (U+0020).</li>
glenn@6935 1589 <li>The string "<code>}</code>", RIGHT CURLY BRACKET (U+007D).
glenn@6935 1590 </ol>
glenn@6935 1591 </dd>
glenn@6523 1592
glenn@6523 1593 <dt><code>CSSCharsetRule</code></dt>
glenn@6935 1594 <dd>
glenn@6935 1595 <p>The result of concatenating the following:</p>
glenn@6935 1596 <ol>
glenn@6935 1597 <li>The string "<code>@charset</code>" followed by a single SPACE (U+0020).</li>
glenn@6935 1598 <li>The result of performing <a href="#serialize-a-string">serialize a string</a> on the <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#preferred-mime-name">preferred MIME name</a> of the rule's encoding.</li>
glenn@6935 1599 <li>The string "<code>;</code>", i.e., SEMICOLON (U+003B).
glenn@6935 1600 </ol>
glenn@6935 1601 <div class="example">
glenn@6935 1602 <pre>@charset "UTF-8";</pre>
glenn@6935 1603 </div>
glenn@6935 1604 </dd>
glenn@6257 1605
glenn@6257 1606 <dt><code>CSSImportRule</code></dt>
glenn@6247 1607 <dd>
glenn@6935 1608 <p>The result of concatenating the following:</p>
glenn@6247 1609 <ol>
glenn@6942 1610 <li>The string "<code>@import</code>" followed by a single SPACE (U+0020).</li>
glenn@6942 1611 <li>The result of performing <a href="#serialize-a-url">serialize a URL</a> on the rule's location.</li>
glenn@6942 1612 <li>If the rule's associated media list is not empty, a single SPACE (U+0020) followed by the
glenn@6942 1613 result of performing <a href="#serialize-a-media-query-list">serialize a media query list</a> on the media list.
glenn@6942 1614 <li>The string "<code>;</code>", i.e., SEMICOLON (U+003B).
glenn@6247 1615 </ol>
glenn@6942 1616 <div class="example">
glenn@7306 1617 <pre>@import url("import.css");</pre>
glenn@6942 1618 <pre>@import url("print.css") print;</pre>
glenn@6942 1619 </div>
glenn@6257 1620 </dd>
glenn@6257 1621
glenn@6257 1622 <dt><code>CSSMediaRule</code></dt>
glenn@6523 1623 <dd><p class="issue">...</dd>
glenn@6257 1624
glenn@6257 1625 <dt><code>CSSFontFaceRule</code></dt>
glenn@6523 1626 <dd><p class="issue">...</dd>
glenn@6257 1627
glenn@6257 1628 <dt><code>CSSPageRule</code></dt>
glenn@6523 1629 <dd><p class="issue">...</dd>
glenn@6257 1630
glenn@6257 1631 <dt><code>CSSNamespaceRule</code></dt>
glenn@6934 1632 <dd><p>The literal string "<code>@namespace</code>", followed by a single SPACE
glenn@6257 1633 (U+0020), followed by the
glenn@6257 1634 <a href="#serialize-an-identifier" title="serialize an identifier">identifier escaped</a> value of the
glenn@6257 1635 <code title="dom-CSSNamespaceRule-prefix">prefix</code> attribute (if
glenn@6934 1636 any), followed by a single SPACE (U+0020) if there is a prefix, followed by the
glenn@6257 1637 <a href="#serialize-a-url" title="serialize a URL">URL escaped</a> value of the
glenn@6257 1638 <code title="dom-CSSNamespaceRule-namespaceURI">namespaceURI</code>
glenn@6257 1639 attribute, followed the character "<code>;</code>" (U+003B).</dd>
glenn@6247 1640 </dl>
glenn@6247 1641
glenn@6247 1642 <!-- ........................................................................................................................ -->
glenn@6247 1643
glenn@6257 1644 <h4 id="the-cssrulelist-sequence"><span class="secno">6.4.1 </span>The <code>CSSRuleList</code> Sequence</h4>
glenn@6257 1645
glenn@6257 1646 <p>The <code>CSSRuleList</code> sequence represents an ordered collection of CSS style rules.</p>
glenn@6257 1647 <pre class="idl">[[TBD - TYPEDEF]]
glenn@6247 1648 </pre>
glenn@6257 1649
glenn@6257 1650
glenn@6247 1651 <!-- ........................................................................................................................ -->
glenn@6247 1652
glenn@6257 1653 <h4 id="the-cssrule-interface"><span class="secno">6.4.2 </span>The <code>CSSRule</code> Interface</h4>
glenn@6257 1654
glenn@6257 1655 <p>The <code>CSSRule</code> interface represents an abstract, base CSS style rule. Each distinct CSS style rule type is represented by a distinct interface that inherits from this interface.</p>
glenn@6257 1656 <pre class="idl"><span class="idlInterface" id="widl-def-CSSRule">interface <span class="idlInterfaceID">CSSRule</span> {
glenn@6257 1657 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-STYLE_RULE">STYLE_RULE</a></span> = <span class="idlConstValue">1</span>;</span>
glenn@6523 1658 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-CHARSET_RULE">CHARSET_RULE</a></span> = <span class="idlConstValue">2</span>;</span>
glenn@6257 1659 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-IMPORT_RULE">IMPORT_RULE</a></span> = <span class="idlConstValue">3</span>;</span>
glenn@6257 1660 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-MEDIA_RULE">MEDIA_RULE</a></span> = <span class="idlConstValue">4</span>;</span>
glenn@6257 1661 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-FONT_FACE_RULE">FONT_FACE_RULE</a></span> = <span class="idlConstValue">5</span>;</span>
glenn@6257 1662 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-PAGE_RULE">PAGE_RULE</a></span> = <span class="idlConstValue">6</span>;</span>
glenn@6257 1663 <span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CSSRule-NAMESPACE_RULE">NAMESPACE_RULE</a></span> = <span class="idlConstValue">10</span>;</span>
glenn@6257 1664 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned short</a></span> <span class="idlAttrName"><a href="#widl-CSSRule-type">type</a></span>;</span>
glenn@6257 1665 <span class="idlAttribute"> attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CSSRule-cssText">cssText</a></span>;</span>
glenn@6636 1666 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSRule</a>?</span> <span class="idlAttrName"><a href="#widl-CSSRule-parentRule">parentRule</a></span>;</span>
glenn@6636 1667 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSStyleSheet</a>?</span> <span class="idlAttrName"><a href="#widl-CSSRule-parentStyleSheet">parentStyleSheet</a></span>;</span>
glenn@6247 1668 };</span></pre>
glenn@6257 1669 <dl class="constants">
glenn@6257 1670 <dt class="constant" id="widl-CSSRule-STYLE_RULE">
glenn@6257 1671 <code>STYLE_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 1</dt>
glenn@6257 1672 <dd>
glenn@6257 1673 <p>When the value of the <code>type</code> attribute is <code>STYLE_RULE</code>, then the object that implements this interface must implement the <code>CSSStyleRule</code> interface.</dd>
glenn@6523 1674 <dt class="constant" id="widl-CSSRule-CHARSET_RULE">
glenn@6523 1675 <code>CHARSET_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 2</dt>
glenn@6523 1676 <dd>
glenn@6523 1677 <p>When the value of the <code>type</code> attribute is <code>CHARSET_RULE</code>, then the object that implements this interface must implement the <code>CSSCharsetRule</code> interface.</dd>
glenn@6257 1678 <dt class="constant" id="widl-CSSRule-IMPORT_RULE">
glenn@6257 1679 <code>IMPORT_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 3</dt>
glenn@6257 1680 <dd>
glenn@6257 1681 <p>When the value of the <code>type</code> attribute is <code>IMPORT_RULE</code>, then the object that implements this interface must implement the <code>CSSImportRule</code> interface.</dd>
glenn@6257 1682 <dt class="constant" id="widl-CSSRule-MEDIA_RULE">
glenn@6257 1683 <code>MEDIA_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 4</dt>
glenn@6257 1684 <dd>
glenn@6257 1685 <p>When the value of the <code>type</code> attribute is <code>MEDIA_RULE</code>, then the object that implements this interface must implement the <code>CSSMediaRule</code> interface.</dd>
glenn@6257 1686 <dt class="constant" id="widl-CSSRule-FONT_FACE_RULE">
glenn@6257 1687 <code>FONT_FACE_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 5</dt>
glenn@6257 1688 <dd>
glenn@6257 1689 <p>When the value of the <code>type</code> attribute is <code>FONT_FACE_RULE</code>, then the object that implements this interface must implement the <code>CSSFontFaceRule</code> interface.</dd>
glenn@6257 1690 <dt class="constant" id="widl-CSSRule-PAGE_RULE">
glenn@6257 1691 <code>PAGE_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 6</dt>
glenn@6257 1692 <dd>
glenn@6257 1693 <p>When the value of the <code>type</code> attribute is <code>PAGE_RULE</code>, then the object that implements this interface must implement the <code>CSSPageRule</code> interface.</dd>
glenn@6257 1694 <dt class="constant" id="widl-CSSRule-NAMESPACE_RULE">
glenn@6257 1695 <code>NAMESPACE_RULE</code> of type <span class="idlConstType"><a>unsigned short</a></span>, with value 10</dt>
glenn@6257 1696 <dd>
glenn@6257 1697 <p>When the value of the <code>type</code> attribute is <code>NAMESPACE_RULE</code>, then the object that implements this interface must implement the <code>CSSNamespaceRule</code> interface.</dd>
glenn@6257 1698 </dl>
glenn@6257 1699 <dl class="attributes">
glenn@6257 1700 <dt class="attribute" id="widl-CSSRule-type">
glenn@6257 1701 <code>type</code> of type <span class="idlAttrType"><a>unsigned short</a></span>, readonly</dt>
glenn@6257 1702 <dd>
glenn@6642 1703 <p>The <code>type</code> attribute must return one of the following values: <code>STYLE_RULE</code>, <code>IMPORT_RULE</code>, <code>MEDIA_RULE</code>, <code>FONT_FACE_RULE</code>, <code>PAGE_RULE</code>, <code>NAMESPACE_RULE</code>, or a registered extension value. </p> <p>The value 0, formerly known as <code>UNKNOWN_RULE</code>, is made obsolete by this specification. This value will not be re-allocated in the future and shall remain reserved.</p> <p class="note">Constants for new and proprietary rule types are coordinated on the <a href="http://wiki.csswg.org/spec/cssom-constants">CSSOM Constants</a> wiki page.</dd>
glenn@6257 1704 <dt class="attribute" id="widl-CSSRule-cssText">
glenn@6257 1705 <code>cssText</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt>
glenn@6257 1706 <dd>
glenn@6935 1707 <p>The <code>cssText</code> attribute must return a <a href="#serialize-a-css-rule" title="serialize a CSS rule">serialization</a> of the <a href="#rule">CSS rule</a>.</p> <p>On setting the <code>cssText</code> attribute these steps must be run:</p> <ol> <li><p><a href="#parse-a-css-rule" title="Parse a CSS rule">Parse</a> the value.</li> <li><p>If parsing failed terminate this algorithm.</li> <li><p>If the <code title="dom-CSSRule-type">type</code> of the new object does not match the <code title="dom-CSSRule-type">type</code> of the current object <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an '<code class="external"><a href="http://dom.spec.whatwg.org/#invalidmodificationerror">InvalidModificationError</a></code>' exception.</li> <li><p>Replace the current object with the new object.</li> </ol></dd>
glenn@6257 1708 <dt class="attribute" id="widl-CSSRule-parentRule">
glenn@6642 1709 <code>parentRule</code> of type <span class="idlAttrType"><a>CSSRule</a>?</span>, readonly</dt>
glenn@6257 1710 <dd>
glenn@6642 1711 <p>The <code>parentRule</code> attribute must return the nearest enclosing rule of the current rule or <code>null</code> if there is none. If a value other than <code>null</code> is ever returned, than that same value must always be returned on each get access.</p> <p class="note">For example, <code>@media</code> can enclose a rule, in which case <code>ownerRule</code> would be non-null; in cases where there is no enclosing rule, <code>ownerRule</code> will be <code>null</code>.</dd>
glenn@6257 1712 <dt class="attribute" id="widl-CSSRule-parentStyleSheet">
glenn@6642 1713 <code>parentStyleSheet</code> of type <span class="idlAttrType"><a>CSSStyleSheet</a>?</span>, readonly</dt>
glenn@6257 1714 <dd>
glenn@6642 1715 <p>The <code>parentStyleSheet</code> attribute must return the <code>CSSStyleSheet</code> object that contains the the current rule or <code>null</code> if there is none.</p> <p class="note">The only circumstance where <code>null</code> is returned is in the case that <code>CSSStyleSheet.prototype.deleteRule</code> has been invoked to <a href="#remove-a-css-rule">remove a CSS rule</a> from a CSS style sheet, in which case its <code>parentStyleSheet</code> property will have been set to <code>null</code>.</p> <p class="note">Removing an <code>Node</code> that implements the <code>LinkStyle</code> interface from a <code>Document</code> instance does not (by itself) cause the <code>CSSStyleSheet</code> referenced by a <code>CSSRule</code> to be unreachable; that is, as long as there exists a reachable reference to a <code>CSSRule</code> object, then its <code>parentStyleSheet</code> property remains viable if it has not been previously removed from the style sheet by using the <code>deleteRule</code> operation.</dd>
glenn@6257 1716 </dl>
glenn@6257 1717
glenn@6257 1718
glenn@6257 1719 <!-- ........................................................................................................................ -->
glenn@6257 1720
glenn@6257 1721 <h4 id="the-cssstylerule-interface"><span class="secno">6.4.3 </span>The <code>CSSStyleRule</code> Interface</h4>
glenn@6257 1722
glenn@6257 1723 <p>The <code>CSSStyleRule</code> interface represents a rule set.</p>
glenn@6437 1724 <pre class="idl"><span class="idlInterface" id="widl-def-CSSStyleRule">interface <span class="idlInterfaceID">CSSStyleRule</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-CSSRule"><code>CSSRule</code></a></span> {
glenn@6257 1725 <span class="idlAttribute"> attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CSSStyleRule-selectorText">selectorText</a></span>;</span>
glenn@6257 1726 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSStyleDeclaration</a></span> <span class="idlAttrName"><a href="#widl-CSSStyleRule-style">style</a></span>;</span>
glenn@6257 1727 };</span></pre>
glenn@6257 1728 <dl class="attributes">
glenn@6257 1729 <dt class="attribute" id="widl-CSSStyleRule-selectorText">
glenn@6257 1730 <code>selectorText</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt>
glenn@6257 1731 <dd>
glenn@6942 1732 <p>The <code>selectorText</code> attribute, on getting, must return the result of <a href="#serialize-a-group-of-selectors" title="serialize a group of selectors">serializing</a> the associated <span>group of selectors</span>.</p> <p>On setting the <code>selectorText</code> attribute these steps must be run:</p> <ol> <li><p>Run the <a href="#parse-a-group-of-selectors">parse a group of selectors</a> algorithm on the given value.</li> <li><p>If the algorithm returns a non-null value replace the associated <span>group of selectors</span> with the returned value.</li> <li><p>Otherwise, if the algorithm returns a <code>null</code> value, do nothing.</li> </ol></dd>
glenn@6257 1733 <dt class="attribute" id="widl-CSSStyleRule-style">
glenn@6257 1734 <code>style</code> of type <span class="idlAttrType"><a>CSSStyleDeclaration</a></span>, readonly</dt>
glenn@6257 1735 <dd>
glenn@6257 1736 <p>The <code>style</code> attribute must return a <code>CSSStyleDeclaration</code> object for the rule set.</dd>
glenn@6257 1737 </dl>
glenn@6257 1738
glenn@6257 1739
glenn@6257 1740 <!-- ........................................................................................................................ -->
glenn@6257 1741
glenn@6523 1742 <h4 id="the-csscharsetrule-interface"><span class="secno">6.4.4 </span>The <code>CSSCharsetRule</code> Interface</h4>
glenn@6523 1743
glenn@6523 1744
glenn@6523 1745
glenn@6523 1746 <!-- ........................................................................................................................ -->
glenn@6523 1747
glenn@6523 1748 <h4 id="the-cssimportrule-interface"><span class="secno">6.4.5 </span>The <code>CSSImportRule</code> Interface</h4>
glenn@6257 1749
glenn@6257 1750 <p>The <code>CSSImportRule</code> interface represents an <code>@import</code> rule.</p>
glenn@6437 1751 <pre class="idl"><span class="idlInterface" id="widl-def-CSSImportRule">interface <span class="idlInterfaceID">CSSImportRule</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-CSSRule"><code>CSSRule</code></a></span> {
glenn@6257 1752 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CSSImportRule-href">href</a></span>;</span>
glenn@6257 1753 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>MediaList</a></span> <span class="idlAttrName"><a href="#widl-CSSImportRule-media">media</a></span>;</span>
glenn@6257 1754 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSStyleSheet</a></span> <span class="idlAttrName"><a href="#widl-CSSImportRule-styleSheet">styleSheet</a></span>;</span>
glenn@6257 1755 };</span></pre>
glenn@6257 1756 <dl class="attributes">
glenn@6257 1757 <dt class="attribute" id="widl-CSSImportRule-href">
glenn@6257 1758 <code>href</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt>
glenn@6257 1759 <dd>
glenn@6794 1760 <p>The <code>href</code> attribute must return the <span>URL</span> specified by the <code>@import</code> rule.</p> <p class="note">To get the resolved <span>URL</span> use the <code title="dom-StyleSheet-href">href</code> attribute of the associated <span>style sheet</span>.</dd>
glenn@6257 1761 <dt class="attribute" id="widl-CSSImportRule-media">
glenn@6257 1762 <code>media</code> of type <span class="idlAttrType"><a>MediaList</a></span>, readonly</dt>
glenn@6257 1763 <dd>
glenn@6794 1764 <p>The <code>media</code> attribute must return the value of the <code title="dom-StyleSheet-media">media</code> attribute of the associated <span>style sheet</span>.</dd>
glenn@6257 1765 <dt class="attribute" id="widl-CSSImportRule-styleSheet">
glenn@6257 1766 <code>styleSheet</code> of type <span class="idlAttrType"><a>CSSStyleSheet</a></span>, readonly</dt>
glenn@6257 1767 <dd>
glenn@6794 1768 <p>The <code>styleSheet</code> attribute must return the associated <span>style sheet</span>.</p> <p class="note">If loading of the style sheet fails its <code title="dom-CSSStyleSheet-cssRules">cssRules</code> list is simply empty, i.e., an <code>@import</code> rule always has an associated <span>style sheet</span>.</dd>
glenn@6257 1769 </dl>
glenn@6257 1770
glenn@6257 1771
glenn@6257 1772 <!-- ........................................................................................................................ -->
glenn@6257 1773
glenn@6523 1774 <h4 id="the-cssmediarule-interface"><span class="secno">6.4.6 </span>The <code>CSSMediaRule</code> Interface</h4>
glenn@6257 1775
glenn@6257 1776 <p>The <code>CSSMediaRule</code> interface represents a <code>@media</code> rule.</p>
glenn@6437 1777 <pre class="idl"><span class="idlInterface" id="widl-def-CSSMediaRule">interface <span class="idlInterfaceID">CSSMediaRule</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-CSSRule"><code>CSSRule</code></a></span> {
glenn@6257 1778 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>MediaList</a></span> <span class="idlAttrName"><a href="#widl-CSSMediaRule-media">media</a></span>;</span>
glenn@6257 1779 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSRuleList</a></span> <span class="idlAttrName"><a href="#widl-CSSMediaRule-cssRules">cssRules</a></span>;</span>
glenn@6257 1780 <span class="idlMethod"> <span class="idlMethType"><a>unsigned long</a></span> <span class="idlMethName"><a href="#widl-CSSMediaRule-insertRule-unsigned-long-DOMString-rule-unsigned-long-index">insertRule</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">rule</span></span>, <span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
glenn@6257 1781 <span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CSSMediaRule-deleteRule-void-unsigned-long-index">deleteRule</a></span> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
glenn@6257 1782 };</span></pre>
glenn@6257 1783 <dl class="attributes">
glenn@6257 1784 <dt class="attribute" id="widl-CSSMediaRule-media">
glenn@6257 1785 <code>media</code> of type <span class="idlAttrType"><a>MediaList</a></span>, readonly</dt>
glenn@6257 1786 <dd>
glenn@6257 1787 <p>The <code>media</code> attribute must return a <code>MediaList</code> object for the list of media queries specified with the <code>@media</code> rule.</dd>
glenn@6257 1788 <dt class="attribute" id="widl-CSSMediaRule-cssRules">
glenn@6257 1789 <code>cssRules</code> of type <span class="idlAttrType"><a>CSSRuleList</a></span>, readonly</dt>
glenn@6257 1790 <dd>
glenn@6257 1791 <p>The <code>cssRules</code> attribute must return a <code>CSSRuleList</code> object for the list of CSS rules specified with the <code>@media</code> rule.</dd>
glenn@6257 1792 </dl>
glenn@6257 1793 <dl class="methods">
glenn@6257 1794 <dt class="method" id="widl-CSSMediaRule-insertRule-unsigned-long-DOMString-rule-unsigned-long-index">
glenn@6642 1795 <code>insertRule</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">rule</span></span>, <span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>), returns <span class="idlMethType"><a>unsigned long</a></span></dt>
glenn@6257 1796 <dd>
glenn@6257 1797 <p>The <code>insertRule</code> operation must <a href="#insert-a-css-rule">insert a CSS rule</a> <var>rule</var> into the CSS rule list returned by <code title="dom-CSSMediaRule-cssRules">cssRules</code> at <var>index</var>.</dd>
glenn@6257 1798 <dt class="method" id="widl-CSSMediaRule-deleteRule-void-unsigned-long-index">
glenn@6642 1799 <code>deleteRule</code> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>), returns <span class="idlMethType"><a>void</a></span></dt>
glenn@6257 1800 <dd>
glenn@6257 1801 <p>The <code>deleteRule</code> operation must <a href="#remove-a-css-rule">remove a CSS rule</a> from the CSS rule list returned by <code title="dom-CSSMediaRule-cssRules">cssRules</code> at <var>index</var>.</dd>
glenn@6257 1802 </dl>
glenn@6257 1803
glenn@6257 1804
glenn@6257 1805 <!-- ........................................................................................................................ -->
glenn@6257 1806
glenn@6523 1807 <h4 id="the-cssfontfacerule-interface"><span class="secno">6.4.7 </span>The <code>CSSFontFaceRule</code> Interface</h4>
glenn@6257 1808
glenn@6257 1809 <p>The <code>CSSFontFaceRule</code> interface represents a <code>@font-face</code> rule.</p>
glenn@6437 1810 <pre class="idl"><span class="idlInterface" id="widl-def-CSSFontFaceRule">interface <span class="idlInterfaceID">CSSFontFaceRule</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-CSSRule"><code>CSSRule</code></a></span> {
glenn@6257 1811 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSStyleDeclaration</a></span> <span class="idlAttrName"><a href="#widl-CSSFontFaceRule-style">style</a></span>;</span>
glenn@6257 1812 };</span></pre>
glenn@6257 1813 <dl class="attributes">
glenn@6257 1814 <dt class="attribute" id="widl-CSSFontFaceRule-style">
glenn@6257 1815 <code>style</code> of type <span class="idlAttrType"><a>CSSStyleDeclaration</a></span>, readonly</dt>
glenn@6257 1816 <dd>
glenn@6257 1817 <p>The <code>style</code> attribute must return a <code>CSSStyleDeclaration</code> block that contains the property declarations specified within the <code>@font-face</code> rule.</dd>
glenn@6257 1818 </dl>
glenn@6257 1819
glenn@6257 1820
glenn@6257 1821 <!-- ........................................................................................................................ -->
glenn@6257 1822
glenn@6523 1823 <h4 id="the-csspagerule-interface"><span class="secno">6.4.8 </span>The <code>CSSPageRule</code> Interface</h4>
glenn@6257 1824
glenn@6257 1825 <p>The <code>CSSPageRule</code> interface represents a <code>@page</code> rule.</p> <p class="note">Need to define the rules for <dfn id="parse-a-css-page-selector">parse a CSS page selector</dfn> and <dfn id="serialize-a-css-page-selector">serialize a CSS page selector</dfn>.</p>
glenn@6437 1826 <pre class="idl"><span class="idlInterface" id="widl-def-CSSPageRule">interface <span class="idlInterfaceID">CSSPageRule</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-CSSRule"><code>CSSRule</code></a></span> {
glenn@6257 1827 <span class="idlAttribute"> attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CSSPageRule-selectorText">selectorText</a></span>;</span>
glenn@6257 1828 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSStyleDeclaration</a></span> <span class="idlAttrName"><a href="#widl-CSSPageRule-style">style</a></span>;</span>
glenn@6257 1829 };</span></pre>
glenn@6257 1830 <dl class="attributes">
glenn@6257 1831 <dt class="attribute" id="widl-CSSPageRule-selectorText">
glenn@6257 1832 <code>selectorText</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt>
glenn@6257 1833 <dd>
glenn@6942 1834 <p>The <code>selectorText</code> attribute, on getting, must return the result of <a href="#serialize-a-css-page-selector" title="serialize a CSS page selector">serializing</a> the associated <span>CSS page selector</span>.</p> <p>On setting the <code>selectorText</code> attribute these steps must be run:</p> <ol> <li><p>Run the <a href="#parse-a-css-page-selector">parse a CSS page selector</a> algorithm on the given value.</li> <li><p>If the algorithm returns a non-null value replace the associated <span>CSS page selector</span> with the returned value.</li> <li><p>Otherwise, if the algorithm returns a <code>null</code> value, do nothing.</li> </ol></dd>
glenn@6257 1835 <dt class="attribute" id="widl-CSSPageRule-style">
glenn@6257 1836 <code>style</code> of type <span class="idlAttrType"><a>CSSStyleDeclaration</a></span>, readonly</dt>
glenn@6257 1837 <dd>
glenn@6257 1838 <p>The <code>style</code> attribute must return a <code>CSSStyleDeclaration</code> for the <code>@page</code> rule.</dd>
glenn@6257 1839 </dl>
glenn@6257 1840
glenn@6257 1841
glenn@6257 1842 <!-- ........................................................................................................................ -->
glenn@6257 1843
glenn@6523 1844 <h4 id="the-cssnamespacerule-interface"><span class="secno">6.4.9 </span>The <code>CSSNamespaceRule</code> Interface</h4>
glenn@6257 1845
glenn@6257 1846 <p>The <code>CSSNamespaceRule</code> interface represents a <code>@namespace</code> rule.</p>
glenn@6437 1847 <pre class="idl"><span class="idlInterface" id="widl-def-CSSNamespaceRule">interface <span class="idlInterfaceID">CSSNamespaceRule</span> : <span class="idlSuperclass"><a class="idlType" href="#widl-def-CSSRule"><code>CSSRule</code></a></span> {
glenn@6257 1848 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CSSNamespaceRule-namespaceURI">namespaceURI</a></span>;</span>
glenn@6257 1849 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-CSSNamespaceRule-prefix">prefix</a></span>;</span>
glenn@6257 1850 };</span></pre>
glenn@6257 1851 <dl class="attributes">
glenn@6257 1852 <dt class="attribute" id="widl-CSSNamespaceRule-namespaceURI">
glenn@6257 1853 <code>namespaceURI</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt>
glenn@6257 1854 <dd>
glenn@6257 1855 <p>The <code>namespaceURI</code> attribute must return the namespace of the <code>@namespace</code> rule.</dd>
glenn@6257 1856 <dt class="attribute" id="widl-CSSNamespaceRule-prefix">
glenn@6642 1857 <code>prefix</code> of type <span class="idlAttrType"><a>DOMString</a>?</span>, readonly</dt>
glenn@6257 1858 <dd>
glenn@6257 1859 <p>The <code>prefix</code> attribute must return the prefix of the <code>@namespace</code> rule or the empty string if there is no prefix.</dd>
glenn@6257 1860 </dl>
glenn@6257 1861
glenn@6257 1862
glenn@6257 1863 <!-- ........................................................................................................................ -->
glenn@6257 1864 <!-- ........................................................................................................................ -->
glenn@6257 1865
glenn@6257 1866 <h3 id="css-declaration-blocks"><span class="secno">6.5 </span>CSS Declaration Blocks</h3>
glenn@6257 1867
glenn@6257 1868 <p>A <dfn id="css-declaration-block">CSS declaration block</dfn> is an ordered collection of CSS
glenn@6257 1869 properties with their associated values, also named CSS declarations. In
glenn@6257 1870 the DOM a <a href="#css-declaration-block">CSS declaration block</a> is a
glenn@6257 1871 <code>CSSStyleDeclaration</code> object. A
glenn@6257 1872 <a href="#css-declaration-block">CSS declaration block</a> has two associated properties:</p>
glenn@6257 1873
glenn@6257 1874 <dl>
glenn@6257 1875 <dt><dfn id="css-declaration-block-readonly-flag">CSS declaration block readonly flag</dfn></dt>
glenn@6933 1876 <dd><p>Clear if the object can be manipulated. Set if it can not be
glenn@6933 1877 manipulated. Unless otherwise stated it is clear.</dd>
glenn@6257 1878
glenn@6257 1879 <dt><dfn id="css-declaration-block-declarations">CSS declaration block declarations</dfn></dt>
glenn@6257 1880 <dd><p>The CSS declarations associated with the object.</dd>
fantasai@6256 1881 </dl>
fantasai@6256 1882
glenn@6257 1883 <p class="note">The <a href="#css-declaration-block-declarations">CSS declaration block declarations</a> are
glenn@6257 1884 ordered. This matters for the
glenn@6257 1885 <code title="dom-CSSStyleDeclaration-item">item()</code> method.</p>
glenn@6257 1886
glenn@6899 1887 <p>To <dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn> ...</p>
glenn@6899 1888
glenn@6899 1889 <p class="issue">What should be captured in the cssText of a declaration block which fails
glenn@6899 1890 to parse?</p>
glenn@6257 1891
glenn@6527 1892 <p>To <dfn id="serialize-a-css-declaration-block">serialize a CSS declaration block</dfn>
glenn@6527 1893 represented by a <code>CSSStyleDeclarations</code> instance named <var>d</var>,
glenn@6527 1894 let <var>s</var> be the empty string, then run the steps below:</p>
glenn@6527 1895
glenn@6527 1896 <ol>
glenn@6527 1897 <li><p>If <code><var>d</var>.length</code> is zero (0), then return <var>s</var>.</li>
glenn@6527 1898 <li><p>For each <var>i</var> from zero (0) through <code><var>d</var>.length</code> - 1 (inclusive), perform the following sub-steps:</p>
glenn@6527 1899 <ol>
glenn@6527 1900 <li><p>Let <var>n</var> be the value returned by <code><var>d</var>.item(<var>i</var>)</code>.</li>
glenn@6527 1901 <li><p>Let <var>v</var> be the value returned by <code><var>d</var>.getPropertyValue(<var>n</var>)</code>.</li>
glenn@6527 1902 <li><p>If <var>v</var> is the empty string, then continue.</li>
glenn@6527 1903 <li><p>Otherwise (<var>v</var> is non-empty), perform the following sub-steps:</p>
glenn@6527 1904 <ol>
glenn@6934 1905 <li><p>If <var>s</var> is not empty, then append a single SPACE (U+0020) to <var>s</var>.</li>
glenn@6527 1906 <li><p>Append <var>n</var> to <var>s</var>.</li>
glenn@6934 1907 <li><p>Append COLON (U+003A) followed by a single SPACE (U+0020), i.e., "<code>: </code>", to <var>s</var>.</li>
glenn@6527 1908 <li><p>Append <var>v</var> to <var>s</var>.</li>
glenn@6527 1909 </ol>
glenn@6527 1910 </li>
glenn@6534 1911 <li><p>Let <var>p</var> be the value returned by <code><var>d</var>.getPropertyPriority(<var>n</var>)</code>.</li>
glenn@6534 1912 <li><p>If <var>p</var> is not the empty string, then perform the following sub-steps:</p>
glenn@6534 1913 <ol>
glenn@6934 1914 <li><p>Append a single SPACE (U+0020) followed by EXCLAMATION MARK (U+0021), i.e., "<code> !</code>", to <var>s</var>.</li>
glenn@6534 1915 <li><p>Append <var>p</var> to <var>s</var>.</li>
glenn@6534 1916 </ol>
glenn@6534 1917 </li>
glenn@6534 1918 <li><p>Append SEMICOLON (U+003B), i.e., "<code>;</code>", to <var>s</var>.</li>
glenn@6527 1919 </ol>
glenn@6527 1920 </li>
glenn@6531 1921 <li><p>Return <var>s</var>.</li>
glenn@6527 1922 </ol>
glenn@6527 1923
glenn@6527 1924 <p class="note">The serialization of an empty CSS declaration block is the empty string.</p>
glenn@6527 1925
glenn@6530 1926 <p class="note">The serialization of a non-empty CSS declaration block does not include any surrounding whitespace, i.e., no whitepsace appears
glenn@6528 1927 before the first property name and no whitespace appears after the final semicolon delimiter that follows the last property value.</p>
glenn@6257 1928
glenn@6247 1929 <!-- ........................................................................................................................ -->
glenn@6247 1930
glenn@6257 1931 <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The <code>CSSStyleDeclaration</code> Interface</h4>
glenn@6257 1932
glenn@6257 1933 <p>The <code>CSSStyleDeclaration</code> interface represents a <a href="#css-declaration-block">CSS declaration block</a>, including its underlying state, where this underlying state depends upon the source of the <code>CSSStyleDeclaration</code> instance.</p>
glenn@6257 1934 <pre class="idl"><span class="idlInterface" id="widl-def-CSSStyleDeclaration">interface <span class="idlInterfaceID">CSSStyleDeclaration</span> {
glenn@6257 1935 <span class="idlAttribute"> attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CSSStyleDeclaration-cssText">cssText</a></span>;</span>
glenn@6257 1936 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned long</a></span> <span class="idlAttrName"><a href="#widl-CSSStyleDeclaration-length">length</a></span>;</span>
glenn@6257 1937 <span class="idlMethod"> <span class="idlMethType"><a>DOMString</a></span> <span class="idlMethName"><a href="#widl-CSSStyleDeclaration-item-DOMString-unsigned-long-index">item</a></span> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
glenn@6257 1938 <span class="idlMethod"> <span class="idlMethType"><a>DOMString</a></span> <span class="idlMethName"><a href="#widl-CSSStyleDeclaration-getPropertyValue-DOMString-DOMString-property">getPropertyValue</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>);</span>
glenn@6257 1939 <span class="idlMethod"> <span class="idlMethType"><a>DOMString</a></span> <span class="idlMethName"><a href="#widl-CSSStyleDeclaration-getPropertyPriority-DOMString-DOMString-property">getPropertyPriority</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>);</span>
glenn@6257 1940 <span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CSSStyleDeclaration-setProperty-void-DOMString-property-DOMString-value-DOMString-priority">setProperty</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>, <span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">value</span></span>, <span class="idlParam">optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">priority</span></span>);</span>
glenn@6257 1941 <span class="idlMethod"> <span class="idlMethType"><a>DOMString</a></span> <span class="idlMethName"><a href="#widl-CSSStyleDeclaration-removeProperty-DOMString-DOMString-property">removeProperty</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>);</span>
glenn@6426 1942 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSRule</a>?</span> <span class="idlAttrName"><a href="#widl-CSSStyleDeclaration-parentRule">parentRule</a></span>;</span>
glenn@6247 1943 };</span></pre>
glenn@6257 1944 <dl class="attributes">
glenn@6257 1945 <dt class="attribute" id="widl-CSSStyleDeclaration-cssText">
glenn@6257 1946 <code>cssText</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt>
glenn@6257 1947 <dd>
glenn@6942 1948 <p>The <code>cssText</code> attribute must return the result of <a href="#serialize-a-css-declaration-block" title="serialize a CSS declaration block">serializing</a> the <a href="#css-declaration-block-declarations">CSS declaration block declarations</a>.</p> <p>Setting the <code>cssText</code> attribute must run these steps: <ol> <li><p>If the <a href="#css-declaration-block-readonly-flag">CSS declaration block readonly flag</a> is set, <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> a <code class="external"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception and terminate these steps.</li> <li><p>Empty the <a href="#css-declaration-block-declarations">CSS declaration block declarations</a>.</li> <li><p><a href="#parse-a-css-declaration-block" title="Parse a CSS declaration block">Parse</a> the given value and, if the return value is not <code>null</code>, insert it into the <a href="#css-declaration-block-declarations">CSS declaration block declarations</a>.</li> </ol></dd>
glenn@6257 1949 <dt class="attribute" id="widl-CSSStyleDeclaration-length">
glenn@6257 1950 <code>length</code> of type <span class="idlAttrType"><a>unsigned long</a></span>, readonly</dt>
glenn@6257 1951 <dd>
glenn@6257 1952 <p>The <code>length</code> attribute must return the number of declarations in the <span>collection of CSS declarations</span>.</dd>
glenn@6257 1953 <dt class="attribute" id="widl-CSSStyleDeclaration-parentRule">
glenn@6642 1954 <code>parentRule</code> of type <span class="idlAttrType"><a>CSSRule</a>?</span>, readonly</dt>
glenn@6257 1955 <dd>
glenn@6942 1956 <p>The <code>parentRule</code> attribute must return the <code>CSSrule</code> object the <code>CSSStyleDeclaration</code> is object is associated with or <code>null</code> if it is not associated with a <code>CSSrule</code> object.</dd>
glenn@6257 1957 </dl>
glenn@6257 1958 <dl class="methods">
glenn@6257 1959 <dt class="method" id="widl-CSSStyleDeclaration-item-DOMString-unsigned-long-index">
glenn@6642 1960 <code>item</code> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
glenn@6257 1961 <dd>
glenn@6527 1962 <p>The <code>item</code> operation must return the name of the property at position <var>index</var>.</dd>
glenn@6257 1963 <dt class="method" id="widl-CSSStyleDeclaration-getPropertyValue-DOMString-DOMString-property">
glenn@6642 1964 <code>getPropertyValue</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
glenn@6257 1965 <dd>
glenn@6257 1966 <p>The <code>getPropertyValue</code> operation must ...</dd>
glenn@6257 1967 <dt class="method" id="widl-CSSStyleDeclaration-getPropertyPriority-DOMString-DOMString-property">
glenn@6642 1968 <code>getPropertyPriority</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
glenn@6257 1969 <dd>
glenn@6935 1970 <p>The <code>getPropertyPriority</code> operation, when invoked, if <var>property</var> is an <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for a property that has a priority user agents must return the canonical priority of that property as given in the syntax definition. Otherwise, the empty string must be returned.</p> <p class="example">E.g. for <code>background-color:lime !IMPORTANT</code> the return value would be '<code>important</code>'.</dd>
glenn@6257 1971 <dt class="method" id="widl-CSSStyleDeclaration-setProperty-void-DOMString-property-DOMString-value-DOMString-priority">
glenn@6642 1972 <code>setProperty</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>, <span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">value</span></span>, <span class="idlParam">optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">priority</span></span>), returns <span class="idlMethType"><a>void</a></span></dt>
glenn@6257 1973 <dd>
glenn@6942 1974 <p>The <code>setProperty</code> operation must run these steps:</p> <ol> <li><p>If the <a href="#css-declaration-block-readonly-flag">CSS declaration block readonly flag</a> is set, <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an '<code class="external"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code>' and terminate these steps.</li> <li><p>If <var>property</var> is not an <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for a supported property, terminate this algorithm.</li> <li><p>If <var>value</var> is the empty string, invoke <code title="dom-CSSStyleDeclaration-removeProperty">removeProperty()</code> with <var>property</var> as argument and terminate this algorithm.</li> <li><p>If the <var>priority</var> argument has been omitted let <var>priority</var> be the empty string.</li> <li><p>If <var>priority</var> is neither a valid priority nor the empty string terminate this algorithm.</li> <li> <p>If <a href="#parse-a-css-value" title="parse a CSS value">parsing the <var>value</var></a> returns <code>null</code> terminate this algorithm. <p class="note"><var>value</var> can not include '<code>!important</code>'.</p> </li> <li><p>Finally, set <var>property</var> to <var>value</var> with priority <var>priority</var> when <var>priority</var> is not the empty string. Otherwise set <var>property</var> to <var>value</var>.</li> </ol></dd>
glenn@6257 1975 <dt class="method" id="widl-CSSStyleDeclaration-removeProperty-DOMString-DOMString-property">
glenn@6642 1976 <code>removeProperty</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">property</span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
glenn@6257 1977 <dd>
glenn@6935 1978 <p>The <code>removeProperty</code> operation must run these steps:</p> <ol> <li><p>If the <a href="#css-declaration-block-readonly-flag">CSS declaration block readonly flag</a> is set, <a class="external" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> a '<code class="external"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code>' and terminate these steps.</li> <li><p>If <var>property</var> is an <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for a property of a declaration in the <span>collection of CSS declarations</span> remove the declaration.</li> </ol></dd>
glenn@6257 1979 </dl>
glenn@6257 1980
simonp@7948 1981
simonp@7972 1982 <p>If the user agent supports the 'float' CSS property, the following partial interface
simonp@7972 1983 applies.
simonp@7972 1984
simonp@7948 1985 <pre class="idl">partial interface CSSStyleDeclaration {
simonp@7972 1986 [TreatNullAs=EmptyString] attribute DOMString cssFloat;
simonp@7972 1987 };</pre>
simonp@7972 1988
simonp@7972 1989 <p>The <code><dfn id="dom-cssstyledeclaration-cssfloat" title="dom-CSSStyleDeclaration-cssFloat">cssFloat</dfn></code>
simonp@7972 1990 attribute, on getting, must return the result of invoking
simonp@7972 1991 <code title="dom-CSSStyleDeclaration-getPropertyValue">getPropertyValue()</code> with
simonp@7972 1992 "float" as argument. On setting, the attribute must invoke
simonp@7972 1993 <code title="dom-CSSStyleDeclaration-setPropertyValue">setPropertyValue()</code> with
simonp@7972 1994 "float" as first argument, as second argument the given value, and no third argument.
simonp@7972 1995 Any exceptions thrown must be re-thrown.
simonp@7972 1996
simonp@7972 1997 <p>For each CSS property <var>property</var> that the user agent supports, except for
simonp@7972 1998 the 'float' property, the following partial interface applies where <var>attribute</var>
simonp@7972 1999 is obtained by running the <a href="#css-property-to-idl-attribute">CSS property to IDL attribute</a> algorithm for
simonp@7972 2000 <var>property</var>.
simonp@7972 2001
simonp@7972 2002 <pre class="idl">partial interface CSSStyleDeclaration {
simonp@7972 2003 [TreatNullAs=EmptyString] attribute DOMString <var>attribute</var>;
simonp@7948 2004 };</pre>
simonp@7948 2005
simonp@7948 2006 <p>Getting the <var>attribute</var> attribute must return the result of invoking
simonp@7948 2007 <code title="dom-CSSStyleDeclaration-getPropertyValue">getPropertyValue()</code> with as
simonp@7948 2008 argument the result of running the <a href="#idl-attribute-to-css-property">IDL attribute to CSS property</a>
simonp@7948 2009 algorithm for <var>attribute</var>.</p>
simonp@7948 2010
simonp@7948 2011 <p>Setting the <var>attribute</var> attribute must invoke
simonp@7948 2012 <code title="dom-CSSStyleDeclaration-setPropertyValue">setPropertyValue()</code> with as
simonp@7948 2013 first argument the result of running the <a href="#idl-attribute-to-css-property">IDL attribute to CSS property</a>
simonp@7948 2014 algorithm for <var>attribute</var>, as second argument the given value, and no third argument. Any
simonp@7948 2015 exceptions thrown must be re-thrown.</p>
simonp@7948 2016
simonp@7948 2017 <p>The <dfn id="css-property-to-idl-attribute">CSS property to IDL attribute</dfn> algorithm for <var>property</var> is as
simonp@7948 2018 follows:</p>
simonp@7948 2019
simonp@7948 2020 <ol>
simonp@7948 2021 <li><p>Let <var>output</var> be the empty string.
simonp@7948 2022
simonp@7948 2023 <li><p>Let <var>uppercase next</var> be unset.
simonp@7948 2024
simonp@7948 2025 <li><p>For each character <var>c</var> in <var>property</var>:
simonp@7948 2026
simonp@7948 2027 <ol>
simonp@7948 2028 <li><p>If <var>c</var> is "<code title="">-</code>" (U+002D), let <var>uppercase next</var> be set.
simonp@7948 2029
simonp@7971 2030 <li><p>Otherwise, if <var>uppercase next</var> is set, let <var>uppercase next</var> be unset and append <var>c</var> <a class="external" href="http://dom.spec.whatwg.org/#converted-to-ascii-uppercase">converted to ASCII uppercase</a> to <var>output</var>.
simonp@7948 2031
simonp@7948 2032 <li><p>Otherwise, append <var>c</var> to <var>output</var>.
simonp@7948 2033 </ol>
simonp@7948 2034
simonp@7948 2035 <li><p>Return <var>output</var>.
simonp@7948 2036 </ol>
simonp@7948 2037
simonp@7948 2038 <p>The <dfn id="idl-attribute-to-css-property">IDL attribute to CSS property</dfn> algorithm for <var>attribute</var> is as
simonp@7948 2039 follows:</p>
simonp@7948 2040
simonp@7948 2041 <ol>
simonp@7948 2042 <li><p>Let <var>output</var> be the empty string.
simonp@7948 2043
simonp@7948 2044 <li><p>For each character <var>c</var> in <var>attribute</var>:
simonp@7948 2045
simonp@7948 2046 <ol>
simonp@7971 2047 <li><p>If <var>c</var> is in the range U+0041 to U+005A (ASCII uppercase), append "<code title="">-</code>" (U+002D) followed by <var>c</var> <a class="external" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a> to <var>output</var>.
simonp@7948 2048
simonp@7948 2049 <li><p>Otherwise, append <var>c</var> to <var>output</var>.
simonp@7948 2050 </ol>
simonp@7948 2051
simonp@7948 2052 <li><p>Return <var>output</var>.
simonp@7948 2053 </ol>
simonp@7948 2054
simonp@7948 2055
simonp@7948 2056 <!--
glenn@6247 2057 <hr>
glenn@6247 2058
glenn@6257 2059 <p>For the table below, the IDL attribute in the first column
glenn@6257 2060 must return the result of invoking
glenn@6257 2061 <code title="dom-CSSStyleDeclaration-getPropertyValue">getPropertyValue()</code>
glenn@6257 2062 with as argument the CSS property given in the second column on the same
glenn@6257 2063 row.</p>
glenn@6257 2064
glenn@6257 2065 <p>Similarly for the table below, setting the IDL attribute in the
glenn@6257 2066 first column must invoke
glenn@6257 2067 <code title="dom-CSSStyleDeclaration-setProperty">setProperty()</code>
glenn@6257 2068 with as first argument the CSS property given in the second column on the
glenn@6257 2069 same row, as second argument the given value, and no third argument. Any
glenn@6257 2070 exceptions thrown must be re-thrown.</p>
glenn@6247 2071
glenn@6531 2072 <p class="issue">Restore the entries for the following table or resurrect
glenn@6531 2073 CSS2Properties (or similar) or define in general terms using prose or ...</p>
glenn@6531 2074
glenn@6247 2075 <table>
glenn@6247 2076 <thead>
glenn@6247 2077 <tr>
glenn@6247 2078 <th>IDL attribute
glenn@6247 2079 <th>CSS property
glenn@6257 2080 <tbody>
simonp@7948 2081 <!- -CSSOM-DECLARATIONTABLE- ->
glenn@6247 2082 </table>
simonp@7948 2083 -->
glenn@6257 2084 <!--
glenn@6247 2085 <h4>CSS Properties</h4>
glenn@6247 2086
glenn@6247 2087 <p>The DOM attribute name of a CSS property can be found by using the
glenn@6247 2088 following algorithm:</p>
glenn@6247 2089
glenn@6247 2090 <ol>
glenn@6247 2091 <li>Let <var>r</var> be the CSS property to be
glenn@6247 2092 converted.</li>
glenn@6247 2093
glenn@6247 2094 <li>Uppercase the first character after every U+002D (<code>-</code>) in
glenn@6247 2095 <var>r</var>.</li>
glenn@6247 2096
glenn@6247 2097 <li>Remove every U+002D (<code>-</code>) in <var>r</var>.</li>
glenn@6247 2098
glenn@6247 2099 <li>Return <var>r</var>.</li>
glenn@6247 2100 </ol>
glenn@6247 2101
glenn@6247 2102 <p class="note">This means that
glenn@6247 2103 <code>-<var>vendor</var>-<var>property</var></code>
glenn@6247 2104 becomes
glenn@6247 2105 <code><var><strong>V</strong>endor</var><var><strong>P</strong>roperty</var></code>
glenn@6247 2106 for instance.</p>
glenn@6247 2107 -->
glenn@6257 2108
glenn@6247 2109 <!-- ........................................................................................................................ -->
glenn@6247 2110 <!-- ........................................................................................................................ -->
glenn@6247 2111
glenn@6257 2112 <h3 id="css-values"><span class="secno">6.6 </span>CSS Values</h3>
glenn@6257 2113
glenn@6247 2114 <!-- ........................................................................................................................ -->
glenn@6247 2115
glenn@6257 2116 <h4 id="parsing-css-values"><span class="secno">6.6.1 </span>Parsing CSS Values</h4>
glenn@6257 2117
glenn@6257 2118 <p>To <dfn id="parse-a-css-value">parse a CSS value</dfn> for a given
glenn@6257 2119 <var>property</var> means to a parse the given value according to
glenn@6257 2120 the definition of the property that is an
glenn@6935 2121 <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for
glenn@6257 2122 <var>property</var> in the CSS specification. If the given value
glenn@6933 2123 is <span>ignored</span> return <code>null</code>. Otherwise return the CSS value for
glenn@6257 2124 the given <var>property</var>.</p>
glenn@6257 2125
glenn@6257 2126 <p class="note">"<code>!important</code>" declarations are not
glenn@6257 2127 part of the property value space and will therefore cause
glenn@6933 2128 <a href="#parse-a-css-value">parse a CSS value</a> to return <code>null</code>.</p>
glenn@6257 2129
glenn@6257 2130
glenn@6247 2131 <!-- ........................................................................................................................ -->
glenn@6247 2132
glenn@6257 2133 <h4 id="serializing-css-values"><span class="secno">6.6.2 </span>Serializing CSS Values</h4>
glenn@6257 2134
glenn@6247 2135 <!-- based on http://damowmow.com/playground/canon.txt -->
glenn@6247 2136
glenn@6257 2137 <p>To <dfn id="serialize-a-css-value">serialize a CSS value</dfn> follow
glenn@6257 2138 these rules:</p>
glenn@6247 2139
glenn@6247 2140 <ul>
glenn@6257 2141 <li><p><a href="#serialize-a-css-value-component" title="Serialize a CSS component value">Serialize</a> any
glenn@6257 2142 CSS component values in the value.</li>
glenn@6257 2143
glenn@6257 2144 <li><p>Where multiple CSS component values can appear in any order
glenn@6257 2145 without changing the meaning of the value (typically represented by a
glenn@6257 2146 double bar <code>||</code> in the value syntax), use the order as given
glenn@6257 2147 in the syntax.</li>
glenn@6247 2148 <!-- <code>&lt;border-width> &lt;border-style> &lt;color></code>
glenn@6247 2149 for <code>border</code> -->
glenn@6247 2150
glenn@6247 2151 <li>
glenn@6247 2152 <p>Where CSS component values of the value can be omitted without
glenn@6257 2153 changing the meaning of the value (e.g. initial values in shorthand
glenn@6257 2154 properties), omit them. If this would remove all the values, then
glenn@6257 2155 include the first allowed value.</p>
glenn@6257 2156
glenn@6257 2157 <p class="example">E.g. <code>margin: 20px 20px</code> becomes
glenn@6257 2158 <code>margin: 20px</code>.</p>
glenn@6257 2159
glenn@6257 2160 <p class="example">E.g. the value <code>0</code> for the
glenn@6257 2161 '<code>border</code>' property.</p>
glenn@6257 2162 </li>
glenn@6257 2163
glenn@6257 2164 <li><p>If the value of a shorthand property is requested and it cannot be
glenn@6257 2165 computed because the properties associated with the shorthand have values
glenn@6257 2166 that cannot be represented by the shorthand the serialization is the
glenn@6257 2167 empty string.</li>
glenn@6257 2168
glenn@6257 2169 <li><p>If a value has a <a href="#whitespace">whitespace</a>-separated list of
glenn@6257 2170 CSS component values,
glenn@6257 2171 <a href="#serialize-a-whitespace-separated-list" title="serialize a whitespace-separated list">serialize</a> the
glenn@6257 2172 value as a whitespace-separated list.</li>
glenn@6257 2173
glenn@6257 2174 <li><p>If a value has a comma-separated list of
glenn@6257 2175 CSS component values,
glenn@6257 2176 <a href="#serialize-a-comma-separated-list" title="serialize a comma-separated list">serialize</a> the
glenn@6257 2177 value as a comma-separated list.</li>
glenn@6247 2178 </ul>
glenn@6247 2179
glenn@6257 2180
glenn@6257 2181 <p>To
glenn@6257 2182 <dfn id="serialize-a-css-value-component">serialize a CSS component value</dfn>
glenn@6257 2183 depends on the component, as follows:</p>
glenn@6257 2184
glenn@6257 2185 <dl class="switch">
glenn@6257 2186 <dt>keyword</dt>
glenn@6257 2187 <dd><p>The keyword
glenn@6935 2188 <a class="external" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.</dd>
glenn@6257 2189
glenn@6257 2190 <dt>&lt;angle&gt;</dt>
glenn@6257 2191 <dd><p>The number of degrees serialized as per &lt;number&gt; followed by
glenn@6257 2192 the literal string "<code>deg</code>".</dd>
glenn@6257 2193
glenn@6257 2194 <dt>&lt;color&gt;</dt>
glenn@6802 2195 <dd>
glenn@6802 2196 <p>If &lt;color&gt; is a component of a resolved or computed value, then
glenn@6802 2197 return the color using the <code>rgb()</code> or <code>rgba()</code> functional
glenn@6802 2198 notation as follows:</p>
glenn@6802 2199 <ol>
glenn@6802 2200 <li>If the alpha component of the color is equal to one, then return the serialization of the
glenn@6802 2201 <code>rgb()</code> functional equivalent of the opaque color.</li>
glenn@6802 2202 <li>If the alpha component of the color is not equal to one, then return the serialization of the
glenn@6802 2203 <code>rgba()</code> functional equivalent of the non-opaque color.</li>
glenn@6802 2204 </ol>
glenn@6802 2205 <p>The serialization of the <code>rgb()</code> functional equivalent is the concatenation of the following:</p>
glenn@6802 2206 <ol>
glenn@6802 2207 <li>The string "<code>rgb(</code>".</li>
glenn@6809 2208 <li>The shortest base-ten integer serialization of the color's red component.</li>
glenn@6802 2209 <li>The string "<code>, </code>".</li>
glenn@6809 2210 <li>The shortest base-ten serialization of the color's green component.</li>
glenn@6802 2211 <li>The string "<code>, </code>".</li>
glenn@6809 2212 <li>The shortest base-ten serialization of the color's blue component.</li>
glenn@6802 2213 <li>The string "<code>)</code>".</li>
glenn@6802 2214 </ol>
glenn@6802 2215 <p>The serialization of the <code>rgba()</code> functional equivalent is the concatenation of the following:</p>
glenn@6802 2216 <ol>
glenn@6802 2217 <li>The string "<code>rgba(</code>".</li>
glenn@6809 2218 <li>The shortest base-ten serialization of the color's red component.</li>
glenn@6802 2219 <li>The string "<code>, </code>".</li>
glenn@6809 2220 <li>The shortest base-ten serialization of the color's green component.</li>
glenn@6802 2221 <li>The string "<code>, </code>".</li>
glenn@6809 2222 <li>The shortest base-ten serialization of the color's blue component.</li>
glenn@6802 2223 <li>The string "<code>, </code>".</li>
glenn@6809 2224 <li>The shortest serialization of the &lt;number&gt; that denotes the color's alpha component.</li>
glenn@6802 2225 <li>The string "<code>)</code>".</li>
glenn@6802 2226 </ol>
glenn@6802 2227
glenn@6809 2228 <p>In the above rules, the string "<code>, </code>" denotes a COMMA (U+002C) followed by a single SPACE (U+0020).</p>
glenn@6809 2229
glenn@6802 2230 <p>If &lt;color&gt; is a component of a specified value, then
glenn@6802 2231 return the color as follows:</p>
glenn@6802 2232 <ol>
glenn@6802 2233 <li>If the color was explicitly specified by the author, then return the original, author specified color value.</li>
glenn@6802 2234 <li>Otherwise, return the value that would be returned if the color were a component of a computed value.</li>
glenn@6802 2235 </ol>
glenn@6802 2236 <p class="issue">Should author specified values be normalized for case? Or should original case be preserved?</p>
glenn@6802 2237 </dd>
glenn@6247 2238 <!--
glenn@6247 2239 <dt>It is a system color</dt>
glenn@6247 2240
glenn@6247 2241 <dd>See below (you use the representation given in the specification that
glenn@6247 2242 defines the keyword).</dd>
glenn@6247 2243
glenn@6247 2244 <dt>Alpha component is equal to 1.0</dt>
glenn@6247 2245
glenn@6247 2246 <dd>The color is an uppercase six-digit hexadecimal value, prefixed with a
glenn@6247 2247 <code>#</code> character (U+0023 NUMBER SIGN), with the first two digits
glenn@6247 2248 representing the red component, the next two digits representing the green
glenn@6247 2249 component, and the last two digits representing the blue component, the
glenn@6247 2250 digits being in the range 0-9 A-F (U+0030 to U+0039 and U+0041 to
glenn@6247 2251 U+0046).</dd>
glenn@6247 2252
glenn@6247 2253 <dt>Alpha component is less than 1.0</dt>
glenn@6247 2254
glenn@6247 2255 <dd>The color is in the CSS <code>rgba()</code> functional-notation format:
glenn@6247 2256 the literal string <code>rgba</code> (U+0072 U+0067 U+0062 U+0061) followed
glenn@6247 2257 by a U+0028 LEFT PARENTHESIS, a <span>color component integer</span>
glenn@6247 2258 representing the red component, a <span>color component separator</span>, a
glenn@6247 2259 <span>color component integer</span> for the green component, a <span>color
glenn@6247 2260 component separator</span>, a <span>color component integer</span> for the
glenn@6247 2261 blue component, another <span>color component separator</span> a U+0030
glenn@6247 2262 DIGIT ZERO, a U+002E FULL STOP (representing the decimal point), one or
glenn@6247 2263 more digits in the range 0-9 (U+0030 to U+0039) representing the fractional
glenn@6247 2264 part of the alpha value, and finally a U+0029 RIGHT PARENTHESIS.</dd>
glenn@6247 2265
glenn@6247 2266 <dt>The keyword <code>transparent</code> is used</dt>
glenn@6247 2267
glenn@6247 2268 <dd>The color is <code>rgba(0, 0, 0, 0)</code>.</dd>
glenn@6247 2269 -->
glenn@6247 2270
glenn@6257 2271 <dt>&lt;counter&gt;</dt>
glenn@6247 2272 <dd>
glenn@6247 2273 <p>The concatenation of:</p>
glenn@6247 2274 <ol>
glenn@6257 2275 <li><p>If &lt;counter&gt; has three CSS component values the string
glenn@6257 2276 "<code>counters(</code>".</li>
glenn@6257 2277 <li><p>If &lt;counter&gt; has two CSS component values the string
glenn@6257 2278 "<code>counter(</code>".</li>
glenn@6257 2279 <li><p>The result of
glenn@6257 2280 <a href="#serialize-a-comma-separated-list" title="serialize a comma-separated list">serializing</a> the
glenn@6257 2281 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a>
glenn@6257 2282 CSS component values belonging to &lt;counter&gt; as list while omitting
glenn@6257 2283 the last CSS component value if it is 'decimal'.</li>
glenn@6257 2284 <li><p>"<code>)</code>" (U+0029).</li>
glenn@6247 2285 </ol>
glenn@6257 2286 </dd>
glenn@6257 2287
glenn@6257 2288 <dt>&lt;frequency&gt;</dt>
glenn@6257 2289 <dd><p>The frequency in hertz serialized as per &lt;number&gt; followed by
glenn@6257 2290 the literal string "<code>hz</code>".</dd>
glenn@6257 2291
glenn@6257 2292 <dt>&lt;identifier&gt;</dt>
glenn@6257 2293 <dd><p>The identifier
glenn@6257 2294 <a href="#serialize-an-identifier" title="serialize an identifier">escaped</a>.</dd>
glenn@6257 2295
glenn@6257 2296 <dt>&lt;integer&gt;</dt>
glenn@6257 2297 <dd><p>A base-ten integer using digits 0-9 (U+0030 to U+0039) in the
glenn@6257 2298 shortest form possible, preceded by "<code>-</code>" (U+002D) if it is
glenn@6257 2299 negative.</dd>
glenn@6257 2300
glenn@6257 2301 <dt>&lt;length&gt;</dt>
glenn@6247 2302 <dd>
glenn@6247 2303 <p>A length of zero is represented by the literal string
glenn@6257 2304 "<code>0px</code>".</p>
glenn@6247 2305
glenn@6247 2306 <p>Absolute lengths: the number of millimeters serialized as per
glenn@6344 2307 &lt;number&gt; followed by the literal string "<code>mm</code>".</p>
glenn@6344 2308 <p class="issue">Rumor has it absolute lengths will become relative
glenn@6344 2309 lengths. Centimeters would be compatible with &lt;resolution&gt;...</p>
glenn@6247 2310
glenn@6247 2311 <p>Relative lengths: the &lt;number&gt; component serialized as per
glenn@6257 2312 &lt;number&gt; followed by the unit in its canonical form as defined in its
glenn@6257 2313 respective specification.</p>
glenn@6257 2314 </dd>
glenn@6257 2315
glenn@6257 2316 <dt>&lt;number&gt;</dt>
glenn@6344 2317 <dd><p class="issue">Browsers seem to use ToString(), but that might give a
glenn@6257 2318 significand which according to some is teh evil (and also currently does
glenn@6257 2319 not parse correctly).</dd>
glenn@6257 2320
glenn@6257 2321 <dt>&lt;percentage&gt;</dt>
glenn@6257 2322 <dd><p>The &lt;number&gt; component serialized as per &lt;number&gt; followed
glenn@6257 2323 by the literal string "<code>%</code>" (U+0025).</dd>
glenn@6257 2324
glenn@6257 2325 <dt>&lt;resolution&gt;</dt>
glenn@6257 2326 <dd><p>The resolution in dots per centimeter serialized as per
glenn@6257 2327 &lt;number&gt; followed by the literal string "<code>dpcm</code>".</dd>
glenn@6257 2328
glenn@6257 2329 <dt>&lt;shape&gt;</dt>
glenn@6257 2330 <dd><p>The string "<code>rect(</code>", followed by the result
glenn@6257 2331 of <a href="#serialize-a-comma-separated-list" title="serialize a comma-separated list">serializing</a> the
glenn@6257 2332 <a href="#serialize-a-css-value-component" title="serialize a CSS component value">serialized</a>
glenn@6257 2333 CSS component values belonging to &lt;shape&gt; as list, followed by
glenn@6257 2334 "<code>)</code>" (U+0029).</dd>
glenn@6257 2335
glenn@6257 2336 <dt>&lt;string&gt;</dt>
glenn@6257 2337 <dt>&lt;family-name&gt;</dt>
glenn@6257 2338 <dt>&lt;specific-voice&gt;</dt>
glenn@6257 2339 <dd><p>The string
glenn@6257 2340 <a href="#serialize-a-string" title="serialize a string">string escaped</a>.</dd>
glenn@6257 2341
glenn@6257 2342 <dt>&lt;time&gt;</dt>
glenn@6257 2343 <dd><p>The time in seconds serialized as per &lt;number&gt; followed by
glenn@6257 2344 the literal string "<code>s</code>".</dd>
glenn@6257 2345
glenn@6257 2346 <dt>&lt;uri&gt;</dt>
glenn@6935 2347 <dd><p>The <a class="external" href="http://dev.w3.org/html5/spec/single-page.html#absolute-url">absolute URL</a>
glenn@6257 2348 <a href="#serialize-a-url" title="serialize a URL">URL escaped</a>.</dd>
glenn@6247 2349 </dl>
glenn@6247 2350
glenn@6257 2351 <p>
glenn@6257 2352 &lt;absolute-size&gt;,
glenn@6257 2353 &lt;border-width&gt;,
glenn@6257 2354 &lt;border-style&gt;,
glenn@6257 2355 &lt;bottom&gt;,
glenn@6257 2356 &lt;generic-family&gt;,
glenn@6257 2357 &lt;generic-voice&gt;,
glenn@6257 2358 &lt;left&gt;,
glenn@6257 2359 &lt;margin-width&gt;,
glenn@6257 2360 &lt;padding-width&gt;,
glenn@6257 2361 &lt;relative-size&gt;,
glenn@6257 2362 &lt;right&gt;, and
glenn@6257 2363 &lt;top&gt;,
glenn@6257 2364 are considered macros by this specification. They all represent instances
glenn@6257 2365 of components outlined above.</p>
glenn@6257 2366
glenn@6344 2367 <p class="issue">One idea is that we can remove this section somewhere in
glenn@6257 2368 the CSS3/CSS4 timeline by moving the above definitions to the drafts that
glenn@6257 2369 define the CSS components.</p>
glenn@6257 2370
glenn@6257 2371
glenn@6257 2372 <h5 id="examples-0"><span class="secno">6.6.2.1 </span>Examples</h5>
glenn@6247 2373
glenn@6247 2374 <p>Here are some examples of before and after results on specified values.
glenn@6257 2375 The before column could be what the author wrote in a style sheet, while
glenn@6257 2376 the after column shows what querying the DOM would return.</p>
glenn@6257 2377
glenn@6257 2378 <div class="example">
glenn@6247 2379 <table>
glenn@6247 2380 <thead>
glenn@6257 2381 <tr><th>Before<th>After
glenn@6247 2382 <tbody>
glenn@6257 2383 <tr><td><code>background: none</code><td><code>background: rgba(0, 0, 0, 0)</code>
glenn@6257 2384 <tr><td><code>outline: none</code><td><code>outline: invert</code>
glenn@6257 2385 <tr><td><code>border: none</code><td><code>border: medium</code>
glenn@6257 2386 <tr><td><code>list-style: none</code><td><code>list-style: disc</code>
glenn@6257 2387 <tr><td><code>margin: 0 1px 1px 1px</code><td><code>margin: 0px 1px 1px</code>
glenn@6257 2388 <tr><td><code>azimuth: behind left</code><td><code>azimuth: 220deg</code>
glenn@6257 2389 <tr><td><code>font-family: a, 'b"', serif</code><td><code>font-family: "a", "b\"", serif</code>
glenn@6257 2390 <tr><td><code>content: url('h)i') '\[\]'</code><td><code>content: url("h)i") "[]"</code>
glenn@6257 2391 <tr><td><code>azimuth: leftwards</code><td><code>azimuth: leftwards</code>
glenn@6257 2392 <tr><td><code>color: rgb(18, 52, 86)</code><td><code>color: #123456</code>
glenn@6257 2393 <tr><td><code>color: rgba(000001, 0, 0, 1)</code><td><code>color: #000000</code>
glenn@6247 2394 </table>
glenn@6247 2395
glenn@6344 2396 <p class="issue">Some of these need to be updated per the new rules.</p>
glenn@6247 2397 </div>
glenn@6257 2398
glenn@6247 2399 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6247 2400
glenn@6257 2401 <h2 id="dom-access-to-css-declaration-blocks"><span class="secno">7 </span>DOM Access to CSS Declaration Blocks</h2>
glenn@6257 2402
glenn@6247 2403 <!-- ........................................................................................................................ -->
glenn@6247 2404 <!-- ........................................................................................................................ -->
glenn@6247 2405
glenn@6257 2406 <h3 id="the-elementcssinlinestyle-interface"><span class="secno">7.1 </span>The <code>ElementCSSInlineStyle</code> Interface</h3>
glenn@6257 2407
glenn@6257 2408 The <code>ElementCSSInlineStyle</code> interface is implemented by <code>Element</code> objects in order to provide access to inline style properties.
glenn@6437 2409 <pre class="idl"><span class="idlInterface" id="widl-def-ElementCSSInlineStyle">[NoInterfaceObject]
glenn@6437 2410 interface <span class="idlInterfaceID">ElementCSSInlineStyle</span> {
glenn@6257 2411 <span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>CSSStyleDeclaration</a></span> <span class="idlAttrName"><a href="#widl-ElementCSSInlineStyle-style">style</a></span>;</span>
glenn@6247 2412 };</span></pre>
glenn@6257 2413 <dl class="attributes">
glenn@6257 2414 <dt class="attribute" id="widl-ElementCSSInlineStyle-style">
glenn@6257 2415 <code>style</code> of type <span class="idlAttrType"><a>CSSStyleDeclaration</a></span>, readonly</dt>
glenn@6257 2416 <dd>
glenn@6257 2417 The <code>style</code> attribute must return a mutable <code>CSSStyleDeclaration</code> object that represents the inline style properties of the associated <code>Element</code> instance.</dd>
glenn@6257 2418 </dl>
glenn@6257 2419
glenn@6257 2420
glenn@6247 2421 <!-- ........................................................................................................................ -->
glenn@6247 2422 <!-- ........................................................................................................................ -->
glenn@6247 2423
glenn@6257 2424 <h3 id="extensions-to-the-window-interface"><span class="secno">7.2 </span>Extensions to the <code>Window</code> Interface</h3>
glenn@6257 2425
glenn@6257 2426
glenn@6257 2427 <pre class="idl"><span class="idlInterface" id="widl-def-Window">partial interface <span class="idlInterfaceID">Window</span> {
glenn@6257 2428 <span class="idlMethod"> <span class="idlMethType"><a>CSSStyleDeclaration</a></span> <span class="idlMethName"><a href="#widl-Window-getComputedStyle-CSSStyleDeclaration-Element-elt">getComputedStyle</a></span> (<span class="idlParam"><span class="idlParamType"><a>Element</a></span> <span class="idlParamName">elt</span></span>);</span>
glenn@6257 2429 <span class="idlMethod"> <span class="idlMethType"><a>CSSStyleDeclaration</a></span> <span class="idlMethName"><a href="#widl-Window-getComputedStyle-CSSStyleDeclaration-Element-elt-DOMString-pseudoElt">getComputedStyle</a></span> (<span class="idlParam"><span class="idlParamType"><a>Element</a></span> <span class="idlParamName">elt</span></span>, <span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">pseudoElt</span></span>);</span>
glenn@6247 2430 };</span></pre>
glenn@6257 2431 <dl class="methods">
glenn@6257 2432 <dt class="method" id="widl-Window-getComputedStyle-CSSStyleDeclaration-Element-elt">
glenn@6642 2433 <code>getComputedStyle</code> (<span class="idlParam"><span class="idlParamType"><a>Element</a></span> <span class="idlParamName">elt</span></span>), returns <span class="idlMethType"><a>CSSStyleDeclaration</a></span></dt>
glenn@6257 2434 <dt class="method" id="widl-Window-getComputedStyle-CSSStyleDeclaration-Element-elt-DOMString-pseudoElt">
glenn@6642 2435 <code>getComputedStyle</code> (<span class="idlParam"><span class="idlParamType"><a>Element</a></span> <span class="idlParamName">elt</span></span>, <span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">pseudoElt</span></span>), returns <span class="idlMethType"><a>CSSStyleDeclaration</a></span></dt>
glenn@6257 2436 <dd>
glenn@6935 2437 <p>The <code>getComputedStyle</code> operation must run these steps:</p> <ol> <li><p>Let <var>doc</var> be the <code class="external"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> associated with the <code class="external"><a href="http://dev.w3.org/html5/spec/single-page.html#window">Window</a></code> object on which the method was invoked.</li> <li><p>Let <var>obj</var> be <var>elt</var>.</li> <li><p>If <var>pseudoElt</var> is as an <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for either '<code>:before</code>' or '<code>::before</code>' let <var>obj</var> be the '::before' pseudo-element of <var>elt</var>.</li> <li><p>If <var>pseudoElt</var> is as an <a class="external" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for either '<code>:after</code>' or '<code>::after</code>' let <var>obj</var> be the '::after' pseudo-element of <var>elt</var>.</li> <li> <p>Return a <a href="#css-declaration-block">CSS declaration block</a> with the <a href="#css-declaration-block-readonly-flag">CSS declaration block readonly flag</a> set and the <a href="#css-declaration-block-declarations">CSS declaration block declarations</a> set to all properties the user agent supports with as value the <a href="#resolved-value">resolved value</a> computed for <var>obj</var> using the style rules associated with <var>doc</var>.</p> <p class="note">This means that even if <var>obj</var> is in a different document (e.g. one fetched via <code>XMLHttpRequest</code>) it will still use the style rules associated with the document that is associated with the global object on which <code title="dom-Window-getComputedStyle">getComputedStyle()</code> was invoked to compute the <a href="#css-declaration-block">CSS declaration block</a>.</p> </li> </ol> <p class="note">Because of historical IDL limitations the <code>getComputedStyle</code> operation used to be on a separate interface, <code>ViewCSS</code>.</dd>
glenn@6257 2438 </dl>
glenn@6257 2439
glenn@6257 2440
glenn@6247 2441 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6247 2442
glenn@6257 2443 <h2 id="resolved-values"><span class="secno">8 </span>Resolved Values</h2>
glenn@6257 2444
glenn@6257 2445 <p><code title="dom-Window-getComputedStyle">getComputedStyle()</code> was
glenn@6257 2446 historically defined to return the "computed value" of an element or
glenn@6257 2447 pseudo-element. However, the concept of "computed value" changed between
glenn@6257 2448 revisions of CSS while the implementation of
glenn@6257 2449 <code title="dom-Window-getComputedStyle">getComputedStyle()</code> had to
glenn@6257 2450 remain the same for compatibility with deployed scripts. To address this
glenn@6257 2451 issue this specification introduces the concept of a
glenn@6257 2452 <dfn id="resolved-value">resolved value</dfn>.</p>
glenn@6257 2453
glenn@6257 2454 <p>The <a href="#resolved-value">resolved value</a> for a given property can be determined
glenn@6257 2455 as follows:</p>
glenn@6257 2456
glenn@6257 2457 <dl class="switch">
glenn@6257 2458 <!--
glenn@6247 2459 We want to treat shorthand properties like any other value basically.
glenn@6247 2460
glenn@6247 2461 <dt>'<code>background</code>'
glenn@6247 2462 <dt>'<code>border</code>'
glenn@6247 2463 <dt>'<code>border-collapse</code>'
glenn@6247 2464 <dt>'<code>border-color</code>'
glenn@6247 2465 <dt>'<code>border-spacing</code>'
glenn@6933 2466 <dt>'<code>border-style</code>'
glenn@6933 2467 <dt>'<code>border-top</code>'
glenn@6933 2468 <dt>'<code>border-right</code>'
glenn@6247 2469 <dt>'<code>border-bottom</code>'
glenn@6247 2470 <dt>'<code>border-left</code>'
glenn@6247 2471 <dt>'<code>border-width</code>'
glenn@6247 2472 <dt>'<code>font</code>'
glenn@6247 2473 <dt>'<code>list-style</code>'
glenn@6247 2474 <dt>'<code>margin</code>'
glenn@6247 2475 <dt>'<code>outline</code>'
glenn@6247 2476 <!- - overflow is not - ->
glenn@6247 2477 <dt>'<code>padding</code>'
glenn@6247 2478 <dt>'<code>pause</code>'
glenn@6247 2479 <dd>
glenn@6247 2480 <p>There is no <span>resolved value</span>.</p>
glenn@6247 2481 </dd>
glenn@6247 2482 -->
glenn@6247 2483
glenn@6257 2484 <dt>'<code>line-height</code>'</dt>
glenn@6257 2485 <dd><p>The <a href="#resolved-value">resolved value</a> is the used value.</dd>
glenn@6257 2486
glenn@6257 2487 <dt>'<code>height</code>'</dt>
glenn@6257 2488 <dt>'<code>margin</code>'</dt>
glenn@6257 2489 <dt>'<code>margin-bottom</code>'</dt>
glenn@6257 2490 <dt>'<code>margin-left</code>'</dt>
glenn@6257 2491 <dt>'<code>margin-right</code>'</dt>
glenn@6257 2492 <dt>'<code>margin-top</code>'</dt>
glenn@6257 2493 <dt>'<code>padding</code>'</dt>
glenn@6257 2494 <dt>'<code>padding-bottom</code>'</dt>
glenn@6257 2495 <dt>'<code>padding-left</code>'</dt>
glenn@6257 2496 <dt>'<code>padding-right</code>'</dt>
glenn@6257 2497 <dt>'<code>padding-top</code>'</dt>
glenn@6257 2498 <dt>'<code>width</code>'</dt>
glenn@6257 2499 <dd><p>If the property applies to the element or pseudo-element and the
glenn@6257 2500 <a href="#resolved-value">resolved value</a> of the '<code>display</code>' property is not
glenn@6257 2501 <code>none</code>, the <a href="#resolved-value">resolved value</a> is the
glenn@6257 2502 <span>used value</span>. Otherwise the <a href="#resolved-value">resolved value</a> is the
glenn@6257 2503 computed value.</dd>
glenn@6257 2504
glenn@6257 2505 <dt>'<code>bottom</code>'</dt>
glenn@6257 2506 <dt>'<code>left</code>'</dt>
glenn@6257 2507 <dt>'<code>right</code>'</dt>
glenn@6257 2508 <dt>'<code>top</code>'</dt>
glenn@6257 2509 <dd><p>If the property applies to a positioned element and the
glenn@6257 2510 <a href="#resolved-value">resolved value</a> of the '<code>display</code>' property is not
glenn@6257 2511 <code>none</code>, the <a href="#resolved-value">resolved value</a> is the
glenn@6257 2512 <span>used value</span>. Otherwise the <a href="#resolved-value">resolved value</a> is the
glenn@6257 2513 computed value.</dd>
glenn@6257 2514
glenn@6257 2515 <dt>Any other property</dt>
glenn@6257 2516 <dd><p>The <a href="#resolved-value">resolved value</a> is the computed value.</dd>
glenn@6247 2517 </dl>
glenn@6257 2518
glenn@6247 2519 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6247 2520
glenn@6257 2521 <h2 id="iana-considerations"><span class="secno">9 </span>IANA Considerations</h2>
glenn@6257 2522
glenn@6247 2523 <!-- ........................................................................................................................ -->
glenn@6247 2524 <!-- ........................................................................................................................ -->
glenn@6247 2525
glenn@6257 2526 <h3 id="default-style"><span class="secno">9.1 </span><dfn title="http-default-style"><code>Default-Style</code></dfn></h3>
glenn@6247 2527
glenn@6247 2528 <p>This section describes a header field for registration in the Permanent
glenn@6257 2529 Message Header Field Registry.
glenn@6257 2530 <!--<a href="XXX">[RFC3864]</a>--></p>
glenn@6247 2531
glenn@6247 2532 <dl>
glenn@6257 2533 <dt>Header field name</dt>
glenn@6257 2534 <dd>Default-Style</dd>
glenn@6257 2535 <dt>Applicable protocol</dt>
glenn@6257 2536 <dd>http</dd>
glenn@6257 2537 <dt>Status</dt>
glenn@6257 2538 <dd>standard</dd>
glenn@6257 2539 <dt>Author/Change controller</dt>
glenn@6257 2540 <dd>W3C</dd>
glenn@6257 2541 <dt>Specification document(s)</dt>
glenn@6257 2542 <dd>This document is the relevant specification.</dd>
glenn@6257 2543 <dt>Related information</dt>
glenn@6257 2544 <dd>None.</dd>
glenn@6247 2545 </dl>
glenn@6257 2546
glenn@6247 2547 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6247 2548
glenn@6257 2549 <h2 class="no-num" id="references">References</h2>
glenn@6257 2550
glenn@6247 2551 <!-- ........................................................................................................................ -->
glenn@6247 2552 <!-- ........................................................................................................................ -->
glenn@6247 2553
glenn@6257 2554 <h3 class="no-num" id="normative-references">Normative references</h3>
glenn@6642 2555 <div id="anolis-references-normative"><dl><dt id="refsCSS">[CSS]
glenn@6642 2556 <dd><cite><a href="http://www.w3.org/TR/CSS2/">CSS</a></cite>, Bert Bos, Tantek Çelik, Ian Hickson et al.. W3C.
glenn@6642 2557
glenn@6642 2558 <dt id="refsDOM">[DOM]
glenn@6935 2559 <dd><cite><a href="http://dom.spec.whatwg.org/">DOM</a></cite>, Anne van Kesteren, Aryeh Gregor and Ms2ger. WHATWG.
glenn@6257 2560
glenn@6794 2561 <dt id="refsDOM2STYLE">[DOM2STYLE]
glenn@6794 2562 <dd><cite><a href="http://www.w3.org/TR/DOM-Level-2-Style/">Document Object Model (DOM) Level 2 Style Specification</a></cite>, Chris Wilson, Philippe Le Hégaret and Vidur Apparao. W3C.
glenn@6794 2563
glenn@6257 2564 <dt id="refsHTML">[HTML]
glenn@6935 2565 <dd><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">HTML</a></cite>, Ian Hickson. WHATWG.
glenn@6257 2566
glenn@6257 2567 <dt id="refsRFC2119">[RFC2119]
glenn@6257 2568 <dd><cite><a href="http://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a></cite>, Scott Bradner. IETF.
glenn@6257 2569
glenn@6257 2570 <dt id="refsXML">[XML]
glenn@6257 2571 <dd><cite><a href="http://www.w3.org/TR/xml/">Extensible Markup Language</a></cite>, Tim Bray, Jean Paoli, C. M. Sperberg-McQueen et al.. W3C.
glenn@6257 2572
glenn@6257 2573 <dt id="refsXMLSS">[XMLSS]
glenn@6257 2574 <dd><cite><a href="http://www.w3.org/TR/xml-stylesheet/">Associating Style Sheets with XML documents 1.0 (Second Edition)</a></cite>, James Clark, Simon Pieters and Henry S. Thompson. W3C.
glenn@6257 2575
glenn@6257 2576 </dl></div>
glenn@6257 2577
glenn@6247 2578 <!-- ........................................................................................................................ -->
glenn@6247 2579 <!-- ........................................................................................................................ -->
glenn@6247 2580
glenn@6257 2581 <h3 class="no-num" id="informative-references">Informative references</h3>
glenn@6257 2582 <div id="anolis-references-informative"></div>
glenn@6257 2583
glenn@6247 2584 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6247 2585
glenn@6794 2586 <h2 class="no-num" id="changes">Change History</h2>
glenn@6794 2587
glenn@6794 2588 <p>This section documents the primary technical changes of CSSOM related functionality, with a focus on changes to API signatures.</p>
glenn@6794 2589
glenn@6794 2590 <h3 class="no-num" id="changes-from-dom2">Changes From DOM-2 Style</h3>
glenn@6794 2591
glenn@6794 2592 <ul>
glenn@6794 2593 <li><p>Remove definition of <code>CSSRule.UNKNOWN_RULE</code>, reserving its value (0) to prevent future reuse.</li>
glenn@6794 2594 <li><p>Remove definition of <code>DOMImplementationCSS</code> interface.</li>
glenn@6794 2595 </ul>
glenn@6794 2596
glenn@6794 2597 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6794 2598
glenn@6257 2599 <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
glenn@6257 2600
glenn@6257 2601 <p>The editors would like to thank
glenn@6257 2602
glenn@6257 2603 Alexey Feldgendler,
glenn@6257 2604 Björn Höhrmann,
glenn@6794 2605 Boris Zbasky,
glenn@6257 2606 Brian Kardell,
glenn@6257 2607 Christian Krebs,
glenn@6257 2608 Daniel Glazman,
glenn@6257 2609 David Baron,
glenn@6257 2610 <i>fantasai</i>,
glenn@6257 2611 Hallvord R. M. Steen,
glenn@6257 2612 Ian Hickson,
glenn@6257 2613 John Daggett,
glenn@6257 2614 Lachlan Hunt,
glenn@6257 2615 Morten Stenshorne,
glenn@6257 2616 Philip Taylor,
glenn@6257 2617 Robert O'Callahan,
glenn@6257 2618 Sjoerd Visscher,
glenn@6257 2619 Simon Pieters,
glenn@6257 2620 Sylvain Galineau,
glenn@6257 2621 Tarquin Wilton-Jones, and
glenn@6257 2622 Zack Weinberg
glenn@6257 2623
glenn@6257 2624 for contributing to this specification.</p>
glenn@6257 2625
glenn@6257 2626 <p>Additional thanks to Ian Hickson for writing the
glenn@6257 2627 initial version of the alternative style sheets API and canonicalization
glenn@6257 2628 (now serialization) rules for CSS values.</p>
glenn@6257 2629
glenn@6247 2630 <!-- XXX NOTES
glenn@6247 2631
glenn@6247 2632 <style type=text/css;charset=utf-8> does create a StyleSheet in Firefox
glenn@6247 2633 and Opera, but does not create a StyleSheet in IE. I prefer IE.
glenn@6247 2634
glenn@6247 2635 <style type=TEXT/CSS> sets the style sheet type to text/css in Firefox and
glenn@6247 2636 TEXT/CSS in Opera and IE. I prefer Firefox.
glenn@6247 2637
glenn@6247 2638 <style> sets the style sheet location to the document location Firefox,
glenn@6247 2639 the empty string in IE, and null in Opera. I prefer Opera
glenn@6247 2640
glenn@6247 2641 <style media="x"> invokes .sheet.media.mediaText = "x"
glenn@6247 2642
glenn@6247 2643 <style> does not "have" a title
glenn@6247 2644
glenn@6247 2645 .cascadedStyle that returns less keywords than currentStyle, no inherit,
glenn@6247 2646 etc.
glenn@6247 2647
glenn@6247 2648 Markup style: http://krijnhoetmer.nl/irc-logs/whatwg/20100204#l-529
glenn@6247 2649 -->
glenn@6257 2650
glenn@6257 2651
glenn@6257 2652
glenn@6257 2653
glenn@6257 2654

mercurial