cssom/cssom-source

Mon, 01 Oct 2012 12:17:55 +0800

author
Glenn Adams <glenn@skynav.com>
date
Mon, 01 Oct 2012 12:17:55 +0800
changeset 6802
0d2a6c814dd1
parent 6794
7c881a97c919
child 6809
380501b9292e
permissions
-rwxr-xr-x

[cssom] first draft of color serialization rules

glenn@4922 1 <!doctype html>
annevk@4900 2 <html lang="en-US">
annevk@4900 3 <head>
glenn@4922 4 <meta charset=utf-8>
glenn@4922 5 <title>CSS Object Model (CSSOM)</title>
glenn@6229 6 <link rel="stylesheet" href="cssom.css">
annevk@4900 7 <link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
annevk@4900 8 </head>
annevk@4900 9 <body class="draft">
annevk@4900 10 <div class="head">
glenn@4923 11 <!--logo-->
glenn@4923 12
glenn@6229 13 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 14 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 15
glenn@4922 16 <h1 id="cssom">CSS Object Model (CSSOM)</h1>
glenn@4922 17
glenn@6229 18 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 19
glenn@4922 20 <h2 class="no-num no-toc" id="w3c-doctype">[LONGSTATUS] [DATE: 3 August 2002]</h2>
annevk@4900 21
annevk@4900 22 <dl>
annevk@4900 23
annevk@4900 24 <dt>This Version:</dt>
glenn@5055 25 <dd class=dontpublish><a href="http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html">http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html</a></dd>
annevk@4900 26 <dd class=publish><a href="[VERSION]">[VERSION]</a></dd>
annevk@4900 27
glenn@4922 28 <dt class=dontpublish>Participate:</dt>
glenn@6229 29 <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>
glenn@6229 30 <dd class=dontpublish><a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&amp;component=CSSOM">File a bug</a></dd>
glenn@6529 31 <dd class=dontpublish><a href="irc://irc.w3.org/css">IRC: #css on W3C</a></dd>
glenn@4922 32
annevk@4900 33 <dt class=publish>Latest Version:</dt>
annevk@4900 34 <dd class=publish><a href="[LATEST]">[LATEST]</a></dd>
annevk@4900 35
annevk@4900 36 <dt class=publish>Latest Editor's draft:</dt>
glenn@5055 37 <dd class=publish><a href="http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html">http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html</a></dd>
annevk@4900 38
annevk@4910 39 <dt class=dontpublish>Previous Version:</dt>
glenn@4923 40 <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>
annevk@4910 41 <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>
annevk@4900 42
glenn@4922 43 <dt>Editors:</dt>
glenn@4922 44 <dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a>
glenn@4922 45 (<a href="http://www.cox.com/">Cox Communications, Inc.</a>)
glenn@4922 46 &lt;<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>&gt;</dd>
glenn@6229 47 <dd><a>Shane Stephens</a>
glenn@4922 48 (<a href="http://www.google.com/">Google, Inc.</a>)
glenn@4922 49 &lt;<a href="mailto:shans@google.com">shans@google.com</a>&gt;</dd>
glenn@4922 50
glenn@4922 51 <dt>Previous Editor:</dt>
annevk@4900 52 <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
annevk@4900 53 (<a href="http://www.opera.com/">Opera Software ASA</a>)
annevk@4900 54 &lt;<a href="mailto:annevk@opera.com">annevk@opera.com</a>&gt;</dd>
annevk@4900 55 </dl>
annevk@4905 56
glenn@6344 57 <!--copyright-->
glenn@4922 58
annevk@4900 59 </div>
annevk@4900 60
annevk@4905 61 <hr class="top">
annevk@4900 62
glenn@6229 63 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 64
annevk@4900 65 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
annevk@4900 66
annevk@4900 67 <p>CSSOM defines APIs (including generic parsing and serialization rules)
annevk@4900 68 for Media Queries, Selectors, and of course CSS itself.</p>
annevk@4900 69
glenn@6229 70 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 71
annevk@4900 72 <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
annevk@4900 73
glenn@6257 74 <p>This is a public copy of the editors' draft. It is provided for discussion only and may change at any moment.
glenn@6257 75 Its publication here does not imply endorsement of its contents by W3C or by the CSS Working Group. Don't cite
glenn@6257 76 this document other than as work in progress.</p>
glenn@6257 77
glenn@6257 78 <p class="note">Implementers should note well that this specification is an ongoing effort to sort out
glenn@6794 79 what has been widely implemented and deployed from <span data-anolis-ref>DOM2STYLE</span> as well as common extensions thereto, some details
glenn@6257 80 of which are currently interoperable and others which are not currently interoperable. As this specification moves
glenn@6257 81 forward, it is hoped that these differences will be resolved and an unambiguous and adequate consensus-based
glenn@6257 82 specification will emerge.</p>
glenn@6257 83
annevk@4905 84 <p><em>This section describes the status of this document at the time of
annevk@4905 85 its publication. Other documents may supersede this document. A list of
annevk@4905 86 current W3C publications and the latest revision of this technical report
annevk@4905 87 can be found in the
annevk@4905 88 <a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
annevk@4905 89
glenn@6245 90 <p class="dontpublish">This is the [DATE: 3 August 2002] [LONGSTATUS] of CSSOM. Please send comments to
glenn@4922 91 <a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
glenn@4922 92 (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
glenn@4922 93 with <samp>[cssom]</samp> at the start of the subject line.
annevk@4905 94
glenn@6245 95 <p class="publish">This is the [DATE] First Public Working Draft of CSSOM, produced by the
annevk@4905 96 <a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part
annevk@4905 97 of the <a href="http://www.w3.org/Style/">Style Activity</a>).
annevk@4910 98 <!--XXX remove "First Public" after initial publication -->
annevk@4905 99
annevk@4905 100 <p>This document was produced by a group operating under the
annevk@4905 101 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
annevk@4905 102 W3C maintains a
annevk@4905 103 <a href="http://www.w3.org/2004/01/pp-impl/32061/status" rel=disclosure>public list of any patent disclosures</a>
annevk@4905 104 made in connection with the deliverables of the group; that page also
annevk@4905 105 includes instructions for disclosing a patent. An individual who has
annevk@4905 106 actual knowledge of a patent which the individual believes contains
annevk@4905 107 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
annevk@4905 108 must disclose the information in accordance with
annevk@4905 109 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>
annevk@4900 110
glenn@6229 111 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 112
annevk@4900 113 <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
annevk@4900 114
annevk@4900 115 <!--toc-->
annevk@4900 116
glenn@6229 117 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 118
annevk@4900 119 <h2 id="introduction">Introduction</h2>
annevk@4900 120
glenn@6794 121 <p>This document formally specifies the core features of the CSS Object Model (CSSOM). Other documents in the CSSOM family of specifications
glenn@6794 122 as well as other CSS related specifications define extensions to these core features.</p>
annevk@4900 123
glenn@6794 124 <p>The core features of the CSSOM are oriented towards providing basic capabilities to author-defined scripts to permit access to
glenn@6794 125 and manipulation of style related state information and processes.</p>
glenn@6229 126
glenn@6794 127 <p>The features defined below are fundamentally based on prior specifications of the W3C DOM Working Group, primarily
glenn@6794 128 <span data-anolis-ref>DOM2STYLE</span>. The purposes of the present document are (1) to improve on that prior work by providing
glenn@6794 129 more technical specificity (so as to improve testability and interoperability), (2) to deprecate or remove certain less-widely implemented
glenn@6794 130 features no longer considered to be essential in this context, and (3) to newly specify certain extensions that have been
glenn@6794 131 or expected to be widely implemented.</p>
annevk@4900 132
glenn@6794 133 <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>
annevk@4900 134
glenn@6229 135 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 136
annevk@4902 137 <h2>Conformance</h2>
annevk@4902 138
glenn@6229 139 <p>All diagrams, examples, and notes in this specification are
glenn@6229 140 non-normative, as are all sections explicitly marked non-normative.
glenn@6229 141 Everything else in this specification is normative.
glenn@6229 142
glenn@6229 143 <p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
glenn@6229 144 NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
glenn@6229 145 "OPTIONAL" in the normative parts of this document are to be
glenn@6229 146 interpreted as described in RFC2119. For readability, these words do
glenn@6229 147 not appear in all uppercase letters in this specification.
glenn@6229 148 <span data-anolis-ref>RFC2119</span>
glenn@6229 149
glenn@6229 150 <p>Requirements phrased in the imperative as part of algorithms
glenn@6229 151 (such as "strip any leading space characters" or "return false and
glenn@6229 152 terminate these steps") are to be interpreted with the meaning of the
glenn@6229 153 key word ("must", "should", "may", etc) used in introducing the
glenn@6229 154 algorithm.
glenn@6229 155
glenn@6229 156 <p>Conformance requirements phrased as algorithms or specific steps
glenn@6229 157 may be implemented in any manner, so long as the end result is
glenn@6229 158 equivalent. (In particular, the algorithms defined in this
glenn@6229 159 specification are intended to be easy to follow, and not intended to
glenn@6229 160 be performant.)
glenn@6229 161
glenn@6229 162 <p id="hardwareLimitations">User agents may impose
glenn@6229 163 implementation-specific limits on otherwise unconstrained inputs,
glenn@6229 164 e.g. to prevent denial of service attacks, to guard against running
glenn@6229 165 out of memory, or to work around platform-specific limitations.
glenn@6229 166
glenn@6229 167 <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@6229 168
glenn@6229 169 <p>Unless otherwise stated, string comparisons are done in a
glenn@6229 170 <span data-anolis-spec=dom>case-sensitive</span> manner.
glenn@6229 171
glenn@6229 172 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 173
glenn@6229 174 <h2 id="terminology">Terminology</h2>
glenn@6229 175
glenn@6794 176 <p>This specification employs certain terminology from the following documents:
glenn@6229 177 <cite>DOM4</cite>,
glenn@6229 178 <cite>HTML</cite>,
glenn@6229 179 <cite>Associating Style Sheets with XML documents</cite>
glenn@6229 180 and
glenn@6229 181 <cite>XML</cite>
glenn@6229 182 <span data-anolis-ref>DOM</span>
glenn@6229 183 <span data-anolis-ref>HTML</span>
glenn@6229 184 <span data-anolis-ref>XMLSS</span>
glenn@6794 185 <span data-anolis-ref>XML</span>.
glenn@6229 186
glenn@6229 187 <p>When this specification talks about object
glenn@6229 188 <code><var>A</var></code> where <code><var>A</var></code> is actually an interface, it generally means an object implementing interface
glenn@6229 189 <code><var>A</var></code>.</p>
glenn@6229 190
glenn@6794 191 <p>The term <dfn id="whitespace">whitespace</dfn> is used as defined in <span data-anolis-ref>CSS</span>.
glenn@6229 192
glenn@6229 193 <!-- ........................................................................................................................ -->
glenn@6229 194 <!-- ........................................................................................................................ -->
annevk@4900 195
annevk@4900 196 <h3>Common Serializing Idioms</h3>
annevk@4900 197
glenn@6524 198 <p>To <dfn>escape a character</dfn> means to create a string of
annevk@4900 199 "<code>\</code>" (U+005C), followed by the character.</p>
annevk@4900 200
glenn@6524 201 <p>To <dfn>escape a character as code point</dfn> means to create a
annevk@4900 202 string of "<code>\</code>" (U+005C), followed by the Unicode code point as
annevk@4900 203 the smallest possible number of hexadecimal digits in the range 0-9 a-f
annevk@4900 204 (U+0030 to U+0039 and U+0061 to U+0066) to represent the code point in
annevk@4900 205 base 16, followed by a space (U+0020).</p>
annevk@4900 206
annevk@4900 207 <p>To <dfn>serialize an identifier</dfn> means to create a string represented
annevk@4900 208 by the concatenation of, for each character of the identifier:</p>
annevk@4900 209
annevk@4900 210 <ul>
annevk@4912 211 <li>If the character is in the range U+0000 to U+001F or U+007F to
annevk@4912 212 U+009F, the character
glenn@6524 213 <span title="escape a character as code point">escaped as code point</span>.</li>
annevk@4900 214 <li>If the character is the first character and is in the range 0-9
annevk@4900 215 (U+0030 to U+0039), the character
glenn@6524 216 <span title="escape a character as code point">escaped as code point</span>.</li>
annevk@4900 217 <li>If the character is the second character and is in the range 0-9
annevk@4900 218 (U+0030 to U+0039) and the first character is a "<code>-</code>"
annevk@4900 219 (U+002D), the character
glenn@6524 220 <span title="escape a character as code point">escaped as code point</span>.</li>
annevk@4900 221 <li>If the character is the second character and is "<code>-</code>"
annevk@4900 222 (U+002D) and the first character is "<code>-</code>" too, the
glenn@6524 223 <span title="escape a character">escaped</span> character.</li>
annevk@4900 224 <li>If the character is not handled by one of the above rules and is
annevk@4900 225 greater than or equal to U+0080, is "<code>-</code>" (U+002D) or
annevk@4900 226 "<code>_</code>" (U+005F), or is in one of the ranges 0-9 (U+0030 to
annevk@4900 227 U+0039), A-Z (U+0041 to U+005A), or a-z (U+0061 to U+007A), the character
annevk@4900 228 itself.</li>
glenn@6524 229 <li>Otherwise, the <span title="escape a character">escaped</span>
annevk@4900 230 character.</li>
annevk@4900 231 </ul>
annevk@4900 232
annevk@4900 233 <p>To <dfn>serialize a string</dfn> means to create a string represented
annevk@4900 234 by '<code>"</code>' (U+0022), followed by the result of applying the rules
annevk@4900 235 below to each character of the given string, followed by
annevk@4900 236 '<code>"</code>' (U+0022):</p>
annevk@4900 237
annevk@4900 238 <ul>
annevk@4912 239 <li>If the character is in the range U+0000 to U+001F or U+007F to
annevk@4912 240 U+009F, the character
glenn@6524 241 <span title="escape a character as code point">escaped as code point</span>.</li>
annevk@4900 242 <li>If the character is '<code>"</code>' (U+0022) or '<code>\</code>'
glenn@6524 243 (U+005C), the <span title="escape a character">escaped</span> character.</li>
annevk@4900 244 <li>Otherwise, the character itself.</li>
annevk@4900 245 </ul>
annevk@4900 246
annevk@4900 247 <p class="note">"<code>'</code>" (U+0027) is not escaped because strings
annevk@4900 248 are always serialized with '<code>"</code>' (U+0022).</p>
annevk@4900 249
annevk@4900 250 <p>To <dfn>serialize a URL</dfn> means to create a string represented by
glenn@6229 251 "<code>url(</code>", followed by the
annevk@4900 252 <span title="serialize a string">string escaped</span> value of the given
annevk@4900 253 string, followed by "<code>)</code>".</p>
annevk@4900 254
annevk@4900 255 <p>To <dfn>serialize a comma-separated list</dfn> concatenate all items of
annevk@4900 256 the list in list order while separating them by "<code>,</code>" (U+002C),
annevk@4900 257 followed by a space (U+0020).</p>
annevk@4900 258
annevk@4900 259 <p>To <dfn>serialize a whitespace-separated list</dfn> concatenate all
annevk@4900 260 items of the list in list order while separating them a space (U+0020).</p>
annevk@4900 261
glenn@6229 262 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 263
annevk@4900 264 <h2>Media Queries</h2>
annevk@4900 265
annevk@4900 266 <p>Media queries are defined by the Media Queries specification. This
annevk@4900 267 section defines various concepts around media queries, including their API
annevk@4900 268 and serialization form.</p>
annevk@4900 269
annevk@4900 270 <!-- XXX ref -->
annevk@4900 271
glenn@6229 272 <!-- ........................................................................................................................ -->
glenn@6229 273 <!-- ........................................................................................................................ -->
glenn@6229 274
annevk@4900 275 <h3>Parsing Media Queries</h3>
annevk@4900 276
annevk@4900 277 <p>To
annevk@4900 278 <dfn id="parse-a-media-query-list">parse a media query list</dfn> for a
glenn@6229 279 given string <var>s</var> into a media query list is defined in
annevk@4900 280 the Media Queries specification. Return the list of one or more media
annevk@4900 281 queries that the algorithm defined there gives.</p> <!-- XXX ref -->
annevk@4900 282
annevk@4900 283 <p class="note">A media query that ends up being "ignored" will turn
glenn@6229 284 into "<code>not all</code>".</p>
annevk@4900 285
annevk@4900 286 <p>To
annevk@4900 287 <dfn id="parse-a-media-query">parse a media query</dfn> for a given string
glenn@6229 288 <var>s</var> means to follow the
annevk@4900 289 <span>parse a media query list</span> steps and return null if more
annevk@4900 290 than one media query is returned or a media query if a
annevk@4900 291 single media query is returned.</p>
annevk@4900 292
annevk@4900 293 <p class="note">Again, a media query that ends up being "ignored" will
glenn@6229 294 turn into "<code>not all</code>".</p>
glenn@6229 295
glenn@6229 296 <!-- ........................................................................................................................ -->
annevk@4900 297
annevk@4900 298 <h3>Serializing Media Queries</h3>
annevk@4900 299
annevk@4900 300 <p>To
annevk@4900 301 <dfn id="serialize-a-media-query-list">serialize a media query list</dfn>
annevk@4900 302 run these steps:</p>
annevk@4900 303
annevk@4900 304 <ol>
annevk@4900 305 <li><p>If the media query list is empty return the empty string and
annevk@4900 306 terminate these steps.</p></li>
annevk@4900 307
annevk@4900 308 <li><p><span title="serialize a media query">Serialize</span> each
annevk@4900 309 media query in the list of media queries, sort them in lexicographical
annevk@4900 310 order, and then
annevk@4900 311 <span title="serialize a comma-separated list">serialize</span> the
annevk@4900 312 list.</p></li>
annevk@4900 313 </ol>
annevk@4900 314
annevk@4900 315 <p>To
annevk@4900 316 <dfn id="serialize-a-media-query">serialize a media query</dfn> let
glenn@6229 317 <var>s</var> be the empty string, run the steps below, and
glenn@6229 318 finally return <var>s</var>:</p>
annevk@4900 319
annevk@4900 320 <ol>
annevk@4900 321 <li><p>If the media query is negated append "<code>not</code>", followed
glenn@6229 322 by a space (U+0020), to <var>s</var>.</p></li>
glenn@6229 323
glenn@6229 324 <li><p>Let <var>type</var> be the media type of the media query,
annevk@4900 325 <span title="serialize an identifier">escaped</span> and
annevk@4914 326 <span data-anolis-spec=dom>converted to ASCII lowercase</span>.</p></li>
annevk@4900 327
annevk@4900 328 <li><p>If the media query does not contain media features append
glenn@6229 329 <var>type</var>, to <var>s</var>,
glenn@6229 330 then return <var>s</var> and terminate this algorithm.</p></li>
glenn@6229 331
glenn@6229 332 <li><p>If <var>type</var> is not "<code>all</code>" or if the
glenn@6229 333 media query is negated append <var>type</var>, followed by a
annevk@4900 334 space (U+0020), followed by "<code>and</code>", followed by a space
glenn@6229 335 (U+0020), to <var>s</var>.</p></li>
annevk@4900 336
annevk@4900 337 <li><p>Sort the media features in lexicographical order.</p></li>
annevk@4900 338
annevk@4900 339 <li>
annevk@4900 340 <p>Then, for each media feature:</p>
annevk@4900 341
annevk@4900 342 <ol>
annevk@4900 343 <li>Append a "<code>(</code>" (U+0028), followed by the media feature
annevk@4914 344 name, <span data-anolis-spec=dom>converted to ASCII lowercase</span>,
glenn@6229 345 to <var>s</var>.</p></li>
annevk@4900 346
annevk@4900 347 <li><p>If a value is given append a "<code>:</code>" (U+003A), followed
annevk@4900 348 by a space (U+0020), followed by the
annevk@4900 349 <span title="serialize a media feature value">serialized media feature value</span>,
glenn@6229 350 to <var>s</var>.</p></li>
annevk@4900 351
annevk@4900 352 <li><p>Append a "<code>)</code>" (U+0029) to
glenn@6229 353 <var>s</var>.</p></li>
annevk@4900 354
annevk@4900 355 <li><p>If this is not the last media feature append a space (U+0020),
annevk@4900 356 followed by "<code>and</code>", followed by a space (U+0020), to
glenn@6229 357 <var>s</var>.</p></li>
annevk@4900 358 </ol>
annevk@4900 359 </li>
annevk@4900 360 </ol>
annevk@4900 361
annevk@4900 362 <div class="example">
annevk@4900 363 <p>Here are some examples of input (first column) and output (second
annevk@4900 364 column):</p>
annevk@4900 365
annevk@4900 366 <table>
annevk@4900 367 <thead>
annevk@4900 368 <tr><th>Input<th>Output
annevk@4900 369 <tbody>
annevk@4900 370 <tr>
annevk@4900 371 <td><code>not screen and (min-WIDTH:5px) AND (max-width:40px )</code>
annevk@4900 372 <td><code>not screen and (max-width: 40px) and (min-width: 5px)</code>
annevk@4900 373 <tr>
annevk@4900 374 <td><code>all and (color) and (color)</code>
annevk@4900 375 <td><code>(color)</code>
annevk@4900 376 </table>
annevk@4900 377 </div>
annevk@4900 378
annevk@4900 379
glenn@6229 380 <!-- ........................................................................................................................ -->
glenn@6229 381
annevk@4900 382 <h4>Serializing Media Feature Values</h4>
annevk@4900 383
glenn@6344 384 <p class="issue">This should probably be done in terms of mapping it to
annevk@4900 385 serializing CSS values as media features are defined in terms of CSS
annevk@4900 386 values after all.</p>
annevk@4900 387
annevk@4900 388 <p>To <dfn id="serialize-a-media-feature-value">serialize a media feature value</dfn>
glenn@6229 389 named <var>v</var> locate <var>v</var> in the first
annevk@4900 390 column of the table below and use the serialization format described in
annevk@4900 391 the second column:</p>
annevk@4900 392
annevk@4900 393 <table>
annevk@4900 394 <tr>
annevk@4900 395 <th>Media Feature
annevk@4900 396 <th>Serialization
annevk@4900 397 <tr>
glenn@6229 398 <td><code>width</code>
annevk@4900 399 <td>...
annevk@4900 400 <tr>
glenn@6229 401 <td><code>height</code>
annevk@4900 402 <td>...
annevk@4900 403 <tr>
glenn@6229 404 <td><code>device-width</code>
annevk@4900 405 <td>...
annevk@4900 406 <tr>
glenn@6229 407 <td><code>device-height</code>
annevk@4900 408 <td>...
annevk@4900 409 <tr>
glenn@6229 410 <td><code>orientation</code>
annevk@4900 411 <td>
glenn@6229 412 <p>If the value is `<code>portrait</code>`: "<code>portrait</code>".</p>
glenn@6229 413 <p>If the value is `<code>landscape</code>`: "<code>landscape</code>".</p>
annevk@4900 414 <tr>
glenn@6229 415 <td><code>aspect-ratio</code>
annevk@4900 416 <td>...
annevk@4900 417 <tr>
glenn@6229 418 <td><code>device-aspect-ratio</code>
annevk@4900 419 <td>...
annevk@4900 420 <tr>
glenn@6229 421 <td><code>color</code>
annevk@4900 422 <td>...
annevk@4900 423 <tr>
glenn@6229 424 <td><code>color-index</code>
annevk@4900 425 <td>...
annevk@4900 426 <tr>
glenn@6229 427 <td><code>monochrome</code>
annevk@4900 428 <td>...
annevk@4900 429 <tr>
glenn@6229 430 <td><code>resolution</code>
annevk@4900 431 <td>...
annevk@4900 432 <tr>
glenn@6229 433 <td><code>scan</code>
annevk@4900 434 <td>
glenn@6229 435 <p>If the value is `<code>progressive</code>`: "<code>progressive</code>".</p>
glenn@6229 436 <p>If the value is `<code>interlace</code>`: "<code>interlace</code>".</p>
annevk@4900 437 <tr>
glenn@6229 438 <td><code>grid</code>
annevk@4900 439 <td>...
annevk@4900 440 </table>
annevk@4900 441
annevk@4900 442 <p>Other specifications can extend this table and vendor-prefixed media
annevk@4900 443 features can have custom serialization formats as well.</p>
annevk@4900 444
glenn@6229 445 <!-- ........................................................................................................................ -->
glenn@6229 446 <!-- ........................................................................................................................ -->
annevk@4900 447
annevk@4900 448 <h3>Comparing Media Queries</h3>
annevk@4900 449
annevk@4900 450 <p>To
annevk@4900 451 <dfn id="compare-media-queries">compare media queries</dfn>
glenn@6229 452 <var>m1</var> and <var>m2</var> means to
annevk@4900 453 <span title="serialize a media query">serialize</span> them both and
annevk@4900 454 return true if they are a
annevk@4914 455 <span data-anolis-spec=dom>case-sensitive</span> match and false if they
annevk@4900 456 are not.</p>
annevk@4900 457
glenn@6229 458 <!-- ........................................................................................................................ -->
glenn@6229 459 <!-- ........................................................................................................................ -->
glenn@6229 460
glenn@6229 461 <h3>The <code>MediaList</code> Interface</h3>
glenn@6229 462
glenn@6229 463 <!--{@idl(MediaList)}-->
glenn@6229 464
glenn@6229 465 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 466
annevk@4900 467 <h2>Selectors</h2>
annevk@4900 468
annevk@4900 469 <p>Selectors are defined in the Selectors specification. This section
annevk@4900 470 mainly defines how to serialize them.</p> <!-- XXX ref -->
annevk@4900 471
annevk@4900 472 <!-- XXX ref universal selector etc? some are in <span> some not -->
annevk@4900 473
glenn@6229 474 <!-- ........................................................................................................................ -->
glenn@6229 475 <!-- ........................................................................................................................ -->
glenn@6229 476
annevk@4900 477 <h3>Parsing Selectors</h3>
annevk@4900 478
annevk@4900 479 <p>To
annevk@4900 480 <dfn id="parse-a-group-of-selectors">parse a group of selectors</dfn>
glenn@6229 481 means to parse the value using the <code>selectors_group</code>
annevk@4900 482 production defined in the Selectors specification and return either a
annevk@4900 483 group of selectors if parsing did not fail or null if parsing did
annevk@4900 484 fail.</p> <!-- XXX ref -->
annevk@4900 485
glenn@6229 486 <!-- ........................................................................................................................ -->
glenn@6229 487 <!-- ........................................................................................................................ -->
annevk@4900 488
annevk@4900 489 <h3>Serializing Selectors</h3>
annevk@4900 490 <!-- http://dump.testsuite.org/2009/cssom/serializing-selectors.htm -->
annevk@4900 491
annevk@4900 492 <p>To
annevk@4900 493 <dfn id="serialize-a-group-of-selectors">serialize a group of selectors</dfn>
annevk@4900 494 <span title="serialize a selector">serialize</span> each selector in the
annevk@4900 495 group of selectors and then
annevk@4900 496 <span title="serialize a comma-separated list">serialize</span> the
annevk@4900 497 group.</p>
annevk@4900 498
annevk@4900 499 <p>To <dfn id="serialize-a-selector">serialize a selector</dfn> let
glenn@6229 500 <var>s</var> be the empty string, run the steps below for each
annevk@4900 501 part of the chain of the selector, and finally return
glenn@6229 502 <var>s</var>:</p>
annevk@4900 503
annevk@4900 504 <ol>
annevk@4900 505 <li><p>If there is only one <span>simple selector</span> in the
annevk@4900 506 <span>sequence of simple selectors</span> which is a
annevk@4900 507 <span>universal selector</span>, append the result of
annevk@4900 508 <span title="serialize a simple selector">serializing</span> the
glenn@6229 509 <span>universal selector</span> to <var>s</var>.</p></li>
annevk@4900 510
annevk@4900 511 <li><p>Otherwise, for each <span>simple selector</span> in the
annevk@4900 512 <span>sequence of simple selectors</span> that is not a
annevk@4900 513 universal selector of which the <span>namespace prefix</span> maps to
annevk@4900 514 the null namespace (not in a namespace) or of which the
annevk@4900 515 <span>namespace prefix</span> maps to a namespace that is not the
annevk@4900 516 <span>default namespace</span>
annevk@4900 517 <span title="serialize a simple selector">serialize</span> the
annevk@4900 518 <span>simple selector</span> and append the result to
glenn@6229 519 <var>s</var>.</p></li>
annevk@4900 520
annevk@4900 521 <li><p>If this is not the last part of the chain of the selector append a
annevk@4900 522 space (U+0020), followed by the combinator
annevk@4900 523 "<code>></code>",
annevk@4900 524 "<code>+</code>", or
annevk@4900 525 "<code>~</code>"
annevk@4900 526 as appropriate, followed by another space (U+0020) if the combinator was
glenn@6229 527 not whitespace, to <var>s</var>.</p></li>
annevk@4900 528
annevk@4900 529 <li><p>If this is the last part of the chain of the selector and there is
annevk@4900 530 a pseudo-element, append "<code>::</code>" followed by the name of the
glenn@6229 531 pseudo-class, to <var>s</var>.</p></li>
annevk@4900 532 </ol>
annevk@4900 533
annevk@4900 534
annevk@4900 535 <p>To
annevk@4900 536 <dfn id="serialize-a-simple-selector">serialize a simple selector</dfn>
glenn@6229 537 let <var>s</var> be the empty string, run the steps below, and
glenn@6229 538 finally return <var>s</var>:</p>
annevk@4900 539
annevk@4900 540 <dl class="switch">
annevk@4900 541 <dt>type selector</dt>
annevk@4900 542 <dt>universal selector</dt>
annevk@4900 543 <dd>
annevk@4900 544 <ol>
annevk@4900 545 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
annevk@4900 546 not the <span>default namespace</span> and is not the
annevk@4900 547 null namespace (not in a namespace) append the
annevk@4900 548 <span title="serialize an identifier">escaped</span>
annevk@4900 549 <span>namespace prefix</span>, followed by a "<code>|</code>" (U+007C)
glenn@6229 550 to <var>s</var>.</p></li>
annevk@4900 551
annevk@4900 552 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
annevk@4900 553 the null namespace (not in a namespace) append
glenn@6229 554 "<code>|</code>" (U+007C) to <var>s</var>.</p></li>
annevk@4900 555 <!-- This includes |* -->
annevk@4900 556
annevk@4900 557 <li><p>If this is a type selector append the
annevk@4900 558 <span title="serialize an identifier">escaped</span> element name to
glenn@6229 559 <var>s</var>.</p></li>
annevk@4900 560
glenn@4922 561 <li><p>If this is a universal selector append "<code>*</code>" (U+002A)
glenn@6229 562 to <var>s</var>.</p></li>
annevk@4900 563 </ol>
annevk@4900 564 </dd>
annevk@4900 565
annevk@4900 566 <dt>attribute selector</dt>
annevk@4900 567 <dd>
annevk@4900 568 <ol>
annevk@4900 569 <li><p>Append "<code>[</code>" (U+005B) to
glenn@6229 570 <var>s</var>.</p></li>
annevk@4900 571
annevk@4900 572 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
annevk@4900 573 not the null namespace (not in a namespace) append the
annevk@4900 574 <span title="serialize an identifier">escaped</span>
annevk@4900 575 <span>namespace prefix</span>, followed by a "<code>|</code>" (U+007C)
glenn@6229 576 to <var>s</var>.</p></li>
annevk@4900 577
annevk@4900 578 <li><p>If the <span>namespace prefix</span> maps to a namespace that is
annevk@4900 579 the null namespace (not in a namespace) append
glenn@6229 580 "<code>|</code>" (U+007C) to <var>s</var>.</p></li>
annevk@4900 581 <!-- This includes |* -->
annevk@4900 582
annevk@4900 583 <li><p>Append the <span title="serialize an identifier">escaped</span>
glenn@6229 584 attribute name to <var>s</var>.</p></li>
annevk@4900 585
annevk@4900 586 <li><p>If there is an attribute value specified, append
annevk@4900 587 "<code>=</code>",
annevk@4900 588 "<code>~=</code>",
annevk@4900 589 "<code>|=</code>",
annevk@4900 590 "<code>^=</code>",
annevk@4900 591 "<code>$=</code>", or
annevk@4900 592 "<code>*=</code>"
annevk@4900 593 as appropriate (depending on the type of attribute selector), followed
annevk@4900 594 by the <span title="serialize a string">string escaped</span>
glenn@6229 595 attribute value, to <var>s</var>.</p></li>
annevk@4900 596
annevk@4900 597 <li><p>Append "<code>]</code>" (U+005D) to
glenn@6229 598 <var>s</vaR>.</p></li>
annevk@4900 599 </ol>
annevk@4900 600 </dd>
annevk@4900 601
annevk@4900 602 <dt>class selector</dt>
annevk@4900 603 <dd><p>Append a "<code>.</code>" (U+002E), followed by the
annevk@4900 604 <span title="serialize an identifier">escaped</span> class name to
glenn@6229 605 <var>s</var>.</p></dd>
annevk@4900 606
annevk@4900 607 <dt>ID selector</dt>
annevk@4900 608 <dd><p>Append a "<code>#</code>" (U+0023), followed by the
annevk@4900 609 <span title="serialize an identifier">escaped</span> ID to
glenn@6229 610 <var>s</var>.</p></dd>
annevk@4900 611
annevk@4900 612 <dt>pseudo-class</dt>
annevk@4900 613 <dd>
annevk@4900 614 <p>If the pseudo-class does not accept arguments append
annevk@4900 615 "<code>:</code>" (U+003A), followed by the name of the pseudo-class, to
glenn@6229 616 <var>s</var>.</p>
annevk@4900 617
annevk@4900 618 <p>Otherwise, append "<code>:</code>" (U+003A), followed by the name of
annevk@4900 619 the pseudo-class, followed by "<code>(</code>" (U+0028), followed by the
annevk@4900 620 value of the pseudo-class argument determined as per below, followed by
glenn@6229 621 "<code>)</code>" (U+0029), to <var>s</var>.</p>
annevk@4900 622
annevk@4900 623 <dl class="switch">
glenn@6229 624 <dt><code>:lang()</code></dt>
annevk@4900 625 <dd><p>The <span title="serialize an identifier">escaped</span>
annevk@4900 626 value.</p></dd>
annevk@4900 627
glenn@6229 628 <dt><code>:nth-child()</code></dt>
glenn@6229 629 <dt><code>:nth-last-child()</code></dt>
glenn@6229 630 <dt><code>:nth-of-type()</code></dt>
glenn@6229 631 <dt><code>:nth-last-of-type()</code></dt>
annevk@4900 632 <dd>
annevk@4900 633 <ol>
annevk@4900 634 <li><p>If the value is odd let the value be
glenn@6229 635 "<code>2n+1</code>".</p></li>
annevk@4900 636
annevk@4900 637 <li><p>If the value is even let the value be
glenn@6229 638 "<code>2n</code>".</p></li>
glenn@6229 639
glenn@6229 640 <li><p>If <var>a</var> is zero let the value be
glenn@6229 641 <var>b</var>
annevk@4900 642 <span title="serialize a CSS component value">serialized</span> as &lt;integer>.</p></li>
annevk@4900 643
glenn@6229 644 <li><p>If <var>a</var> is one or minus one and
glenn@6229 645 <var>b</var> is zero let the value be
glenn@6229 646 "<code>n</code>" (U+006E).</p></li>
glenn@6229 647
glenn@6229 648 <li><p>If <var>a</var> is one or minus one let the value be
glenn@6229 649 "<code>n</code>" (U+006E), followed by
glenn@6229 650 "<code>+</code>" (U+002B) if <var>b</var> is positive,
glenn@6229 651 followed by <var>b</var>
annevk@4900 652 <span title="serialize a CSS component value">serialized</span> as &lt;integer>.</p></li>
annevk@4900 653
glenn@6229 654 <li><p>If <var>b</var> is zero let the value be
glenn@6229 655 <var>a</var>
annevk@4900 656 <span title="serialize a CSS component value">serialized</span> as &lt;integer>,
glenn@6229 657 followed by "<code>n</code>" (U+006E).</p></li>
annevk@4900 658
annevk@4900 659 <li><p>Otherwise let the value be
glenn@6229 660 <var>a</var>
annevk@4900 661 <span title="serialize a CSS component value">serialized</span> as &lt;integer>,
glenn@6229 662 followed by "<code>n</code>" (U+006E), followed by
glenn@6229 663 "<code>+</code>" (U+002B) if <var>b</var> is positive,
glenn@6229 664 followed by <var>b</var>
annevk@4900 665 <span title="serialize a CSS component value">serialized</span> as &lt;integer>.</p></li>
annevk@4900 666 </ol>
annevk@4900 667 </dd>
annevk@4900 668
glenn@6229 669 <dt><code>:not()</code></dt>
annevk@4900 670 <dd><p>The result of serializing the value using the rules for
annevk@4900 671 <span title="serialize a group of selectors">serializing a group of selectors</span>.</p></dd>
annevk@4900 672 </dl>
annevk@4900 673 </dd>
annevk@4900 674 </dl>
annevk@4900 675
glenn@6229 676 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 677
annevk@4900 678 <h2>CSS</h2>
annevk@4900 679
glenn@6229 680 <!-- ........................................................................................................................ -->
glenn@6229 681 <!-- ........................................................................................................................ -->
glenn@6229 682
glenn@6794 683 <h3>CSS Style Sheets</h3>
annevk@4900 684
annevk@4900 685 <!-- XXX
annevk@4900 686 element inserted into the DOM, style sheet created, element removed from
annevk@4900 687 the DOM, what happens to StyleSheet?
annevk@4900 688 -->
annevk@4900 689
glenn@6794 690 <p>A <dfn id="css-style-sheet">CSS style sheet</dfn> is an abstract concept that
glenn@6794 691 represents a style sheet as defined by the CSS specification. In the CSSOM a
glenn@6794 692 <span>CSS style sheet</span> is represented as a <code>CSSStyleSheet</code> object. A
glenn@6794 693 <span>CSS style sheet</span> has a number of associated state items:</p>
annevk@4900 694
annevk@4900 695 <dl>
annevk@4900 696 <dt><dfn id="style-sheet-type">style sheet type</dfn></dt>
annevk@4900 697 <dd><p>The literal string "<code>text/css</code>".</p></dd>
annevk@4900 698
annevk@4900 699 <dt><dfn id="style-sheet-location">style sheet location</dfn></dt>
annevk@4900 700 <dd><p>The <span data-anolis-spec=html>URL</span> of the
annevk@4900 701 <span>style sheet</span> or null if the <span>style sheet</span> was
annevk@4900 702 embedded.</p></dd>
annevk@4900 703
annevk@4900 704 <dt><dfn id="style-sheet-parent">style sheet parent</dfn></dt>
annevk@4900 705 <dd><p>The <span>style sheet</span> that is the parent of the
annevk@4900 706 <span>style sheet</span>.</p></dd>
annevk@4900 707
annevk@4900 708 <dt><dfn id="style-sheet-owner-node">style sheet owner node</dfn></dt>
annevk@4900 709 <dd><p>The DOM node associated with the <span>style sheet</span> or
annevk@4900 710 null if there is no associated DOM node.</p></dd>
annevk@4900 711
annevk@4900 712 <dt><dfn id="style-sheet-owner-css-rule">style sheet owner CSS rule</dfn></dt>
annevk@4900 713 <dd><p>The <span>CSS rule</span> in the <span>style sheet parent</span>
annevk@4900 714 that caused the inclusion of the <span>style sheet</span> or null if
annevk@4900 715 there is no such <span>CSS rule</span>.</p></dd>
annevk@4900 716
annevk@4900 717 <dt><dfn id="style-sheet-media">style sheet media</dfn></dt>
annevk@4900 718 <dd>
annevk@4900 719 <p>The <code>MediaList</code> object associated with the
annevk@4900 720 <span>style sheet</span>.</p>
annevk@4900 721
annevk@4900 722 <p>If this property is set to a string run the
annevk@4900 723 <span>create a <code>MediaList</code> object</span> steps for that
annevk@4900 724 string and associate the returned object with the
annevk@4900 725 <span>style sheet</span>.</p>
annevk@4900 726 </dd>
annevk@4900 727
annevk@4900 728 <dt><dfn id="style-sheet-title">style sheet title</dfn></dt>
annevk@4900 729 <dd>
annevk@4900 730 <p>The title of the <span>style sheet</span>. It is said to be empty
annevk@4900 731 if the title is the empty string.</p>
annevk@4900 732
annevk@4900 733 <div class="example">
annevk@4900 734 <p>In these examples the <span>style sheet title</span> ends up being
annevk@4900 735 empty:</p>
annevk@4900 736
glenn@6229 737 <pre>&lt;style> body { background:papayawhip } &lt;/style></pre>
annevk@4900 738
annevk@4900 739 <pre>&lt;style> body { background:orange } &lt;/style></pre>
annevk@4900 740 </div>
annevk@4900 741 </dd>
annevk@4900 742
annevk@4900 743 <dt><dfn id="style-sheet-alternate-flag">style sheet alternate flag</dfn></dt>
annevk@4900 744 <dd>
annevk@4917 745 <p>Either set or unset. Unset by default.</p>
annevk@4900 746
annevk@4900 747 <div class="example">
annevk@4900 748 <p>The following <span title="style sheet">style sheets</span> have
annevk@4900 749 their <span>style sheet alternate flag</span> set:</p>
annevk@4900 750
annevk@4900 751 <pre><code>&lt;?xml-stylesheet alternate="yes" title="x" href="data:text/css,&hellip;"?></code></pre>
annevk@4900 752
annevk@4900 753 <pre><code>&lt;link rel="alternate stylesheet" title="x" href="data:text/css,&hellip;"></code></pre>
annevk@4900 754 </div>
annevk@4900 755 </dd>
annevk@4900 756
annevk@4900 757 <dt><dfn id="style-sheet-disabled-flag">style sheet disabled flag</dfn></dt>
annevk@4900 758 <dd>
annevk@4917 759 <p>Either set or unset. Unset by default.</p>
annevk@4917 760
annevk@4917 761 <p class="note">Even when unset it does not necessarily mean that the
annevk@4917 762 <span>style sheet</span> is actually used for rendering.</p>
annevk@4900 763 </dd>
annevk@4900 764
annevk@4900 765
annevk@4900 766 <dt><dfn id="style-sheet-css-rules">style sheet CSS rules</dfn></dt>
annevk@4900 767 <dd><p>The <span title="CSS rule">CSS rules</span> associated with the
annevk@4900 768 <span>style sheet</span>.</p></dd>
annevk@4900 769 </dl>
annevk@4900 770
annevk@4900 771 <p>When you are to <span>create a style sheet</span> the above properties,
annevk@4900 772 with the exception of <span>style sheet type</span> and
annevk@4900 773 <span>style sheet CSS rules</span>, are to be set to
annevk@4900 774 their proper values.</p>
annevk@4900 775
annevk@4900 776 <!-- same-origin restrictions -->
annevk@4900 777
glenn@6229 778 <!-- ........................................................................................................................ -->
glenn@6229 779
glenn@6229 780 <h4>The <code>StyleSheet</code> Interface</h4>
glenn@6229 781
glenn@6229 782 <!--{@idl(StyleSheet)}-->
glenn@6229 783
glenn@6229 784 <!-- ........................................................................................................................ -->
glenn@6229 785
glenn@6229 786 <h4>The <code>CSSStyleSheet</code> Interface</h4>
glenn@6229 787
glenn@6229 788 <!--{@idl(CSSStyleSheet)}-->
glenn@6229 789
glenn@6229 790 <!-- ........................................................................................................................ -->
glenn@6229 791 <!-- ........................................................................................................................ -->
annevk@4900 792
annevk@4900 793 <h3>Style Sheet Collections</h3>
annevk@4900 794
annevk@4900 795 <p>Below various new concepts are defined that are associated with each
annevk@4914 796 <code data-anolis-spec=dom>Document</code> object.</p>
annevk@4914 797
annevk@4914 798 <p>Each <code data-anolis-spec=dom>Document</code> has an associated list of zero or more
annevk@4900 799 <span title="style sheet">style sheets</span>, named the
annevk@4900 800 <dfn id="document-style-sheets">document style sheets</dfn>. This is
annevk@4900 801 an ordered list that contains all
annevk@4900 802 <span title="style sheet">style sheets</span> associated with the
annevk@4914 803 <code data-anolis-spec=dom>Document</code>, in
annevk@4914 804 <span data-anolis-spec=dom title=concept-tree-order>tree order</span>, with
annevk@4900 805 <span title="style sheet">style sheets</span> created from HTTP
annevk@4900 806 <code title="http-link">Link</code> headers first, if any, in header
annevk@4900 807 order.</p>
annevk@4900 808
annevk@4900 809 <p>To <dfn id="create-a-style-sheet">create a style sheet</dfn>, run these
annevk@4900 810 steps:</p>
annevk@4900 811
annevk@4900 812 <ol>
annevk@4900 813 <li><p>Create a new <span>style sheet</span> object and set its
annevk@4900 814 properties as specified.</p></li>
annevk@4900 815
annevk@4900 816 <li><p>Then run the <span>add a style sheet</span> steps for the newly
annevk@4900 817 created <span>style sheet</span>.</p></li>
annevk@4900 818 </ol>
annevk@4900 819
annevk@4900 820 <p>To <dfn id="add-a-style-sheet">add a style sheet</dfn>, run these
annevk@4900 821 steps:</p>
annevk@4900 822
annevk@4900 823 <ol>
annevk@4900 824 <li><p>Add the <span>style sheet</span> to the list of
annevk@4900 825 <span>document style sheets</span> at the appropriate location. The
annevk@4900 826 remainder of these steps deal with the
annevk@4900 827 <span>style sheet disabled flag</span>.</p></li>
annevk@4900 828
annevk@4917 829 <li><p>If the <span>style sheet disabled flag</span> is set, terminate
annevk@4900 830 these steps.</p></li>
annevk@4900 831
annevk@4900 832 <li><p>If the <span>style sheet title</span> is non-empty, the
annevk@4917 833 <span>style sheet alternate flag</span> is unset, and
annevk@4900 834 <span>preferred style sheet set name</span> is the empty string
annevk@4900 835 <span>change the preferred style sheet set name</span> to the
annevk@4900 836 <span>style sheet title</span>.</p></li>
annevk@4900 837
annevk@4900 838 <li>
annevk@4917 839 <p>If any of the following is true unset the
annevk@4917 840 <span>style sheet disabled flag</span> and terminate these steps:
annevk@4900 841
annevk@4900 842 <ul>
annevk@4900 843 <li><p>The <span>style sheet title</span> is empty.</p></li>
annevk@4900 844 <li><p>The <span>last style sheet set name</span> is null and the
annevk@4900 845 <span>style sheet title</span> is a
annevk@4914 846 <span data-anolis-spec=dom>case-sensitive</span> match
annevk@4900 847 for the <span>preferred style sheet set name</span>.</p></li>
annevk@4900 848 <li><p>The <span>style sheet title</span> is a
annevk@4914 849 <span data-anolis-spec=dom>case-sensitive</span> match for the
annevk@4900 850 <span>last style sheet set name</span>.</p></li>
annevk@4900 851 </ul>
annevk@4900 852 </li>
annevk@4900 853
glenn@6229 854 <li><p>Set the <span>style sheet disabled flag</span>.</li>
annevk@4900 855 </ol>
annevk@4900 856
annevk@4900 857 <p>A <dfn id="persistent-style-sheet">persistent style sheet</dfn> is a
annevk@4900 858 <span>style sheet</span> from the <span>document style sheets</span>
annevk@4900 859 whose <span>style sheet title</span> is the empty string and whose
annevk@4917 860 <span>style sheet alternate flag</span> is unset.</p>
annevk@4900 861
annevk@4900 862 <p>A <dfn id="style-sheet-set">style sheet set</dfn> is an ordered
annevk@4900 863 collection of one or more <span title="style sheet">style sheets</span>
annevk@4900 864 from the <span>document style sheets</span> which have an identical
annevk@4900 865 <span>style sheet title</span> that is not the empty string.</p>
annevk@4900 866
annevk@4900 867 <p>A <dfn id="style-sheet-set-name">style sheet set name</dfn> is the
annevk@4900 868 <span>style sheet title</span> the <span>style sheet set</span> has in
annevk@4900 869 common.</p>
annevk@4900 870
annevk@4900 871 <p>An <dfn id="enabled-style-sheet-set">enabled style sheet set</dfn> is a
annevk@4900 872 <span>style sheet set</span> of which each <span>style sheet</span> has
annevk@4917 873 its <span>style sheet disabled flag</span> unset.</p>
annevk@4900 874
annevk@4900 875 <p>To <dfn id="enable-a-style-sheet-set">enable a style sheet set</dfn>
glenn@6229 876 with name <var>name</var>, run these steps:</p>
annevk@4900 877
annevk@4900 878 <ol>
glenn@6229 879 <li><p>If <var>name</var> is the empty string, set the
annevk@4900 880 <span>style sheet disabled flag</span> for each <span>style sheet</span>
glenn@6229 881 that is in a <span>style sheet set</span> and terminate these steps.</li>
annevk@4917 882
annevk@4917 883 <li><p>Unset the <span>style sheet disabled flag</span> for each
annevk@4900 884 <span>style sheet</span> in a <span>style sheet set</span> whose
annevk@4900 885 <span>style sheet set name</span> is a
annevk@4914 886 <span data-anolis-spec=dom>case-sensitive</span> match for
glenn@6229 887 <var>name</var> and set it for all other
annevk@4900 888 <span title="style sheet">style sheets</span> in a
annevk@4900 889 <span>style sheet set</span>.</p></li>
annevk@4900 890 </ol>
annevk@4900 891
annevk@4900 892 <p>To <dfn id="select-a-style-sheet-set">select a style sheet set</dfn>
glenn@6229 893 with name <var>name</var>, run these steps:</p>
annevk@4900 894
annevk@4900 895 <ol>
annevk@4900 896 <li><p><span>Enable a style sheet set</span> with name
glenn@6229 897 <var>name</var>.</p></li>
annevk@4900 898
annevk@4900 899 <li><p>Set <span>last style sheet set name</span> to
glenn@6229 900 <var>name</var>.</p></li>
annevk@4900 901 </ol>
annevk@4900 902
annevk@4900 903 <p>A <dfn id="last-style-sheet-set-name">last style sheet set name</dfn>
annevk@4900 904 is a concept to determine what <span>style sheet set</span> was last
annevk@4900 905 <span title="select a style sheet set">selected</span>. Initially its
annevk@4900 906 value is null.</p>
annevk@4900 907
annevk@4900 908 <p>A
annevk@4900 909 <dfn id="preferred-style-sheet-set-name">preferred style sheet set name</dfn>
annevk@4900 910 is a concept to determine which
glenn@6229 911 <span title="style sheet">style sheets</span> need to have their
annevk@4917 912 <span>style sheet disabled flag</span> unset. Initially its value
annevk@4900 913 is the empty string.
annevk@4900 914
annevk@4900 915 <p>To
annevk@4900 916 <dfn id="change-the-preferred-style-sheet-set-name">change the preferred style sheet set name</dfn>
glenn@6229 917 with name <var>name</var>, run these steps:</p>
annevk@4900 918
annevk@4900 919 <ol>
glenn@6427 920 <li><p>Let <var>current</var> be the <span>preferred style sheet set name</span>.</p></li>
annevk@4900 921
annevk@4900 922 <li><p>Set <span>preferred style sheet set name</span> to
glenn@6229 923 <var>name</var>.</p></li>
glenn@6229 924
glenn@6229 925 <li><p>If <var>name</var> is not a
annevk@4914 926 <span data-anolis-spec=dom>case-sensitive</span> match for
glenn@6229 927 <var>current</var> and
annevk@4900 928 <span>last style sheet set name</span> is null
annevk@4900 929 <span>enable a style sheet set</span> with name
glenn@6427 930 <var>name</var>.</p></li>
annevk@4900 931 </ol>
annevk@4900 932
annevk@4900 933 <!-- XXX ought to define "applied"
annevk@4900 934
annevk@4900 935 thoughts:
annevk@4900 936 depends on disabled flag, alternate flag, media queries, sheesh
annevk@4900 937 -->
annevk@4900 938
glenn@6229 939 <!-- ........................................................................................................................ -->
glenn@6229 940
glenn@6229 941 <h4>The HTTP <code>Default-Style</code> Header</h4>
annevk@4900 942
annevk@4900 943 <p>The HTTP <code title="http-default-style">Default-Style</code> header
annevk@4900 944 can be used to set the <span>preferred style sheet set name</span>
annevk@4900 945 influencing which <span>style sheet set</span> is (initially) the
annevk@4900 946 <span>enabled style sheet set</span>.</p>
annevk@4900 947
annevk@4900 948 <p>For each HTTP <code title="http-default-style">Default-Style</code>
annevk@4900 949 header, in header order, the user agent must
annevk@4900 950 <span>change the preferred style sheet set name</span> with name being the
annevk@4900 951 value of the header.</p>
annevk@4900 952
glenn@6229 953 <!-- ........................................................................................................................ -->
glenn@6229 954
glenn@6229 955 <h4>The <code>StyleSheetList</code> Sequence</h4>
glenn@6229 956
glenn@6229 957 <!--{@idl(StyleSheetList)}-->
glenn@6229 958
glenn@6229 959 <!-- ........................................................................................................................ -->
glenn@6229 960
glenn@6229 961 <h4>Extensions to the <code>Document</code> Interface</h4>
glenn@6229 962
glenn@6229 963 <!--{@idl(Document)}-->
glenn@6229 964
glenn@6229 965 <!-- ........................................................................................................................ -->
annevk@4900 966
annevk@4900 967 <h4>Interaction with the User Interface</h4>
annevk@4900 968
annevk@4900 969 <p>The user interface of Web browsers that support style sheets
annevk@4900 970 should list the style sheet titles given in the
annevk@4900 971 <code title="dom-Document-styleSheetSets">styleSheetSets</code> list,
annevk@4900 972 showing the
annevk@4900 973 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
annevk@4900 974 as the selected style sheet set, leaving none selected if it is
annevk@4900 975 null or the empty string, and selecting an extra option
annevk@4900 976 "Basic Page Style" (or similar) if it is the empty string and the
annevk@4900 977 <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code>
annevk@4900 978 is the empty string as well.</p>
annevk@4900 979
annevk@4900 980 <p>Selecting a style sheet from this list should
annevk@4900 981 use the <span>select a style sheet set</span> set of steps. This
annevk@4900 982 (by definition) affects the
annevk@4900 983 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>
annevk@4900 984 attribute.</p>
annevk@4900 985
annevk@4900 986 <h5>Persisting the selected style sheet set</h5>
annevk@4900 987
annevk@4900 988 <p>If a user agent persist the selected style sheet set, they should use
annevk@4900 989 the value of the
annevk@4900 990 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
annevk@4900 991 attribute, or if that is null, the
annevk@4900 992 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>
annevk@4900 993 attribute, when leaving the page (or at some other time) to determine the
annevk@4900 994 set name to store. If that is null then the style sheet set should not be
annevk@4900 995 persisted.</p>
annevk@4900 996
annevk@4900 997 <p>When re-setting the style sheet set to the persisted value (which can
annevk@4900 998 happen at any time, typically at the first time the style sheets are
annevk@4900 999 needed for styling the document, after the <code>&lt;head&gt;</code> of
annevk@4900 1000 the document has been parsed, after any scripts that are not dependent on
annevk@4900 1001 computed style have executed), the style sheet set
annevk@4900 1002 should be set by using the
annevk@4900 1003 <span>select a style sheet set</span> set of steps as if the user had
annevk@4900 1004 selected the set manually.</p>
annevk@4900 1005
annevk@4900 1006 <p class="note">This specification does not give any suggestions on
annevk@4900 1007 how user agents should decide to persist the style sheet set or whether or
annevk@4900 1008 how to persist the selected set across pages.</p>
annevk@4900 1009
annevk@4900 1010 <!-- XXX this UI section suggests we may want to introduce a few more
annevk@4900 1011 idioms -->
annevk@4900 1012
glenn@6229 1013 <!-- ........................................................................................................................ -->
glenn@6229 1014
annevk@4900 1015 <h4>Examples</h4>
annevk@4900 1016
annevk@4900 1017 <div class="example">
annevk@4900 1018 <p>Thus, in the following HTML snippet:</p>
annevk@4900 1019
glenn@6346 1020 <pre>&lt;link rel="alternate stylesheet" title="foo" href="a"&gt;
annevk@4900 1021 &lt;link rel="alternate stylesheet" title="bar" href="b"&gt;
annevk@4900 1022 &lt;script&gt;
annevk@4900 1023 document.selectedStyleSheetSet = 'foo';
annevk@4900 1024 document.styleSheets[1].disabled = false;
annevk@4900 1025 &lt;/script&gt;
annevk@4900 1026 &lt;link rel="alternate stylesheet" title="foo" href="c"&gt;
annevk@4900 1027 &lt;link rel="alternate stylesheet" title="bar" href="d"&gt;</pre>
annevk@4900 1028
annevk@4900 1029 <p>...the style sheets that end up enabled are style sheets "a", "b",
annevk@4900 1030 and "c", the
annevk@4900 1031 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
annevk@4900 1032 attribute would return null,
annevk@4900 1033 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code>
annevk@4900 1034 would return "foo", and
annevk@4900 1035 <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code>
annevk@4900 1036 would return the empty string.</p>
annevk@4900 1037
annevk@4900 1038 <p>Similarly, in the following HTML snippet:</p>
annevk@4900 1039
glenn@6346 1040 <pre>&lt;link rel="alternate stylesheet" title="foo" href="a"&gt;
annevk@4900 1041 &lt;link rel="alternate stylesheet" title="bar" href="b"&gt;
annevk@4900 1042 &lt;script&gt;
annevk@4900 1043 var before = document.preferredStyleSheetSet;
annevk@4900 1044 document.styleSheets[1].disabled = false;
annevk@4900 1045 &lt;/script&gt;
annevk@4900 1046 &lt;link rel="stylesheet" title="foo" href="c"&gt;
annevk@4900 1047 &lt;link rel="alternate stylesheet" title="bar" href="d"&gt;
annevk@4900 1048 &lt;script&gt;
annevk@4900 1049 var after = document.preferredStyleSheetSet;
annevk@4900 1050 &lt;/script&gt;</pre>
annevk@4900 1051
annevk@4900 1052 <p>...the "before" variable will be equal to the empty string, the
annevk@4900 1053 "after" variable will be equal to "foo", and style sheets "a" and "c"
annevk@4900 1054 will be enabled. This is the case even though the first script block
annevk@4900 1055 sets style sheet "b" to be enabled, because upon parsing the
annevk@4900 1056 following <code>&lt;link&gt;</code> element, the
annevk@4900 1057 <code title="dom-Document-preferredStyleSheetSet">preferredStyleSheetSet</code>
annevk@4900 1058 is set and the
annevk@4900 1059 <code title="dom-Document-enableStyleSheetsForSet">enableStyleSheetsForSet()</code>
annevk@4900 1060 method is called (since
annevk@4900 1061 <code title="dom-Document-selectedStyleSheetSet">selectedStyleSheetSet</code>
annevk@4900 1062 was never set
annevk@4900 1063 explicitly, leaving
annevk@4900 1064 <code title="dom-Document-lastStyleSheetSet">lastStyleSheetSet</code> at
annevk@4900 1065 null throughout), which changes which style sheets are enabled and which
annevk@4900 1066 are not.</p>
annevk@4900 1067 </div>
annevk@4900 1068
glenn@6229 1069 <!-- ........................................................................................................................ -->
glenn@6229 1070 <!-- ........................................................................................................................ -->
annevk@4900 1071
annevk@4900 1072 <h3>Style Sheet Association</h3>
annevk@4900 1073
annevk@4903 1074 <p>This section defines the interface a
annevk@4903 1075 <span>style sheet owner node</span> of a <span>style sheet</span> has to
annevk@4903 1076 implement and defines the requirements for
annevk@4903 1077 <span data-anolis-spec=xmlss title="xml-stylesheet processing instruction">xml-stylesheet processing instructions</span>
annevk@4900 1078 and HTTP <code title="http-link">Link</code> headers when the link
annevk@4903 1079 relation type is an
annevk@4914 1080 <span data-anolis-spec=dom>ASCII case-insensitive</span> match for
glenn@6229 1081 "<code>stylesheet</code>" since nobody else was interested in
annevk@4900 1082 defining this.</p>
annevk@4900 1083
annevk@4903 1084 <p class=note>The editor is in good hope that HTML and SVG will define the
annevk@4900 1085 appropriate processing in their respective specifications, in terms of
annevk@4900 1086 this specification, in due course.</p>
annevk@4900 1087
annevk@4900 1088
glenn@6229 1089 <!-- ........................................................................................................................ -->
glenn@6229 1090
glenn@6229 1091 <h4>The <code>LinkStyle</code> Interface</h4>
glenn@6229 1092
glenn@6229 1093 <!--{@idl(LinkStyle)}-->
annevk@4900 1094
annevk@4900 1095 <div class="example">
annevk@4900 1096 <p>In the following HTML snippet the first HTML <code>style</code>
annevk@4900 1097 element has a <code>sheet</code> attribute that returns a
annevk@4900 1098 <code>StyleSheet</code> object representing the style sheet, but for
annevk@4900 1099 the second <code>style</code> attribute it returns null.
annevk@4900 1100 (Assuming the user agent supports CSS (<code>text/css</code>) and does
annevk@4900 1101 not support ExampleSheets (<code>text/example-sheets</code>).</p>
annevk@4900 1102
glenn@6346 1103 <pre>&lt;style type=text/css> body { background:lime } &lt;/style>
annevk@4900 1104 &lt;style type=text/example-sheets> $(body).background := lime &lt;/style></pre>
annevk@4900 1105 </div>
annevk@4900 1106
annevk@4900 1107 <p class="note">Whether or not the node refers to a style sheet is defined
annevk@4900 1108 by the specification that defines the semantics of said node.</p>
annevk@4900 1109
glenn@6229 1110 <!-- ........................................................................................................................ -->
annevk@4900 1111
annevk@4900 1112 <h4>Requirements on specifications</h4>
annevk@4900 1113
annevk@4900 1114 <p>Specifications introducing new ways of associating style sheets through
annevk@4900 1115 the DOM should define which nodes implement the
annevk@4900 1116 <code>LinkStyle</code> interface. When doing so, they
annevk@4900 1117 must also define when a <span>style sheet</span> is
annevk@4900 1118 <span title="create a style sheet">created</span>.</p>
annevk@4900 1119
annevk@4900 1120
annevk@4900 1121
annevk@4900 1122
glenn@6229 1123 <!-- ........................................................................................................................ -->
glenn@6229 1124
annevk@4900 1125 <h4>Requirements on User Agents Implementing the
glenn@6229 1126 <span><code>xml-stylesheet</code> processing instruction</span></h4>
annevk@4900 1127
annevk@4900 1128 <!-- XXX load/error events, reparse -->
annevk@4900 1129
glenn@6229 1130 <!--{@idl(ProcessingInstruction)}-->
glenn@6229 1131
glenn@6229 1132 <!--
annevk@4914 1133 <pre class="idl"><span data-anolis-spec=dom>ProcessingInstruction</span> implements <span>LinkStyle</span>;</pre>
glenn@6229 1134 -->
annevk@4900 1135
annevk@4900 1136 <p>For each
annevk@4903 1137 <span data-anolis-spec=xmlss><code>xml-stylesheet</code> processing instruction</span>
annevk@4903 1138 that is not part of the
annevk@4903 1139 <span data-anolis-spec=xml>document type declaration</span> and has an
glenn@6229 1140 <code>href</code>
annevk@4903 1141 <span data-anolis-spec=xmlss>pseudo-attribute</span> these steps must
annevk@4903 1142 (unless otherwise stated) be run:</p>
annevk@4900 1143
annevk@4900 1144 <ol>
glenn@6229 1145 <li><p>Let <var>title</var> be the value of the
glenn@6229 1146 <code>title</code> <span data-anolis-spec=xmlss>pseudo-attribute</span> or the empty string if the
glenn@6229 1147 <code>title</code> <span data-anolis-spec=xmlss>pseudo-attribute</span> is not specified.</p></li>
glenn@6229 1148
glenn@6229 1149 <li><p>If there is an <code>alternate</code> <span data-anolis-spec=xmlss>pseudo-attribute</span>
annevk@4914 1150 whose value is a <span data-anolis-spec=dom>case-sensitive</span> match
glenn@6229 1151 for "<code>yes</code>" and <var>title</var> is the
annevk@4900 1152 empty string terminate these steps.</p></li>
annevk@4900 1153
glenn@6229 1154 <li><p>If there is a <code>type</code> <span data-anolis-spec=xmlss>pseudo-attribute</span> whose
annevk@4900 1155 value is not a <span>supported styling language</span> the user agent
annevk@4900 1156 may terminate these steps.</p></li>
annevk@4900 1157
annevk@4900 1158 <li><p><span data-anolis-spec=html title="Resolve a URL">Resolve</span>
annevk@4900 1159 the <span data-anolis-spec=html>URL</span> specified by the
glenn@6229 1160 <code>href</code> <span data-anolis-spec=xmlss>pseudo-attribute</span> and then
annevk@4900 1161 <span data-anolis-spec=html>fetch</span> it.</p></li>
annevk@4900 1162
annevk@4900 1163 <li>
annevk@4900 1164 <p>When the resource is available, the document is in
annevk@4914 1165 <span data-anolis-spec=dom title=concept-quirks-mode>quirks mode</span>
annevk@4903 1166 and the
annevk@4903 1167 <span data-anolis-spec=html>Content-Type metadata</span> of
annevk@4900 1168 the resource is not a <span>supported styling language</span> change the
annevk@4903 1169 <span data-anolis-spec=html>Content-Type metadata</span> of the resource
glenn@6229 1170 to <code>text/css</code>.</p>
annevk@4900 1171
annevk@4900 1172 <p class="note">This step might never actually happen, but is included
annevk@4900 1173 here in case other specifications change, to keep things consistent.</p>
annevk@4900 1174 </li>
annevk@4900 1175
annevk@4900 1176 <li><p>If the resource is not in a
annevk@4900 1177 <span>supported styling language</span> terminate these steps.</p></li>
annevk@4900 1178
annevk@4900 1179 <li>
annevk@4900 1180 <p><span>Create a style sheet</span> with the following properties:</p>
annevk@4900 1181
annevk@4900 1182 <dl>
annevk@4900 1183 <dt><span>style sheet location</span></dt>
annevk@4900 1184 <dd><p>The <span data-anolis-spec=html>absolute URL</span> of the
annevk@4900 1185 resource.</p></dd>
annevk@4900 1186
annevk@4900 1187 <dt><span>style sheet parent</span></dt>
annevk@4900 1188 <dd><p>null</p></dd>
annevk@4900 1189
annevk@4900 1190 <dt><span>style sheet owner node</span></dt>
annevk@4900 1191 <dd><p>The node.</p></dd>
annevk@4900 1192
annevk@4900 1193 <dt><span>style sheet owner CSS rule</span></dt>
annevk@4900 1194 <dd><p>null</p></dd>
annevk@4900 1195
annevk@4900 1196 <dt><span>style sheet media</span></dt>
glenn@6229 1197 <dd><p>The value of the <code>media</code> <span data-anolis-spec=xmlss>pseudo-attribute</span>
annevk@4900 1198 if any, or the empty string otherwise.</p></dd>
annevk@4900 1199
annevk@4900 1200 <dt><span>style sheet title</span></dt>
glenn@6229 1201 <dd><p><var>title</var></p></dd>
annevk@4900 1202
annevk@4900 1203 <dt><span>style sheet alternate flag</span></dt>
glenn@6229 1204 <dd><p>Set if the <code>alternate</code> <span data-anolis-spec=xmlss>pseudo-attribute</span>
annevk@4914 1205 value is a <span data-anolis-spec=dom>case-sensitive</span> match for
annevk@4917 1206 "<code>yes</code>", or unset otherwise.
annevk@4900 1207 </dl>
annevk@4900 1208 </li>
annevk@4900 1209 </ol>
annevk@4900 1210
annevk@4900 1211
annevk@4900 1212
glenn@6229 1213 <!-- ........................................................................................................................ -->
glenn@6229 1214
annevk@4900 1215 <h4>Requirements on User Agents Implementing the HTTP
glenn@6229 1216 <code>Link</code> Header</h4>
annevk@4900 1217
annevk@4900 1218 <!-- XXX ref, one day -->
annevk@4900 1219
annevk@4900 1220 <!-- XXX deal with media param -->
annevk@4900 1221
annevk@4900 1222 <p>For each HTTP <code title="http-link">Link</code> header of which one
annevk@4900 1223 of the link relation types is an
annevk@4914 1224 <span data-anolis-spec=dom>ASCII case-insensitive</span> match
glenn@6229 1225 for "<code>stylesheet</code>" these steps
annevk@4900 1226 must be run:</p>
annevk@4900 1227
annevk@4900 1228 <ol>
glenn@6229 1229 <li><p>Let <var>title</var> be the value of the first of all the
glenn@6229 1230 <code>title</code> and <code>title*</code> parameters.
annevk@4900 1231 If there are no such parameters it is the empty string.</p></li>
annevk@4900 1232
annevk@4900 1233 <li><p>If one of the (other) link relation types is an
annevk@4914 1234 <span data-anolis-spec=dom>ASCII case-insensitive</span> match for
glenn@6229 1235 "<code>alternate</code>" and <var>title</var> is the
annevk@4900 1236 empty string terminate these steps.</p></li>
annevk@4900 1237
annevk@4900 1238 <li><p><span data-anolis-spec=html title="Resolve a URL">Resolve</span>
annevk@4900 1239 the specified <span data-anolis-spec=html>URL</span> and
annevk@4900 1240 <span data-anolis-spec=html>fetch</span> it.</p></li>
annevk@4900 1241
annevk@4900 1242 <li><p>When the resource is available, the document is in
annevk@4914 1243 <span data-anolis-spec=dom title=concept-quirks-mode>quirks mode</span>
annevk@4903 1244 and the <span data-anolis-spec=html>Content-Type metadata</span> of
annevk@4900 1245 the resource is not a <span>supported styling language</span> change the
annevk@4903 1246 <span data-anolis-spec=html>Content-Type metadata</span> of the resource
glenn@6229 1247 to <code>text/css</code>.</p></li>
annevk@4900 1248
annevk@4900 1249 <li><p>If the resource is not in a
annevk@4900 1250 <span>supported styling language</span> terminate these steps.</p></li>
annevk@4900 1251
annevk@4900 1252 <li>
annevk@4900 1253 <p><span>Create a style sheet</span> with the following properties:</p>
annevk@4900 1254
annevk@4900 1255 <dl>
annevk@4900 1256 <dt><span>style sheet location</span></dt>
annevk@4900 1257 <dd><p>The <span data-anolis-spec=html>absolute URL</span> of the
annevk@4900 1258 resource.</p></dd>
annevk@4900 1259
annevk@4900 1260 <dt><span>style sheet owner node</span></dt>
annevk@4900 1261 <dd><p>null</p></dd>
annevk@4900 1262
annevk@4900 1263 <dt><span>style sheet parent</span></dt>
annevk@4900 1264 <dd><p>null</p></dd>
annevk@4900 1265
annevk@4900 1266 <dt><span>style sheet owner CSS rule</span></dt>
annevk@4900 1267 <dd><p>null</p></dd>
annevk@4900 1268
annevk@4900 1269 <dt><span>style sheet media</span></dt>
glenn@6229 1270 <dd><p>The value of the first <code>media</code> parameter.</p></dd>
annevk@4900 1271 <!-- XXX register media parameter? bah -->
annevk@4900 1272
annevk@4900 1273 <dt><span>style sheet title</span></dt>
glenn@6229 1274 <dd><p><var>title</var></p></dd>
annevk@4900 1275
annevk@4900 1276 <dt><span>style sheet alternate flag</span></dt>
annevk@4917 1277 <dd><p>Set if one of the specified link relation type for this HTTP
annevk@4900 1278 <code title="http-link">Link</code> header is an
annevk@4914 1279 <span data-anolis-spec=dom>ASCII case-insensitive</span> match for
glenn@6229 1280 "<code>alternate</code>", or false otherwise.
annevk@4900 1281 </dl>
annevk@4900 1282 </li>
annevk@4900 1283 </ol>
annevk@4900 1284
glenn@6229 1285 <!-- ........................................................................................................................ -->
glenn@6229 1286 <!-- ........................................................................................................................ -->
annevk@4900 1287
annevk@4900 1288 <h3>CSS Rules</h3>
annevk@4900 1289
glenn@6794 1290 <p>A <dfn id="rule">CSS rule</dfn> is an abstract concept that
glenn@6794 1291 represents a rule as defined by the CSS specification. In the CSSOM a
glenn@6794 1292 <span>CSS rule</span> is represented as an object that implements a subclass of
glenn@6794 1293 the <code>CSSRule</code> interface. A <span>CSS rule</span> has the following
glenn@6794 1294 associated state items:</p>
glenn@6794 1295
glenn@6794 1296 <dl>
glenn@6794 1297 <dt><dfn id="rule-type">rule type</dfn></dt>
glenn@6794 1298 <dd><p>A non-negative integer associated with a particular type of rule.
glenn@6794 1299 This item is initialized when a rule is created and must never change.</p></dd>
glenn@6794 1300
glenn@6794 1301 <dt><dfn id="rule-text">rule text</dfn></dt>
glenn@6794 1302 <dd><p>A text representation of the rule suitable for direct use in a style sheet.
glenn@6794 1303 This item is initialized when a rule is created, and may change over the lifetime of the rule.</p></dd>
glenn@6794 1304
glenn@6794 1305 <dt><dfn id="rule-parent">rule parent</dfn></dt>
glenn@6794 1306 <dd><p>An optional reference to another, enclosing <span>CSS rule</span>.
glenn@6794 1307 If the rule has an enclosing rule when it is created, then this item is initialized to the enclosing rule; otherwise it is null.
glenn@6794 1308 Subsequent to initialization, this item is reset to null if the rule becomes non-enclosed. Once reset to null, it must never change.</p></dd>
glenn@6794 1309
glenn@6794 1310 <dt><dfn id="rule-style-sheet">rule parent style sheet</dfn></dt>
glenn@6794 1311 <dd><p>An optional reference to an associated <span>CSS style sheet</span>.
glenn@6794 1312 This item is initialized to reference an associated style sheet when the rule is created. Subsequent to initialization, this item
glenn@6794 1313 is reset to null if the rule becomes disassociated from its initial style sheet. Once reset to null, it must never change.</p></dd>
glenn@6794 1314 </dl>
glenn@6794 1315
glenn@6794 1316 <p>In addition to the above state, each <span>CSS rule</span> may be associated
glenn@6794 1317 with other state in accordance to the <span>rule type</span>.</p>
glenn@6794 1318
annevk@4900 1319 <p>To <dfn>parse a CSS rule</dfn> ...</p>
annevk@4900 1320
annevk@4900 1321 <p>To <dfn>serialize a CSS rule</dfn> depends on the type of CSS rule, as
annevk@4900 1322 follows:</p>
annevk@4900 1323
annevk@4900 1324 <dl class="switch">
annevk@4900 1325 <dt><code>CSSStyleRule</code></dt>
glenn@6523 1326 <dd><p class="issue">...</p></dd>
glenn@6523 1327
glenn@6523 1328 <dt><code>CSSCharsetRule</code></dt>
glenn@6523 1329 <dd><p class="issue">...</p></dd>
annevk@4900 1330
annevk@4900 1331 <dt><code>CSSImportRule</code></dt>
annevk@4900 1332 <dd>
annevk@4900 1333 <p>The result of concatenating these strings:</p>
annevk@4900 1334 <ol>
annevk@4900 1335 <li>The literal string "<code>@import</code>", followed by a space
annevk@4900 1336 (U+0020), followed by the <span title="serialize a URL">URL escaped</span>
annevk@4900 1337 value of the <code title="dom-CSSImportRule-href">href</code>
annevk@4900 1338 attribute.</li>
annevk@4900 1339 <li>If the associated <code>MediaList</code> object is not empty, a
annevk@4900 1340 space (U+0020), followed by the value of the
annevk@4900 1341 <code title="dom-MediaList-mediaText">mediaText</code> attribute of the
annevk@4900 1342 associated <code>MediaList</code> object.</li>
annevk@4900 1343 <li>A "<code>;</code>" (U+003B).</li>
annevk@4900 1344 </ol>
annevk@4900 1345 </dd>
annevk@4900 1346
annevk@4900 1347 <dt><code>CSSMediaRule</code></dt>
glenn@6523 1348 <dd><p class="issue">...</p></dd>
annevk@4900 1349
annevk@4900 1350 <dt><code>CSSFontFaceRule</code></dt>
glenn@6523 1351 <dd><p class="issue">...</p></dd>
annevk@4900 1352
annevk@4900 1353 <dt><code>CSSPageRule</code></dt>
glenn@6523 1354 <dd><p class="issue">...</p></dd>
annevk@4900 1355
annevk@4900 1356 <dt><code>CSSNamespaceRule</code></dt>
annevk@4900 1357 <dd><p>The literal string "<code>@namespace</code>", followed by a space
annevk@4900 1358 (U+0020), followed by the
annevk@4900 1359 <span title="serialize an identifier">identifier escaped</span> value of the
annevk@4900 1360 <code title="dom-CSSNamespaceRule-prefix">prefix</code> attribute (if
annevk@4900 1361 any), followed by a space (U+0020) if there is a prefix, followed by the
annevk@4900 1362 <span title="serialize a URL">URL escaped</span> value of the
annevk@4900 1363 <code title="dom-CSSNamespaceRule-namespaceURI">namespaceURI</code>
annevk@4900 1364 attribute, followed the character "<code>;</code>" (U+003B).</p></dd>
annevk@4900 1365 </dl>
annevk@4900 1366
glenn@6229 1367 <!-- ........................................................................................................................ -->
glenn@6229 1368
glenn@6229 1369 <h4>The <code>CSSRuleList</code> Sequence</h4>
glenn@6229 1370
glenn@6229 1371 <!--{@idl(CSSRuleList)}-->
glenn@6229 1372
glenn@6229 1373 <!-- ........................................................................................................................ -->
glenn@6229 1374
glenn@6229 1375 <h4>The <code>CSSRule</code> Interface</h4>
glenn@6229 1376
glenn@6229 1377 <!--{@idl(CSSRule)}-->
glenn@6229 1378
glenn@6229 1379 <!-- ........................................................................................................................ -->
glenn@6229 1380
glenn@6229 1381 <h4>The <code>CSSStyleRule</code> Interface</h4>
glenn@6229 1382
glenn@6229 1383 <!--{@idl(CSSStyleRule)}-->
glenn@6229 1384
glenn@6229 1385 <!-- ........................................................................................................................ -->
glenn@6229 1386
glenn@6523 1387 <h4>The <code>CSSCharsetRule</code> Interface</h4>
glenn@6523 1388
glenn@6523 1389 <!--{@idl(CSSCharsetRule)}-->
glenn@6523 1390
glenn@6523 1391 <!-- ........................................................................................................................ -->
glenn@6523 1392
glenn@6229 1393 <h4>The <code>CSSImportRule</code> Interface</h4>
glenn@6229 1394
glenn@6229 1395 <!--{@idl(CSSImportRule)}-->
glenn@6229 1396
glenn@6229 1397 <!-- ........................................................................................................................ -->
glenn@6229 1398
glenn@6229 1399 <h4>The <code>CSSMediaRule</code> Interface</h4>
glenn@6229 1400
glenn@6229 1401 <!--{@idl(CSSMediaRule)}-->
glenn@6229 1402
glenn@6229 1403 <!-- ........................................................................................................................ -->
glenn@6229 1404
glenn@6229 1405 <h4>The <code>CSSFontFaceRule</code> Interface</h4>
glenn@6229 1406
glenn@6229 1407 <!--{@idl(CSSFontFaceRule)}-->
glenn@6229 1408
glenn@6229 1409 <!-- ........................................................................................................................ -->
glenn@6229 1410
glenn@6229 1411 <h4>The <code>CSSPageRule</code> Interface</h4>
glenn@6229 1412
glenn@6229 1413 <!--{@idl(CSSPageRule)}-->
glenn@6229 1414
glenn@6229 1415 <!-- ........................................................................................................................ -->
glenn@6229 1416
glenn@6229 1417 <h4>The <code>CSSNamespaceRule</code> Interface</h4>
glenn@6229 1418
glenn@6229 1419 <!--{@idl(CSSNamespaceRule)}-->
glenn@6229 1420
glenn@6229 1421 <!-- ........................................................................................................................ -->
glenn@6229 1422 <!-- ........................................................................................................................ -->
annevk@4900 1423
annevk@4900 1424 <h3>CSS Declaration Blocks</h3>
annevk@4900 1425
annevk@4900 1426 <p>A <dfn>CSS declaration block</dfn> is an ordered collection of CSS
annevk@4900 1427 properties with their associated values, also named CSS declarations. In
annevk@4900 1428 the DOM a <span>CSS declaration block</span> is a
annevk@4900 1429 <code>CSSStyleDeclaration</code> object. A
annevk@4900 1430 <span>CSS declaration block</span> has two associated properties:</p>
annevk@4900 1431
annevk@4900 1432 <dl>
annevk@4900 1433 <dt><dfn>CSS declaration block readonly flag</dfn></dt>
annevk@4917 1434 <dd><p>Unset if the object can be manipulated. Set if it can not be
annevk@4917 1435 manipulated. Unless otherwise stated it is unset.</p></dd>
annevk@4900 1436
annevk@4900 1437 <dt><dfn>CSS declaration block declarations</dfn></dt>
annevk@4900 1438 <dd><p>The CSS declarations associated with the object.</p></dd>
annevk@4900 1439 </dl>
annevk@4900 1440
annevk@4900 1441 <p class="note">The <span>CSS declaration block declarations</span> are
annevk@4900 1442 ordered. This matters for the
annevk@4900 1443 <code title="dom-CSSStyleDeclaration-item">item()</code> method.</p>
annevk@4900 1444
annevk@4900 1445
glenn@6344 1446 <p class="issue">To
annevk@4900 1447 <dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn>
annevk@4900 1448 ...</p>
annevk@4900 1449
glenn@6527 1450 <p>To <dfn id="serialize-a-css-declaration-block">serialize a CSS declaration block</dfn>
glenn@6527 1451 represented by a <code>CSSStyleDeclarations</code> instance named <var>d</var>,
glenn@6527 1452 let <var>s</var> be the empty string, then run the steps below:</p>
annevk@4900 1453
glenn@6527 1454 <ol>
glenn@6527 1455 <li><p>If <code><var>d</var>.length</code> is zero (0), then return <var>s</var>.</p></li>
glenn@6527 1456 <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 1457 <ol>
glenn@6527 1458 <li><p>Let <var>n</var> be the value returned by <code><var>d</var>.item(<var>i</var>)</code>.</p></li>
glenn@6527 1459 <li><p>Let <var>v</var> be the value returned by <code><var>d</var>.getPropertyValue(<var>n</var>)</code>.</p></li>
glenn@6527 1460 <li><p>If <var>v</var> is the empty string, then continue.</p></li>
glenn@6527 1461 <li><p>Otherwise (<var>v</var> is non-empty), perform the following sub-steps:</p>
glenn@6527 1462 <ol>
glenn@6527 1463 <li><p>If <var>s</var> is not empty, then append a SPACE (U+0020) to <var>s</var>.</p></li>
glenn@6527 1464 <li><p>Append <var>n</var> to <var>s</var>.</p></li>
glenn@6534 1465 <li><p>Append COLON (U+003A) followed by SPACE (U+0020), i.e., "<code>: </code>", to <var>s</var>.</p></li>
glenn@6527 1466 <li><p>Append <var>v</var> to <var>s</var>.</p></li>
glenn@6527 1467 </ol>
glenn@6527 1468 </li>
glenn@6534 1469 <li><p>Let <var>p</var> be the value returned by <code><var>d</var>.getPropertyPriority(<var>n</var>)</code>.</p></li>
glenn@6534 1470 <li><p>If <var>p</var> is not the empty string, then perform the following sub-steps:</p>
glenn@6534 1471 <ol>
glenn@6534 1472 <li><p>Append SPACE (U+0020) followed by EXCLAMATION MARK (U+0021), i.e., "<code> !</code>", to <var>s</var>.</p></li>
glenn@6534 1473 <li><p>Append <var>p</var> to <var>s</var>.</p></li>
glenn@6534 1474 </ol>
glenn@6534 1475 </li>
glenn@6534 1476 <li><p>Append SEMICOLON (U+003B), i.e., "<code>;</code>", to <var>s</var>.</p></li>
glenn@6527 1477 </ol>
glenn@6527 1478 </li>
glenn@6531 1479 <li><p>Return <var>s</var>.</p></li>
glenn@6527 1480 </ol>
annevk@4900 1481
glenn@6527 1482 <p class="note">The serialization of an empty CSS declaration block is the empty string.</p>
glenn@6527 1483
glenn@6530 1484 <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 1485 before the first property name and no whitespace appears after the final semicolon delimiter that follows the last property value.</p>
annevk@4900 1486
glenn@6229 1487 <!-- ........................................................................................................................ -->
glenn@6229 1488
glenn@6229 1489 <h4>The <code>CSSStyleDeclaration</code> Interface</h4>
glenn@6229 1490
glenn@6229 1491 <!--{@idl(CSSStyleDeclaration)}-->
glenn@6229 1492
annevk@4916 1493 <hr>
annevk@4900 1494
annevk@4900 1495 <p>For the table below, the IDL attribute in the first column
annevk@4916 1496 must return the result of invoking
annevk@4900 1497 <code title="dom-CSSStyleDeclaration-getPropertyValue">getPropertyValue()</code>
annevk@4900 1498 with as argument the CSS property given in the second column on the same
annevk@4900 1499 row.</p>
annevk@4900 1500
annevk@4900 1501 <p>Similarly for the table below, setting the IDL attribute in the
annevk@4916 1502 first column must invoke
annevk@4916 1503 <code title="dom-CSSStyleDeclaration-setProperty">setProperty()</code>
annevk@4916 1504 with as first argument the CSS property given in the second column on the
annevk@4916 1505 same row, as second argument the given value, and no third argument. Any
annevk@4918 1506 exceptions thrown must be re-thrown.</p>
annevk@4900 1507
glenn@6531 1508 <p class="issue">Restore the entries for the following table or resurrect
glenn@6531 1509 CSS2Properties (or similar) or define in general terms using prose or ...</p>
glenn@6531 1510
annevk@4900 1511 <table>
annevk@4900 1512 <thead>
annevk@4900 1513 <tr>
annevk@4900 1514 <th>IDL attribute
annevk@4900 1515 <th>CSS property
annevk@4900 1516 <tbody>
annevk@4900 1517 <!--CSSOM-DECLARATIONTABLE-->
annevk@4900 1518 </table>
annevk@4900 1519
annevk@4900 1520 <!--
annevk@4900 1521 <h4>CSS Properties</h4>
annevk@4900 1522
annevk@4900 1523 <p>The DOM attribute name of a CSS property can be found by using the
annevk@4900 1524 following algorithm:</p>
annevk@4900 1525
annevk@4900 1526 <ol>
glenn@6229 1527 <li>Let <var>r</var> be the CSS property to be
annevk@4900 1528 converted.</li>
annevk@4900 1529
annevk@4900 1530 <li>Uppercase the first character after every U+002D (<code>-</code>) in
glenn@6229 1531 <var>r</var>.</li>
glenn@6229 1532
glenn@6229 1533 <li>Remove every U+002D (<code>-</code>) in <var>r</var>.</li>
glenn@6229 1534
glenn@6229 1535 <li>Return <var>r</var>.</li>
annevk@4900 1536 </ol>
annevk@4900 1537
annevk@4900 1538 <p class="note">This means that
glenn@6229 1539 <code>-<var>vendor</var>-<var>property</var></code>
annevk@4900 1540 becomes
glenn@6229 1541 <code><var><strong>V</strong>endor</var><var><strong>P</strong>roperty</var></code>
annevk@4900 1542 for instance.</p>
annevk@4900 1543 -->
annevk@4900 1544
glenn@6229 1545 <!-- ........................................................................................................................ -->
glenn@6229 1546 <!-- ........................................................................................................................ -->
annevk@4900 1547
annevk@4900 1548 <h3>CSS Values</h3>
annevk@4900 1549
glenn@6229 1550 <!-- ........................................................................................................................ -->
glenn@6229 1551
annevk@4900 1552 <h4>Parsing CSS Values</h4>
annevk@4900 1553
annevk@4900 1554 <p>To <dfn id="parse-a-css-value">parse a CSS value</dfn> for a given
glenn@6229 1555 <var>property</var> means to a parse the given value according to
annevk@4900 1556 the definition of the property that is an
annevk@4914 1557 <span data-anolis-spec=dom>ASCII case-insensitive</span> match for
glenn@6229 1558 <var>property</var> in the CSS specification. If the given value
annevk@4900 1559 is <span>ignored</span> return null. Otherwise return the CSS value for
glenn@6229 1560 the given <var>property</var>.</p>
glenn@6229 1561
glenn@6229 1562 <p class="note">"<code>!important</code>" declarations are not
annevk@4900 1563 part of the property value space and will therefore cause
annevk@4900 1564 <span>parse a CSS value</span> to return null.</p>
annevk@4900 1565
annevk@4900 1566
glenn@6229 1567 <!-- ........................................................................................................................ -->
glenn@6229 1568
annevk@4900 1569 <h4>Serializing CSS Values</h4>
annevk@4900 1570
annevk@4900 1571 <!-- based on http://damowmow.com/playground/canon.txt -->
annevk@4900 1572
annevk@4900 1573 <p>To <dfn id="serialize-a-css-value">serialize a CSS value</dfn> follow
annevk@4900 1574 these rules:</p>
annevk@4900 1575
annevk@4900 1576 <ul>
annevk@4900 1577 <li><p><span title="Serialize a CSS component value">Serialize</span> any
annevk@4900 1578 CSS component values in the value.</p></li>
annevk@4900 1579
annevk@4900 1580 <li><p>Where multiple CSS component values can appear in any order
annevk@4900 1581 without changing the meaning of the value (typically represented by a
annevk@4900 1582 double bar <code>||</code> in the value syntax), use the order as given
annevk@4900 1583 in the syntax.</p></li>
annevk@4900 1584 <!-- <code>&lt;border-width> &lt;border-style> &lt;color></code>
annevk@4900 1585 for <code>border</code> -->
annevk@4900 1586
annevk@4900 1587 <li>
annevk@4900 1588 <p>Where CSS component values of the value can be omitted without
annevk@4900 1589 changing the meaning of the value (e.g. initial values in shorthand
annevk@4900 1590 properties), omit them. If this would remove all the values, then
annevk@4900 1591 include the first allowed value.</p>
annevk@4900 1592
annevk@4900 1593 <p class="example">E.g. <code>margin: 20px 20px</code> becomes
annevk@4900 1594 <code>margin: 20px</code>.</p>
annevk@4900 1595
annevk@4900 1596 <p class="example">E.g. the value <code>0</code> for the
annevk@4900 1597 '<code>border</code>' property.</p>
annevk@4900 1598 </li>
annevk@4900 1599
annevk@4900 1600 <li><p>If the value of a shorthand property is requested and it cannot be
annevk@4900 1601 computed because the properties associated with the shorthand have values
annevk@4900 1602 that cannot be represented by the shorthand the serialization is the
annevk@4900 1603 empty string.</p></li>
annevk@4900 1604
annevk@4900 1605 <li><p>If a value has a <span>whitespace</span>-separated list of
annevk@4900 1606 CSS component values,
annevk@4900 1607 <span title="serialize a whitespace-separated list">serialize</span> the
annevk@4900 1608 value as a whitespace-separated list.</p></li>
annevk@4900 1609
annevk@4900 1610 <li><p>If a value has a comma-separated list of
annevk@4900 1611 CSS component values,
annevk@4900 1612 <span title="serialize a comma-separated list">serialize</span> the
annevk@4900 1613 value as a comma-separated list.</p></li>
annevk@4900 1614 </ul>
annevk@4900 1615
annevk@4900 1616
annevk@4900 1617 <p>To
annevk@4900 1618 <dfn id="serialize-a-css-value-component">serialize a CSS component value</dfn>
annevk@4900 1619 depends on the component, as follows:</p>
annevk@4900 1620
annevk@4900 1621 <dl class="switch">
annevk@4900 1622 <dt>keyword</dt>
annevk@4900 1623 <dd><p>The keyword
annevk@4914 1624 <span data-anolis-spec=dom>converted to ASCII lowercase</span>.</p></dd>
annevk@4900 1625
annevk@4900 1626 <dt>&lt;angle></dt>
annevk@4900 1627 <dd><p>The number of degrees serialized as per &lt;number> followed by
annevk@4900 1628 the literal string "<code>deg</code>".</p></dd>
annevk@4900 1629
annevk@4900 1630 <dt>&lt;color></dt>
glenn@6802 1631 <dd>
glenn@6802 1632 <p>If &lt;color&gt; is a component of a resolved or computed value, then
glenn@6802 1633 return the color using the <code>rgb()</code> or <code>rgba()</code> functional
glenn@6802 1634 notation as follows:</p>
glenn@6802 1635 <ol>
glenn@6802 1636 <li>If the alpha component of the color is equal to one, then return the serialization of the
glenn@6802 1637 <code>rgb()</code> functional equivalent of the opaque color.</li>
glenn@6802 1638 <li>If the alpha component of the color is not equal to one, then return the serialization of the
glenn@6802 1639 <code>rgba()</code> functional equivalent of the non-opaque color.</li>
glenn@6802 1640 </ol>
glenn@6802 1641 <p>The serialization of the <code>rgb()</code> functional equivalent is the concatenation of the following:</p>
glenn@6802 1642 <ol>
glenn@6802 1643 <li>The string "<code>rgb(</code>".</li>
glenn@6802 1644 <li>The shortest base-ten integer serialization of the red value.</li>
glenn@6802 1645 <li>The string "<code>, </code>".</li>
glenn@6802 1646 <li>The shortest base-ten serialization of the green value.</li>
glenn@6802 1647 <li>The string "<code>, </code>".</li>
glenn@6802 1648 <li>The shortest base-ten serialization of the blue value.</li>
glenn@6802 1649 <li>The string "<code>)</code>".</li>
glenn@6802 1650 </ol>
glenn@6802 1651 <p>The serialization of the <code>rgba()</code> functional equivalent is the concatenation of the following:</p>
glenn@6802 1652 <ol>
glenn@6802 1653 <li>The string "<code>rgba(</code>".</li>
glenn@6802 1654 <li>The shortest base-ten serialization of the red value.</li>
glenn@6802 1655 <li>The string "<code>, </code>".</li>
glenn@6802 1656 <li>The shortest base-ten serialization of the green value.</li>
glenn@6802 1657 <li>The string "<code>, </code>".</li>
glenn@6802 1658 <li>The shortest base-ten serialization of the blue value.</li>
glenn@6802 1659 <li>The string "<code>, </code>".</li>
glenn@6802 1660 <li>The shortest serialization of the &lt;number&gt; that denotes the alpha value.</li>
glenn@6802 1661 <li>The string "<code>)</code>".</li>
glenn@6802 1662 </ol>
glenn@6802 1663
glenn@6802 1664 <p>If &lt;color&gt; is a component of a specified value, then
glenn@6802 1665 return the color as follows:</p>
glenn@6802 1666 <ol>
glenn@6802 1667 <li>If the color was explicitly specified by the author, then return the original, author specified color value.</li>
glenn@6802 1668 <li>Otherwise, return the value that would be returned if the color were a component of a computed value.</li>
glenn@6802 1669 </ol>
glenn@6802 1670 <p class="issue">Should author specified values be normalized for case? Or should original case be preserved?</p>
glenn@6802 1671 </dd>
annevk@4900 1672 <!--
annevk@4900 1673 <dt>It is a system color</dt>
annevk@4900 1674
annevk@4900 1675 <dd>See below (you use the representation given in the specification that
annevk@4900 1676 defines the keyword).</dd>
annevk@4900 1677
annevk@4900 1678 <dt>Alpha component is equal to 1.0</dt>
annevk@4900 1679
annevk@4900 1680 <dd>The color is an uppercase six-digit hexadecimal value, prefixed with a
annevk@4900 1681 <code>#</code> character (U+0023 NUMBER SIGN), with the first two digits
annevk@4900 1682 representing the red component, the next two digits representing the green
annevk@4900 1683 component, and the last two digits representing the blue component, the
annevk@4900 1684 digits being in the range 0-9 A-F (U+0030 to U+0039 and U+0041 to
annevk@4900 1685 U+0046).</dd>
annevk@4900 1686
annevk@4900 1687 <dt>Alpha component is less than 1.0</dt>
annevk@4900 1688
annevk@4900 1689 <dd>The color is in the CSS <code>rgba()</code> functional-notation format:
annevk@4900 1690 the literal string <code>rgba</code> (U+0072 U+0067 U+0062 U+0061) followed
annevk@4900 1691 by a U+0028 LEFT PARENTHESIS, a <span>color component integer</span>
annevk@4900 1692 representing the red component, a <span>color component separator</span>, a
annevk@4900 1693 <span>color component integer</span> for the green component, a <span>color
annevk@4900 1694 component separator</span>, a <span>color component integer</span> for the
annevk@4900 1695 blue component, another <span>color component separator</span> a U+0030
annevk@4900 1696 DIGIT ZERO, a U+002E FULL STOP (representing the decimal point), one or
annevk@4900 1697 more digits in the range 0-9 (U+0030 to U+0039) representing the fractional
annevk@4900 1698 part of the alpha value, and finally a U+0029 RIGHT PARENTHESIS.</dd>
annevk@4900 1699
annevk@4900 1700 <dt>The keyword <code>transparent</code> is used</dt>
annevk@4900 1701
annevk@4900 1702 <dd>The color is <code>rgba(0, 0, 0, 0)</code>.</dd>
annevk@4900 1703 -->
annevk@4900 1704
annevk@4900 1705 <dt>&lt;counter></dt>
annevk@4900 1706 <dd>
annevk@4900 1707 <p>The concatenation of:</p>
annevk@4900 1708 <ol>
annevk@4900 1709 <li><p>If &lt;counter> has three CSS component values the string
glenn@6229 1710 "<code>counters(</code>".</p></li>
annevk@4900 1711 <li><p>If &lt;counter> has two CSS component values the string
glenn@6229 1712 "<code>counter(</code>".</p></li>
annevk@4900 1713 <li><p>The result of
annevk@4900 1714 <span title="serialize a comma-separated list">serializing</span> the
annevk@4900 1715 <span title="serialize a CSS component value">serialized</span>
annevk@4900 1716 CSS component values belonging to &lt;counter> as list while omitting
annevk@4900 1717 the last CSS component value if it is 'decimal'.</p></li>
annevk@4900 1718 <li><p>"<code>)</code>" (U+0029).</p></li>
annevk@4900 1719 </ol>
annevk@4900 1720 </dd>
annevk@4900 1721
annevk@4900 1722 <dt>&lt;frequency></dt>
annevk@4900 1723 <dd><p>The frequency in hertz serialized as per &lt;number> followed by
annevk@4900 1724 the literal string "<code>hz</code>".</dd>
annevk@4900 1725
annevk@4900 1726 <dt>&lt;identifier></dt>
annevk@4900 1727 <dd><p>The identifier
annevk@4900 1728 <span title="serialize an identifier">escaped</span>.</p></dd>
annevk@4900 1729
annevk@4900 1730 <dt>&lt;integer></dt>
annevk@4900 1731 <dd><p>A base-ten integer using digits 0-9 (U+0030 to U+0039) in the
annevk@4900 1732 shortest form possible, preceded by "<code>-</code>" (U+002D) if it is
annevk@4900 1733 negative.</p></dd>
annevk@4900 1734
annevk@4900 1735 <dt>&lt;length></dt>
annevk@4900 1736 <dd>
annevk@4900 1737 <p>A length of zero is represented by the literal string
annevk@4900 1738 "<code>0px</code>".</p>
annevk@4900 1739
annevk@4900 1740 <p>Absolute lengths: the number of millimeters serialized as per
glenn@6344 1741 &lt;number> followed by the literal string "<code>mm</code>".</p>
glenn@6344 1742 <p class="issue">Rumor has it absolute lengths will become relative
annevk@4900 1743 lengths. Centimeters would be compatible with &lt;resolution>...</p>
annevk@4900 1744
annevk@4900 1745 <p>Relative lengths: the &lt;number> component serialized as per
annevk@4900 1746 &lt;number> followed by the unit in its canonical form as defined in its
annevk@4900 1747 respective specification.</p>
annevk@4900 1748 </dd>
annevk@4900 1749
annevk@4900 1750 <dt>&lt;number></dt>
glenn@6344 1751 <dd><p class="issue">Browsers seem to use ToString(), but that might give a
annevk@4900 1752 significand which according to some is teh evil (and also currently does
annevk@4900 1753 not parse correctly).</p></dd>
annevk@4900 1754
annevk@4900 1755 <dt>&lt;percentage></dt>
annevk@4900 1756 <dd><p>The &lt;number> component serialized as per &lt;number> followed
annevk@4900 1757 by the literal string "<code>%</code>" (U+0025).</p></dd>
annevk@4900 1758
annevk@4900 1759 <dt>&lt;resolution></dt>
annevk@4900 1760 <dd><p>The resolution in dots per centimeter serialized as per
annevk@4900 1761 &lt;number> followed by the literal string "<code>dpcm</code>".</dd>
annevk@4900 1762
annevk@4900 1763 <dt>&lt;shape></dt>
glenn@6229 1764 <dd><p>The string "<code>rect(</code>", followed by the result
annevk@4900 1765 of <span title="serialize a comma-separated list">serializing</span> the
annevk@4900 1766 <span title="serialize a CSS component value">serialized</span>
annevk@4900 1767 CSS component values belonging to &lt;shape> as list, followed by
annevk@4900 1768 "<code>)</code>" (U+0029).</p></dd>
annevk@4900 1769
annevk@4900 1770 <dt>&lt;string></dt>
annevk@4900 1771 <dt>&lt;family-name></dt>
annevk@4900 1772 <dt>&lt;specific-voice></dt>
annevk@4900 1773 <dd><p>The string
annevk@4900 1774 <span title="serialize a string">string escaped</span>.</p></dd>
annevk@4900 1775
annevk@4900 1776 <dt>&lt;time></dt>
annevk@4900 1777 <dd><p>The time in seconds serialized as per &lt;number> followed by
annevk@4900 1778 the literal string "<code>s</code>".</dd>
annevk@4900 1779
annevk@4900 1780 <dt>&lt;uri></dt>
annevk@4900 1781 <dd><p>The <span data-anolis-spec=html>absolute URL</span>
annevk@4900 1782 <span title="serialize a URL">URL escaped</span>.</p></dd>
annevk@4900 1783 </dl>
annevk@4900 1784
annevk@4900 1785 <p>
annevk@4900 1786 &lt;absolute-size>,
annevk@4900 1787 &lt;border-width>,
annevk@4900 1788 &lt;border-style>,
annevk@4900 1789 &lt;bottom>,
annevk@4900 1790 &lt;generic-family>,
annevk@4900 1791 &lt;generic-voice>,
annevk@4900 1792 &lt;left>,
annevk@4900 1793 &lt;margin-width>,
annevk@4900 1794 &lt;padding-width>,
annevk@4900 1795 &lt;relative-size>,
annevk@4900 1796 &lt;right>, and
annevk@4900 1797 &lt;top>,
annevk@4900 1798 are considered macros by this specification. They all represent instances
annevk@4900 1799 of components outlined above.</p>
annevk@4900 1800
glenn@6344 1801 <p class="issue">One idea is that we can remove this section somewhere in
annevk@4900 1802 the CSS3/CSS4 timeline by moving the above definitions to the drafts that
annevk@4900 1803 define the CSS components.</p>
annevk@4900 1804
annevk@4900 1805
annevk@4900 1806 <h5>Examples</h5>
annevk@4900 1807
annevk@4900 1808 <p>Here are some examples of before and after results on specified values.
annevk@4900 1809 The before column could be what the author wrote in a style sheet, while
annevk@4900 1810 the after column shows what querying the DOM would return.</p>
annevk@4900 1811
annevk@4900 1812 <div class="example">
annevk@4900 1813 <table>
annevk@4900 1814 <thead>
annevk@4900 1815 <tr><th>Before<th>After
annevk@4900 1816 <tbody>
annevk@4900 1817 <tr><td><code>background: none</code><td><code>background: rgba(0, 0, 0, 0)</code>
annevk@4900 1818 <tr><td><code>outline: none</code><td><code>outline: invert</code>
annevk@4900 1819 <tr><td><code>border: none</code><td><code>border: medium</code>
annevk@4900 1820 <tr><td><code>list-style: none</code><td><code>list-style: disc</code>
annevk@4900 1821 <tr><td><code>margin: 0 1px 1px 1px</code><td><code>margin: 0px 1px 1px</code>
annevk@4900 1822 <tr><td><code>azimuth: behind left</code><td><code>azimuth: 220deg</code>
annevk@4900 1823 <tr><td><code>font-family: a, 'b"', serif</code><td><code>font-family: "a", "b\"", serif</code>
annevk@4900 1824 <tr><td><code>content: url('h)i') '\[\]'</code><td><code>content: url("h)i") "[]"</code>
annevk@4900 1825 <tr><td><code>azimuth: leftwards</code><td><code>azimuth: leftwards</code>
annevk@4900 1826 <tr><td><code>color: rgb(18, 52, 86)</code><td><code>color: #123456</code>
annevk@4900 1827 <tr><td><code>color: rgba(000001, 0, 0, 1)</code><td><code>color: #000000</code>
annevk@4900 1828 </table>
annevk@4900 1829
glenn@6344 1830 <p class="issue">Some of these need to be updated per the new rules.</p>
annevk@4900 1831 </div>
annevk@4900 1832
glenn@6229 1833 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 1834
annevk@4900 1835 <h2>DOM Access to CSS Declaration Blocks</h2>
annevk@4900 1836
glenn@6229 1837 <!-- ........................................................................................................................ -->
glenn@6229 1838 <!-- ........................................................................................................................ -->
glenn@6229 1839
annevk@4900 1840 <h3>The <code>ElementCSSInlineStyle</code> Interface</h3>
annevk@4900 1841
glenn@6229 1842 <!--{@idl(ElementCSSInlineStyle)}-->
glenn@6229 1843
glenn@6229 1844 <!-- ........................................................................................................................ -->
glenn@6229 1845 <!-- ........................................................................................................................ -->
glenn@6229 1846
glenn@6229 1847 <h3>Extensions to the <code>Window</code> Interface</h3>
glenn@6229 1848
glenn@6229 1849 <!--{@idl(Window)}-->
glenn@6229 1850
glenn@6229 1851 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 1852
annevk@4900 1853 <h2>Resolved Values</h2>
annevk@4900 1854
annevk@4900 1855 <p><code title="dom-Window-getComputedStyle">getComputedStyle()</code> was
annevk@4900 1856 historically defined to return the "computed value" of an element or
annevk@4900 1857 pseudo-element. However, the concept of "computed value" changed between
annevk@4900 1858 revisions of CSS while the implementation of
annevk@4900 1859 <code title="dom-Window-getComputedStyle">getComputedStyle()</code> had to
annevk@4900 1860 remain the same for compatibility with deployed scripts. To address this
annevk@4900 1861 issue this specification introduces the concept of a
annevk@4900 1862 <dfn>resolved value</dfn>.</p>
annevk@4900 1863
annevk@4900 1864 <p>The <span>resolved value</span> for a given property can be determined
annevk@4900 1865 as follows:</p>
annevk@4900 1866
annevk@4900 1867 <dl class="switch">
annevk@4900 1868 <!--
annevk@4900 1869 We want to treat shorthand properties like any other value basically.
annevk@4900 1870
annevk@4900 1871 <dt>'<code>background</code>'
annevk@4900 1872 <dt>'<code>border</code>'
annevk@4900 1873 <dt>'<code>border-collapse</code>'
annevk@4900 1874 <dt>'<code>border-color</code>'
annevk@4900 1875 <dt>'<code>border-spacing</code>'
annevk@4900 1876 <dt>'<code>border-style</code>'
annevk@4900 1877 <dt>'<code>border-top</code>'
annevk@4900 1878 <dt>'<code>border-right</code>'
annevk@4900 1879 <dt>'<code>border-bottom</code>'
annevk@4900 1880 <dt>'<code>border-left</code>'
annevk@4900 1881 <dt>'<code>border-width</code>'
annevk@4900 1882 <dt>'<code>font</code>'
annevk@4900 1883 <dt>'<code>list-style</code>'
annevk@4900 1884 <dt>'<code>margin</code>'
annevk@4900 1885 <dt>'<code>outline</code>'
annevk@4900 1886 <!- - overflow is not - ->
annevk@4900 1887 <dt>'<code>padding</code>'
annevk@4900 1888 <dt>'<code>pause</code>'
annevk@4900 1889 <dd>
annevk@4900 1890 <p>There is no <span>resolved value</span>.</p>
annevk@4900 1891 </dd>
annevk@4900 1892 -->
annevk@4900 1893
annevk@4900 1894 <dt>'<code>line-height</code>'</dt>
annevk@4900 1895 <dd><p>The <span>resolved value</span> is the used value.</p></dd>
annevk@4900 1896
annevk@4900 1897 <dt>'<code>height</code>'</dt>
annevk@4900 1898 <dt>'<code>margin</code>'</dt>
annevk@4900 1899 <dt>'<code>margin-bottom</code>'</dt>
annevk@4900 1900 <dt>'<code>margin-left</code>'</dt>
annevk@4900 1901 <dt>'<code>margin-right</code>'</dt>
annevk@4900 1902 <dt>'<code>margin-top</code>'</dt>
annevk@4900 1903 <dt>'<code>padding</code>'</dt>
annevk@4900 1904 <dt>'<code>padding-bottom</code>'</dt>
annevk@4900 1905 <dt>'<code>padding-left</code>'</dt>
annevk@4900 1906 <dt>'<code>padding-right</code>'</dt>
annevk@4900 1907 <dt>'<code>padding-top</code>'</dt>
annevk@4900 1908 <dt>'<code>width</code>'</dt>
annevk@4900 1909 <dd><p>If the property applies to the element or pseudo-element and the
annevk@4900 1910 <span>resolved value</span> of the '<code>display</code>' property is not
annevk@4900 1911 <code>none</code>, the <span>resolved value</span> is the
annevk@4900 1912 <span>used value</span>. Otherwise the <span>resolved value</span> is the
annevk@4900 1913 computed value.</p></dd>
annevk@4900 1914
glenn@6231 1915 <dt>'<code>bottom</code>'</dt>
glenn@6231 1916 <dt>'<code>left</code>'</dt>
glenn@6231 1917 <dt>'<code>right</code>'</dt>
glenn@6231 1918 <dt>'<code>top</code>'</dt>
glenn@6231 1919 <dd><p>If the property applies to a positioned element and the
glenn@6231 1920 <span>resolved value</span> of the '<code>display</code>' property is not
glenn@6231 1921 <code>none</code>, the <span>resolved value</span> is the
glenn@6231 1922 <span>used value</span>. Otherwise the <span>resolved value</span> is the
glenn@6231 1923 computed value.</p></dd>
glenn@6231 1924
annevk@4900 1925 <dt>Any other property</dt>
annevk@4900 1926 <dd><p>The <span>resolved value</span> is the computed value.</p></dd>
annevk@4900 1927 </dl>
annevk@4900 1928
glenn@6229 1929 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 1930
annevk@4900 1931 <h2 id="iana-considerations">IANA Considerations</h2>
annevk@4900 1932
glenn@6229 1933 <!-- ........................................................................................................................ -->
glenn@6229 1934 <!-- ........................................................................................................................ -->
glenn@6229 1935
glenn@6229 1936 <h3><dfn title="http-default-style"><code>Default-Style</code></dfn></h3>
annevk@4900 1937
annevk@4900 1938 <p>This section describes a header field for registration in the Permanent
annevk@4900 1939 Message Header Field Registry.
annevk@4900 1940 <!--<a href="XXX">[RFC3864]</a>--></p>
annevk@4900 1941
annevk@4900 1942 <dl>
annevk@4900 1943 <dt>Header field name</dt>
annevk@4900 1944 <dd>Default-Style</dd>
annevk@4900 1945 <dt>Applicable protocol</dt>
annevk@4900 1946 <dd>http</dd>
annevk@4900 1947 <dt>Status</dt>
annevk@4900 1948 <dd>standard</dd>
annevk@4900 1949 <dt>Author/Change controller</dt>
annevk@4900 1950 <dd>W3C</dd>
annevk@4900 1951 <dt>Specification document(s)</dt>
annevk@4900 1952 <dd>This document is the relevant specification.</dd>
annevk@4900 1953 <dt>Related information</dt>
annevk@4900 1954 <dd>None.</dd>
annevk@4900 1955 </dl>
annevk@4900 1956
glenn@6229 1957 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6229 1958
glenn@6229 1959 <h2 class=no-num>References</h2>
glenn@6229 1960
glenn@6229 1961 <!-- ........................................................................................................................ -->
glenn@6229 1962 <!-- ........................................................................................................................ -->
glenn@6229 1963
glenn@6229 1964 <h3 class=no-num>Normative references</h3>
glenn@6229 1965 <div id=anolis-references-normative></div>
glenn@6229 1966
glenn@6229 1967 <!-- ........................................................................................................................ -->
glenn@6229 1968 <!-- ........................................................................................................................ -->
glenn@6229 1969
glenn@6229 1970 <h3 class=no-num>Informative references</h3>
glenn@6229 1971 <div id=anolis-references-informative></div>
glenn@6229 1972
glenn@6229 1973 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
annevk@4900 1974
glenn@6794 1975 <h2 class="no-num" id="changes">Change History</h2>
glenn@6794 1976
glenn@6794 1977 <p>This section documents the primary technical changes of CSSOM related functionality, with a focus on changes to API signatures.</p>
glenn@6794 1978
glenn@6794 1979 <h3 class="no-num" id="changes-from-dom2">Changes From DOM-2 Style</h3>
glenn@6794 1980
glenn@6794 1981 <ul>
glenn@6794 1982 <li><p>Remove definition of <code>CSSRule.UNKNOWN_RULE</code>, reserving its value (0) to prevent future reuse.</p></li>
glenn@6794 1983 <li><p>Remove definition of <code>DOMImplementationCSS</code> interface.</p></li>
glenn@6794 1984 </ul>
glenn@6794 1985
glenn@6794 1986 <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
glenn@6794 1987
annevk@4900 1988 <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
annevk@4900 1989
glenn@4922 1990 <p>The editors would like to thank
annevk@4900 1991
annevk@4900 1992 Alexey Feldgendler,
annevk@4904 1993 Bj&ouml;rn H&ouml;hrmann,
glenn@6794 1994 Boris Zbasky,
annevk@4913 1995 Brian Kardell,
annevk@4900 1996 Christian Krebs,
annevk@4900 1997 Daniel Glazman,
annevk@4900 1998 David Baron,
annevk@4900 1999 <i>fantasai</i>,
annevk@4900 2000 Hallvord R. M. Steen,
annevk@4900 2001 Ian Hickson,
annevk@4920 2002 John Daggett,
annevk@4900 2003 Lachlan Hunt,
annevk@4900 2004 Morten Stenshorne,
annevk@4900 2005 Philip Taylor,
annevk@4900 2006 Robert O'Callahan,
annevk@4900 2007 Sjoerd Visscher,
annevk@4900 2008 Simon Pieters,
annevk@4912 2009 Sylvain Galineau,
annevk@4912 2010 Tarquin Wilton-Jones, and
annevk@4912 2011 Zack Weinberg
annevk@4900 2012
annevk@4900 2013 for contributing to this specification.</p>
annevk@4900 2014
glenn@4922 2015 <p>Additional thanks to Ian Hickson for writing the
annevk@4900 2016 initial version of the alternative style sheets API and canonicalization
annevk@4900 2017 (now serialization) rules for CSS values.</p>
annevk@4900 2018
annevk@4900 2019 <!-- XXX NOTES
annevk@4900 2020
annevk@4900 2021 <style type=text/css;charset=utf-8> does create a StyleSheet in Firefox
annevk@4900 2022 and Opera, but does not create a StyleSheet in IE. I prefer IE.
annevk@4900 2023
annevk@4900 2024 <style type=TEXT/CSS> sets the style sheet type to text/css in Firefox and
annevk@4900 2025 TEXT/CSS in Opera and IE. I prefer Firefox.
annevk@4900 2026
annevk@4900 2027 <style> sets the style sheet location to the document location Firefox,
annevk@4900 2028 the empty string in IE, and null in Opera. I prefer Opera
annevk@4900 2029
annevk@4900 2030 <style media="x"> invokes .sheet.media.mediaText = "x"
annevk@4900 2031
glenn@6229 2032 <style> does not "have" a title
annevk@4900 2033
annevk@4900 2034 .cascadedStyle that returns less keywords than currentStyle, no inherit,
annevk@4900 2035 etc.
annevk@4900 2036
annevk@4900 2037 Markup style: http://krijnhoetmer.nl/irc-logs/whatwg/20100204#l-529
annevk@4900 2038 -->
annevk@4900 2039 </body>
annevk@4900 2040 </html>
annevk@4900 2041

mercurial