css3-conditional/Overview.src.html

Thu, 07 Feb 2013 14:29:04 -0800

author
L. David Baron <dbaron@dbaron.org>
date
Thu, 07 Feb 2013 14:29:04 -0800
changeset 7387
7dace721dff3
parent 7382
6e5d9a1539bd
child 7389
7862f20a7103
permissions
-rw-r--r--

[css3-conditional] Describe requirements for conditionText getter on CSSSupportsRule.

This implements the resolution in
http://lists.w3.org/Archives/Public/www-style/2012Aug/0749.html
to address the second point in
http://lists.w3.org/Archives/Public/www-style/2013Feb/0228.html
which is Issue 8 in the Last Call Disposition of Comments.

It also adds a parenthetical to clarify the issue rejected in
http://lists.w3.org/Archives/Public/www-style/2012Dec/0102.html

dbaron@2974 1 <!DOCTYPE html public '-//W3C//DTD HTML 4.01//EN'
dbaron@2974 2 'http://www.w3.org/TR/html4/strict.dtd'>
dbaron@2974 3 <html lang="en">
dbaron@2974 4 <head profile="http://www.w3.org/2006/03/hcard">
dbaron@2974 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
dbaron@2974 6 <title>CSS Conditional Rules Module Level 3</title>
dbaron@2974 7 <link rel="stylesheet" type="text/css" href="../default.css">
jackalmage@7274 8 <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
jackalmage@7274 9 <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
fantasai@7042 10 <!--
peter@6932 11 <script src="http://test.csswg.org/harness/annotate.js#CSS3-CONDITIONAL_DEV"
fantasai@7042 12 type="text/javascript" defer></script
fantasai@7042 13 -->
dbaron@2974 14 </head>
dbaron@2974 15
dbaron@2974 16 <div class="head">
dbaron@2974 17 <!--logo-->
dbaron@2974 18
dbaron@2974 19 <h1>CSS Conditional Rules Module Level 3</h1>
dbaron@2974 20
dbaron@2974 21 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
dbaron@2974 22 <dl>
dbaron@2974 23 <dt>This version:
dbaron@2974 24 <dd><a href="[VERSION]">
dbaron@7372 25 http://www.w3.org/TR/[YEAR]/ED-css3-conditional-[CDATE]/</a>
dbaron@2974 26
dbaron@2974 27 <dt>Latest version:
dbaron@3241 28 <dd><a href="http://www.w3.org/TR/[SHORTNAME]/">http://www.w3.org/TR/[SHORTNAME]/</a>
dbaron@2974 29
dbaron@3245 30 <dt>Editor's draft:
bert@3404 31 <dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
dbaron@3245 32
dbaron@2974 33 <dt>Previous version:
fantasai@6831 34 <dd><a href="http://www.w3.org/TR/2012/WD-css3-conditional-20120911/">http://www.w3.org/TR/2012/WD-css3-conditional-20120911/</a></dd>
dbaron@2974 35
dbaron@2974 36 <dt>Editors:
dbaron@2974 37 <dd class=vcard><a class=fn href="http://dbaron.org/">L. David Baron</a>,
dbaron@6308 38 <a class=org href="http://www.mozilla.org/">Mozilla</a>
dbaron@3744 39
dbaron@3744 40 <dt>Issues list:
dbaron@3744 41 <dd>Maintained in document (only editor's draft is current)
dbaron@3744 42
fantasai@6697 43 <dt>Feedback:
fantasai@6697 44
fantasai@6697 45 <dd><a
fantasai@6697 46 href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
dbaron@6738 47 with subject line “<kbd>&#x5b;[SHORTNAME]&#x5d; <var>… message topic
fantasai@6697 48 …</var></kbd>”
dbaron@3744 49
dbaron@3744 50 <dt>Test suite:
dbaron@6115 51 <dd><a href="https://test.csswg.org/shepherd/search/spec/css3-conditional/">submitted tests</a>; no built test suite yet
dbaron@3744 52
dbaron@2974 53 </dl>
dbaron@2974 54
dbaron@2974 55 <!--copyright-->
dbaron@2974 56
dbaron@2974 57 <hr title="Separator for header">
dbaron@2974 58 </div>
dbaron@2974 59
jackalmage@6617 60 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
dbaron@2974 61
dbaron@2974 62 <p>CSS is a language for describing the rendering of structured documents
dbaron@2974 63 (such as HTML and XML) on screen, on paper, in speech, etc. This module
dbaron@2974 64 contains the features of CSS for conditional processing of parts of
dbaron@2974 65 style sheets, conditioned on capabilities of the processor or the
dbaron@2974 66 document the style sheet is being applied to.
dbaron@2974 67 It includes and extends the functionality of CSS level&nbsp;2 [[!CSS21]],
dbaron@2974 68 which builds on CSS level&nbsp;1 [[CSS1]].
dbaron@2974 69 The main extensions compared to level&nbsp;2 are
dbaron@2983 70 allowing nesting of certain at-rules inside '@media',
jackalmage@6838 71 and the addition of the '@supports'
jackalmage@6838 72 rule for conditional processing.
dbaron@2974 73
jackalmage@6617 74 <h2 class="no-num no-toc" id="status">Status of this document</h2>
dbaron@2974 75
dbaron@2974 76 <!--status-->
dbaron@2974 77
dbaron@2974 78 <p>The following features are at risk:
dbaron@2974 79 <ul>
dbaron@2983 80 <li>The inclusion of '@font-face' rules and
dbaron@2983 81 '@keyframes' rules as allowed within all of the @-rules in
dbaron@2974 82 this specification is at risk, though only because of the relative
dbaron@2974 83 rates of advancement of specifications. If this specification is able
dbaron@2974 84 to advance faster than one or both of the specifications defining
dbaron@2974 85 those rules, then the inclusion of those rules will move from this
dbaron@2974 86 specification to the specification defining those rules.</li>
dbaron@2974 87
dbaron@2974 88 <li>The addition of support for @-rules inside of conditional grouping
dbaron@2974 89 rules is at risk; if interoperable implementations are not found, it
dbaron@2974 90 may be removed to advance the other features in this specification to
dbaron@2974 91 Proposed Recommendation.</li>
dbaron@2974 92
dbaron@2983 93 <li>The '@supports' rule is at risk; if interoperable
dbaron@2974 94 implementations are not found, it may be removed to advance the other
dbaron@2974 95 features in this specification to Proposed Recommendation.</li>
jackalmage@6838 96 </ul>
jackalmage@6837 97
fantasai@7042 98 <p>This is a <strong>Last Call Working Draft</strong>.
dbaron@7122 99 The deadline for comments is <strong>10 January 2013</strong>.
fantasai@7042 100
jackalmage@6838 101 <!--
dbaron@2974 102
jackalmage@6838 103 Things to go in level 4:
jackalmage@6838 104
jackalmage@6838 105 * Create some way to put these new conditional things on an @import.
jackalmage@6838 106 * The @document rule (commented out, down below).
jackalmage@6838 107
jackalmage@6838 108 -->
dbaron@2974 109
jackalmage@6617 110 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
dbaron@2974 111
dbaron@2974 112 <!--toc-->
dbaron@2974 113
jackalmage@6617 114 <h2 id="introduction">Introduction</h2>
dbaron@2974 115
jackalmage@6617 116 <h3 id="context">Background</h3>
dbaron@2974 117
dbaron@2974 118 <p><em>This section is not normative.</em>
dbaron@2974 119
dbaron@2974 120 <p>[[!CSS21]] defines one type of conditional group rule, the
dbaron@2983 121 '@media' rule, and allows only rulesets (not other @-rules)
dbaron@2983 122 inside of it. The '@media' rule provides the ability to
dbaron@2974 123 have media-specific style sheets, which is also provided by style
dbaron@2983 124 sheet linking features such as '@import' and
dbaron@2983 125 <code class="html">&lt;link&gt;</code>. The restrictions on the contents of
dbaron@2983 126 '@media' rules made them less useful; they have forced authors
dbaron@2974 127 using CSS features involving @-rules in media-specific style sheets to
dbaron@2974 128 use separate style sheets for each medium.</p>
dbaron@2974 129
dbaron@2974 130 <p>This specification extends the rules for the contents of
dbaron@2974 131 conditional group rules to allow other @-rules, which enables authors
dbaron@2974 132 to combine CSS features involving @-rules with media specific style
dbaron@2974 133 sheets within a single style sheet.</p>
dbaron@2974 134
jackalmage@6838 135 <p>This specification also defines an additional type of conditional
jackalmage@6838 136 group rule, '@supports', to
dbaron@2974 137 address author and user requirements.</p>
dbaron@2974 138
dbaron@2983 139 <p>The '@supports' rule allows CSS to be conditioned on
dbaron@2974 140 implementation support for CSS properties and values. This rule makes
dbaron@2974 141 it much easier for authors to use new CSS features and provide good
dbaron@2974 142 fallback for implementations that do not support those features. This
dbaron@2974 143 is particularly important for CSS features that provide new layout
dbaron@2974 144 mechanisms, and for other cases where a set of related styles needs to
dbaron@2974 145 be conditioned on property support.</p>
dbaron@2974 146
jackalmage@6617 147 <h3 id="placement">Module Interactions</h3>
dbaron@2974 148
dbaron@2983 149 <p>This module replaces and extends the '@media' rule
dbaron@2974 150 feature defined in [[!CSS21]] section <var>7.2.1</var> and
dbaron@2974 151 incorporates the modifications previously made non-normatively by
dbaron@2974 152 [[!MEDIAQ]] section <var>1</var>.</p>
dbaron@2974 153
dbaron@3462 154 <p>Its current definition depends on @-rules defined in [[!CSS3-FONTS]]
dbaron@2974 155 and [[!CSS3-ANIMATIONS]], but that dependency is only on the
dbaron@2974 156 assumption that those modules will advance ahead of this one. If this
dbaron@2974 157 module advances faster, then the dependency will be reversed.</p>
dbaron@2974 158
jackalmage@6617 159 <h3 id="conventions">Document Conventions</h3>
dbaron@2974 160
dbaron@2974 161 <p>Conformance requirements are expressed with a combination of
dbaron@2974 162 descriptive assertions and RFC 2119 terminology. The key words “MUST”,
dbaron@2974 163 “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
dbaron@2974 164 “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
dbaron@2974 165 document are to be interpreted as described in RFC 2119.
dbaron@2979 166 However, for readability, these words do not appear in all uppercase
dbaron@2979 167 letters in this specification.
dbaron@2974 168
dbaron@2974 169 <p>All of the text of this specification is normative except sections
dbaron@2974 170 explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
dbaron@2974 171
dbaron@2974 172 <p>Examples in this specification are introduced with the words “for example”
dbaron@2983 173 or are set apart from the normative text with
dbaron@2983 174 <code class="html">class="example"</code>, like this:
dbaron@2974 175
dbaron@2974 176 <div class="example">
dbaron@2974 177 <p>This is an example of an informative example.</p>
dbaron@2974 178 </div>
dbaron@2974 179
dbaron@2974 180 <p>Informative notes begin with the word “Note” and are set apart from the
dbaron@2983 181 normative text with <code class="html">class="note"</code>, like this:
dbaron@2974 182
dbaron@2974 183 <p class="note">Note, this is an informative note.</p>
dbaron@2974 184
jackalmage@6617 185 <h2 id="processing">Processing of conditional group rules</h2>
dbaron@2974 186
dbaron@2974 187 <p>This specification defines some CSS @-rules, called <dfn>conditional
dbaron@2974 188 group rules</dfn>, that associate a condition with a group of other
dbaron@2974 189 CSS rules. These different rules allow testing different types of
dbaron@2974 190 conditions, but share common behavior for how their contents are used
dbaron@2974 191 when the condition is true and when the condition is false.</p>
dbaron@2974 192
dbaron@2974 193 <div class="example">
dbaron@2974 194 <p>For example, this rule:</p>
dbaron@2974 195 <pre>@media print {
dbaron@7381 196 /* hide navigation controls when printing */
dbaron@2974 197 #navigation { display: none }
dbaron@2974 198 }</pre>
dbaron@2974 199 <p>causes a particular CSS rule (making elements with ID "navigation" be
dbaron@2974 200 display:none) apply only when the style sheet is used for a print
jackalmage@6838 201 medium.
dbaron@2974 202 </div>
dbaron@2974 203
dbaron@2974 204 <p>Each conditional group rule has a condition, which at any time
dbaron@2974 205 evaluates to true or false. When the condition is true, CSS processors
dbaron@2979 206 <strong>must</strong> apply the rules inside the group rule as though
dbaron@2979 207 they were at the group rule's location; when the condition is false, CSS
dbaron@3948 208 processors <strong>must not</strong> apply any of rules inside the group
dbaron@2979 209 rule. The current state of the condition does not affect the CSS object
dbaron@2979 210 model, in which the contents of the group rule always remain within the
dbaron@2979 211 group rule.</p>
dbaron@2974 212
dbaron@2974 213 <p>This means that when multiple conditional group rules are nested,
dbaron@2974 214 a rule inside of both of them applies only when all of the rules'
dbaron@2974 215 conditions are true.</p>
dbaron@2974 216
dbaron@2974 217 <div class="example">For example, with this set of nested rules:
dbaron@2974 218 <pre>@media print { // rule (1)
dbaron@7381 219 /* hide navigation controls when printing */
dbaron@2974 220 #navigation { display: none }
dbaron@2974 221 @media (max-width: 12cm) { // rule (2)
dbaron@7381 222 /* keep notes in flow when printing to narrow pages */
dbaron@2974 223 .note { float: none }
dbaron@2974 224 }
dbaron@2974 225 }</pre>
dbaron@2974 226 the condition of the rule marked (1) is true for print media, and the
dbaron@2974 227 condition of the rule marked (2) is true when the width of the display
dbaron@2974 228 area (which for print media is the page box) is less than or equal to
dbaron@2983 229 12cm. Thus the rule ''#navigation { display: none }'' applies
dbaron@2974 230 whenever this style sheet is applied to print media, and the rule
dbaron@2983 231 ''.note { float: none }'' is applied only when the style sheet
dbaron@2974 232 is applied to print media <em>and</em> the width of the page box is less
dbaron@2974 233 than or equal to 12 centimeters.</div>
dbaron@2974 234
dbaron@2979 235 <p>When the condition for a conditional group rule changes, CSS
dbaron@2979 236 processors <strong>must</strong> reflect that the rules now apply or no
dbaron@2979 237 longer apply, except for properties whose definitions define effects of
dbaron@2979 238 computed values that persist past the lifetime of that value (such as
dbaron@2979 239 for some properties in [[CSS3-TRANSITIONS]] and
dbaron@2979 240 [[!CSS3-ANIMATIONS]]).</p>
dbaron@2974 241
jackalmage@6617 242 <h2 id="contents-of">Contents of conditional group rules</h2>
dbaron@2974 243
dbaron@2974 244 <p>The syntax of each conditional group rule consists of some syntax
dbaron@2974 245 specific to the type of rule followed by a <dfn>group rule body</dfn>,
dbaron@2974 246 which is a block (pair of braces) containing a sequence of rules.</p>
dbaron@2974 247
dbaron@2974 248 <p>A group rule body is allowed to contain rulesets and any @-rules that
dbaron@2974 249 are allowed at the top level of a style sheet before and after a
dbaron@2974 250 ruleset. This means that @-rules that must occur at the beginning of
dbaron@3020 251 the style sheet (such as '@charset', '@import',
dbaron@3020 252 and '@namespace' rules) are not allowed inside of conditional group
dbaron@2974 253 rules. Conditional group rules can be nested.</p>
dbaron@2974 254
dbaron@2974 255 <p>In terms of the grammar, this specification defines the following
dbaron@2974 256 productions for use in the grammar of conditional group rules:</p>
dbaron@2974 257
dbaron@7032 258 <pre><dfn>nested_statement</dfn>
dbaron@7032 259 : ruleset | <i>media</i> | page | font_face_rule | keyframes_rule |
dbaron@7032 260 <i>supports_rule</i>
dbaron@2974 261 ;
dbaron@2974 262
dbaron@7032 263 <dfn>group_rule_body</dfn>
dbaron@7032 264 : '{' S* <i>nested_statement</i>* '}' S*
dbaron@2974 265 ;</pre>
bert@3404 266 <p>
dbaron@2974 267 in which all the productions are defined in that grammar with the
jackalmage@6839 268 exception of <code>font_face_rule</code>
dbaron@5294 269 defined in [[!CSS3-FONTS]], <code>keyframes_rule</code> defined in
jackalmage@6838 270 [[!CSS3-ANIMATIONS]], and <code>media</code> and <code>supports_rule</code>
jackalmage@6838 271 defined in this specification.</p>
dbaron@2974 272
dbaron@2974 273 <p>In general, future CSS specifications that add new @-rules that are
dbaron@2974 274 not forbidden to occur after some other types of rules should modify
dbaron@2974 275 this <code>nested_statement</code> production to keep the grammar
dbaron@2974 276 accurate.</p>
dbaron@2974 277
dbaron@2979 278 <p>Style sheets <strong>must not</strong> use rules other than the allowed ones inside
dbaron@2974 279 conditional group rules.</p>
dbaron@2974 280
dbaron@3019 281 <p>CSS processors <strong>must</strong> ignore rules that are not
dbaron@3019 282 allowed within a group rule, and <strong>must</strong> handle invalid
dbaron@3019 283 rules inside of group rules as described in <a
dbaron@3019 284 href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">section
dbaron@3019 285 4.2 (Rules for handling parsing errors)</a>, <a
dbaron@3019 286 href="http://www.w3.org/TR/CSS21/syndata.html#at-rules">section 4.1.5
dbaron@3019 287 (At-rules)</a>, and <a
dbaron@3019 288 href="http://www.w3.org/TR/CSS21/syndata.html#rule-sets">section 4.1.7
dbaron@3019 289 (Rule sets, declaration blocks, and selectors)</a> of [[!CSS21]].</p>
dbaron@2974 290
jackalmage@6617 291 <h2 id="use">Placement of conditional group rules</h2>
dbaron@2974 292
dbaron@3019 293 <p>Conditional group rules are allowed at the top-level of a style
dbaron@3019 294 sheet, and inside other conditional group rules. CSS processors
dbaron@3019 295 <strong>must</strong> process such rules as <a
dbaron@3019 296 href="#processing">described above</a>.</p>
dbaron@3019 297
dbaron@3020 298 <p>Any rules that are not allowed after a ruleset (e.g., ''@charset'',
dbaron@3020 299 ''@import'', or ''@namespace'' rules) are also not allowed after a
dbaron@3020 300 conditional group rule. Therefore, style sheets <strong>must
dbaron@3019 301 not</strong> place such rules after a conditional group rules, and CSS
dbaron@3019 302 processors <strong>must</strong> ignore such rules.</p>
dbaron@2974 303
jackalmage@6617 304 <h2 id="at-media">Media-specific style sheets: the '@media' rule</h2>
dbaron@2974 305
dbaron@2983 306 <p>The <dfn>'@media' rule</dfn> is a conditional group rule whose
dbaron@2974 307 condition is a media query. It consists of the at-keyword
jackalmage@6830 308 '@media' followed by a (possibly empty) media query list (as
dbaron@2974 309 defined in [[!MEDIAQ]]), followed by a group rule body. The condition
dbaron@2974 310 of the rule is the result of the media query.</p>
dbaron@2974 311
dbaron@2974 312 <div class="example">
dbaron@2983 313 <p>This '@media' rule:</p>
dbaron@7381 314 <pre>@media screen and (min-width: 35em),
dbaron@7381 315 print and (min-width: 40em) {
dbaron@7381 316 #section_navigation { float: left; width: 10em; }
dbaron@2974 317 }</pre>
dbaron@7381 318 <p>has the condition
dbaron@7381 319 ''screen and (min-width: 35em), print and (min-width: 40em)'',
dbaron@7381 320 which is true for screen displays
dbaron@7381 321 whose viewport is at least 35 times the initial font size
dbaron@7381 322 and for print displays
dbaron@7381 323 whose viewport is at least 40 times the initial font size.
dbaron@7381 324 When either of these is true,
dbaron@7381 325 the condition of the rule is true,
dbaron@7381 326 and the rule
dbaron@7381 327 ''#section_navigation { float: left; width: 10em; }''
dbaron@7381 328 is applied.</p>
dbaron@2974 329 </div>
dbaron@2974 330
dbaron@2974 331 <p>In terms of the grammar, this specification extends the
dbaron@2974 332 <code>media</code> production in the
dbaron@2974 333 <a href="http://www.w3.org/TR/CSS21/grammar.html">Grammar of CSS 2.1</a>
dbaron@2974 334 ([[!CSS21]], Appendix G) into:
dbaron@7032 335 <pre><dfn>media</dfn>
dbaron@7032 336 : MEDIA_SYM S* media_query_list <i>group_rule_body</i>
dbaron@2974 337 ;</pre>
dbaron@2974 338 <p>where the <code>group_rule_body</code> production is defined in this
dbaron@2974 339 specification, the <code>media_query_list</code> production is defined
dbaron@2974 340 in [[!MEDIAQ]], and the others are defined in the <a
dbaron@2974 341 href="http://www.w3.org/TR/CSS21/grammar.html">Grammar of CSS 2.1</a>
dbaron@2974 342 ([[!CSS21]], Appendix G).
dbaron@2974 343
jackalmage@6617 344 <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
dbaron@2974 345
dbaron@2983 346 <p>The <dfn>'@supports' rule</dfn> is a conditional group
dbaron@2974 347 rule whose condition tests whether the user agent supports CSS
dbaron@2974 348 property:value pairs. Authors can use it to write style sheets that use
dbaron@2974 349 new features when available but degrade gracefully when those features
dbaron@2974 350 are not supported. CSS has existing mechanisms for graceful
dbaron@2974 351 degradation, such as ignoring unsupported properties or values, but
dbaron@2974 352 these are not always sufficient when large groups of styles need to be
dbaron@2974 353 tied to the support for certain features, as is the case for use of new
dbaron@2974 354 layout system features.</p>
dbaron@2974 355
dbaron@2983 356 <p>The syntax of the condition in the '@supports' rule is
dbaron@2974 357 slightly more complicated than for the other conditional group rules
dbaron@2974 358 (though has some similarities to media queries) since:</p>
dbaron@2974 359 <ul>
dbaron@2974 360 <li>negation is needed so that the new-feature styles and the fallback
dbaron@2974 361 styles can be separated (within the forward-compatible grammar's rules
dbaron@2974 362 for the syntax of @-rules), and not required to override each other</li>
dbaron@2974 363 <li>conjunction (and) is needed so that multiple required features can
dbaron@2974 364 be tested</li>
dbaron@2974 365 <li>disjunction (or) is needed when there are multiple alternative
dbaron@2974 366 features for a set of styles, particularly when some of those
dbaron@2974 367 alternatives are vendor-prefixed properties or values</li>
dbaron@2974 368 </ul>
dbaron@2974 369
dbaron@2983 370 <p>Therefore, the syntax of the '@supports' rule allows
dbaron@2974 371 testing for property:value pairs, and arbitrary conjunctions (and),
dbaron@2974 372 disjunctions (or), and negations (not) of them.</p>
dbaron@2974 373
dbaron@2974 374 <p>This extends the lexical scanner in the
dbaron@2974 375 <a href="http://www.w3.org/TR/CSS21/grammar.html">Grammar of CSS 2.1</a>
dbaron@2974 376 ([[!CSS21]], Appendix G) by adding:
jackalmage@6832 377 <pre>
jackalmage@6832 378 @{S}{U}{P}{P}{O}{R}{T}{S} {return SUPPORTS_SYM;}
jackalmage@6832 379 {O}{R} {return OR;}
jackalmage@6832 380 </pre>
jackalmage@6943 381
dbaron@2974 382 <p>and the grammar by adding</p>
jackalmage@6943 383
jackalmage@6315 384 <pre><dfn>supports_rule</dfn>
dbaron@7374 385 : SUPPORTS_SYM S* <i>supports_condition</i> S* <i>group_rule_body</i>
dbaron@2974 386 ;
dbaron@2974 387
jackalmage@6315 388 <dfn>supports_condition</dfn>
dbaron@7032 389 : <i>supports_negation</i> | <i>supports_conjunction</i> | <i>supports_disjunction</i> |
dbaron@7032 390 <i>supports_condition_in_parens</i>
dbaron@3957 391 ;
dbaron@3957 392
jackalmage@6315 393 <dfn>supports_condition_in_parens</dfn>
dbaron@7374 394 : ( '(' S* <i>supports_condition</i> S* ')' ) | <i>supports_declaration_condition</i> |
dbaron@7032 395 <i>general_enclosed</i>
dbaron@2974 396 ;
dbaron@2974 397
jackalmage@6315 398 <dfn>supports_negation</dfn>
dbaron@7374 399 : NOT S+ <i>supports_condition_in_parens</i>
dbaron@2974 400 ;
dbaron@2974 401
jackalmage@6315 402 <dfn>supports_conjunction</dfn>
dbaron@7374 403 : <i>supports_condition_in_parens</i> ( S+ AND S+ <i>supports_condition_in_parens</i> )+
dbaron@2974 404 ;
dbaron@2974 405
jackalmage@6315 406 <dfn>supports_disjunction</dfn>
dbaron@7374 407 : <i>supports_condition_in_parens</i> ( S+ OR S+ <i>supports_condition_in_parens</i> )+
dbaron@2974 408 ;
dbaron@2974 409
jackalmage@6315 410 <dfn>supports_declaration_condition</dfn>
dbaron@7374 411 : '(' S* declaration ')'
jackalmage@6943 412 ;
jackalmage@6943 413
dbaron@7031 414 <dfn>general_enclosed</dfn>
dbaron@7374 415 : ( FUNCTION | '(' ) ( any | unused )* ')'
dbaron@7373 416 ;
dbaron@7031 417 </pre>
jackalmage@6943 418
dbaron@7031 419 <p>in which <code>declaration</code>, <code>any</code>, and
dbaron@7031 420 <code>unused</code> are the productions in the core syntax of CSS
dbaron@7031 421 defined in <a
dbaron@3024 422 href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">section
jackalmage@6832 423 4.1.1 (Tokenization)</a> of [[!CSS21]],
jackalmage@6832 424 and the <code>AND</code> and <code>NOT</code> tokens are defined in
jackalmage@6832 425 the Media Queries specification [[!MEDIAQ]].</p>
dbaron@3024 426
dbaron@7031 427 <p>
dbaron@7038 428 Implementations <strong>must</strong> parse ''@supports'' rules
dbaron@7038 429 based on the above grammar,
dbaron@7038 430 and when interpreting the above grammar,
dbaron@7038 431 <strong>must</strong> match the production before an <code>|</code> operator
dbaron@7038 432 in preference to the one after it.
dbaron@7038 433 </p>
dbaron@7038 434
dbaron@7038 435 <p>
dbaron@7031 436 The above grammar is purposely very loose for forwards-compatibility reasons,
dbaron@7031 437 since the <code>general_enclosed</code> production
dbaron@7031 438 allows for substantial future extensibility.
dbaron@7033 439 Any ''@supports'' rule that does not parse according to the grammar above
dbaron@7033 440 (that is, a rule that does not match this loose grammar
dbaron@7033 441 which includes the general_enclosed production)
dbaron@7033 442 is invalid.
dbaron@7031 443 Style sheets <strong>must not</strong> use such a rule and
dbaron@7031 444 processors <strong>must</strong> ignore such a rule (including all of its contents).
dbaron@7031 445
dbaron@3021 446 <p>Each of these grammar terms is associated with a boolean result, as
dbaron@3021 447 follows:</p>
dbaron@2974 448 <dl>
dbaron@2974 449 <dt>supports_condition</dt>
dbaron@2974 450 <dd>
dbaron@3021 451 The result is the result of the single child term.
dbaron@2974 452 </dd>
dbaron@2974 453
dbaron@3957 454 <dt>supports_condition_in_parens</dt>
dbaron@3957 455 <dd>
dbaron@3957 456 The result is the result of the single <code>supports_condition</code>
dbaron@3957 457 or <code>supports_declaration_condition</code> child term.
dbaron@3957 458 </dd>
dbaron@3957 459
dbaron@2974 460 <dt>supports_negation</dt>
dbaron@2974 461 <dd>
dbaron@3021 462 The result is the <em>negation</em> of the result of the
dbaron@3021 463 <code>supports_condition_in_parens</code> child term.
dbaron@2974 464 </dd>
dbaron@2974 465
dbaron@2974 466 <dt>supports_conjunction</dt>
dbaron@2974 467 <dd>
dbaron@3021 468 The result is true if the result of <em>all</em> of the
dbaron@3021 469 <code>supports_condition_in_parens</code> child terms is true;
dbaron@3021 470 otherwise it is false.
dbaron@2974 471 </dd>
dbaron@2974 472
dbaron@2974 473 <dt>supports_disjunction</dt>
dbaron@2974 474 <dd>
dbaron@3021 475 The result is true if the result of <em>any</em> of the
dbaron@3021 476 <code>supports_condition_in_parens</code> child terms is true;
dbaron@3021 477 otherwise it is false.
dbaron@2974 478 </dd>
dbaron@2974 479
dbaron@2974 480 <dt>supports_declaration_condition</dt>
dbaron@2974 481 <dd>
jackalmage@6943 482 The result is whether the CSS processor <a href="#support-definition">supports</a> the declaration
fantasai@6845 483 within the parentheses.
jackalmage@6943 484 </dd>
jackalmage@6943 485
dbaron@7031 486 <dt>general_enclosed</dt>
jackalmage@6943 487 <dd>
jackalmage@6943 488 The result is always false.
dbaron@7031 489 Additionally, style sheets <strong>must not</strong>
dbaron@7031 490 write ''@supports'' rules
dbaron@7031 491 that match this grammar production.
dbaron@7031 492 (In other words, this production exists only for future extensibility,
dbaron@7031 493 and is not part of the description of a valid style sheet
dbaron@7031 494 in this level of the specification.)
dbaron@7031 495 <span class="note">Note that future levels may define functions
dbaron@7031 496 or other parenthesized expressions that can evaluate to true.</span>
dbaron@2974 497 </dd>
fantasai@7034 498 </dl>
jackalmage@6943 499
dbaron@3021 500 <p>The condition of the '@supports' rule is the result of the
dbaron@3021 501 <code>supports_condition</code> term that is a child of the
dbaron@3021 502 <code>supports_rule</code> term.</p>
dbaron@2974 503
dbaron@2982 504 <div class="example">
dbaron@2982 505 <p>For example, the following rule</p>
dbaron@2982 506 <pre>@supports ( display: flexbox ) {
dbaron@2982 507 body, #navigation, #content { display: flexbox; }
dbaron@2982 508 #navigation { background: blue; color: white; }
dbaron@2982 509 #article { background: white; color: black; }
dbaron@2982 510 }</pre>
dbaron@2983 511 <p>applies the rules inside the '@supports' rule only when
dbaron@2983 512 ''display: flexbox'' is supported.</p>
dbaron@2982 513 </div>
dbaron@2974 514
dbaron@2982 515 <div class="example">
dbaron@2982 516 <p>The following example shows an additional '@supports' rule that can
dbaron@2982 517 be used to provide an alternative for when ''display: flexbox'' is not
dbaron@2982 518 supported:</p>
dbaron@2982 519 <pre>@supports not ( display: flexbox ) {
dbaron@2982 520 body { width: 100%; height: 100%; background: white; color: black; }
dbaron@2982 521 #navigation { width: 25%; }
dbaron@2982 522 #article { width: 75%; }
dbaron@2974 523 }</pre>
dbaron@2982 524 <p>Note that the 'width' declarations may be harmful to the
dbaron@2982 525 flexbox-based layout, so it is important that they be present only in
dbaron@2982 526 the non-flexbox styles.</p>
dbaron@2982 527 </div>
dbaron@2974 528
dbaron@2982 529 <div class="example">
dbaron@2982 530 <p>The following example checks for support for the 'box-shadow'
dbaron@2982 531 property, including checking for support for vendor-prefixed versions of
dbaron@2982 532 it. When the support is present, it specifies both 'box-shadow' (with
dbaron@2982 533 the prefixed versions) and 'color' in a way what would cause the text to
dbaron@2982 534 become invisible were 'box-shadow' not supported.</p>
dbaron@2982 535 <pre>@supports ( box-shadow: 2px 2px 2px black ) or
dbaron@2982 536 ( -moz-box-shadow: 2px 2px 2px black ) or
dbaron@2974 537 ( -webkit-box-shadow: 2px 2px 2px black ) or
dbaron@2974 538 ( -o-box-shadow: 2px 2px 2px black ) {
dbaron@2982 539 .outline {
dbaron@2982 540 color: white;
dbaron@2982 541 -moz-box-shadow: 2px 2px 2px black;
dbaron@2982 542 -webkit-box-shadow: 2px 2px 2px black;
dbaron@2982 543 -o-box-shadow: 2px 2px 2px black;
dbaron@3960 544 box-shadow: 2px 2px 2px black; /* unprefixed last */
dbaron@2982 545 }
dbaron@2982 546 }</pre></div>
dbaron@2974 547
dbaron@2984 548 <p>To avoid confusion between ''and'' and ''or'', the syntax requires
dbaron@2984 549 that both ''and'' and ''or'' be specified explicitly (rather than, say,
dbaron@2984 550 using commas or spaces for one of them). Likewise, to avoid confusion
dbaron@2984 551 caused by precedence rules, the syntax does not allow ''and'', ''or'',
dbaron@2984 552 and ''not'' operators to be mixed without a layer of parentheses.</p>
dbaron@2974 553
dbaron@2984 554 <div class="example">
dbaron@2984 555 <p>For example, the following rule is not valid:
dbaron@3959 556 <pre class="illegal">@supports (transition-property: color) or
dbaron@2984 557 (animation-name: foo) and
dbaron@2984 558 (transform: rotate(10deg)) {
dbaron@2984 559 // ...
dbaron@2984 560 }</pre>
dbaron@2984 561 <p>Instead, authors must write one of the following:</p>
dbaron@2984 562 <pre>@supports ((transition-property: color) or
dbaron@2984 563 (animation-name: foo)) and
dbaron@2984 564 (transform: rotate(10deg)) {
dbaron@2984 565 // ...
dbaron@2984 566 }</pre>
dbaron@2984 567 <pre>@supports (transition-property: color) or
dbaron@3430 568 ((animation-name: foo) and
dbaron@2984 569 (transform: rotate(10deg))) {
dbaron@2984 570 // ...
dbaron@2984 571 }</pre>
dbaron@2984 572 </div>
dbaron@2974 573
dbaron@7374 574 <p>Furthermore, whitespace is required after a ''not'' and on both
dbaron@7374 575 sides of an ''and'' or ''or''.</p>
dbaron@7374 576
dbaron@3957 577 <p>The declaration being tested must always occur within parentheses,
dbaron@3957 578 when it is the only thing in the expression.<p>
dbaron@3957 579
dbaron@3957 580 <div class="example">
dbaron@3957 581 <p>For example, the following rule is not valid:
dbaron@3959 582 <pre class="illegal">@supports display: flexbox {
dbaron@3957 583 // ...
dbaron@3957 584 }</pre>
dbaron@3957 585 <p>Instead, authors must write:</p>
dbaron@3957 586 <pre>@supports (display: flexbox) {
dbaron@3957 587 // ...
dbaron@3957 588 }</pre>
dbaron@3957 589 </div>
dbaron@3957 590
dbaron@3957 591 <p>The syntax allows extra parentheses when they are not needed. This
dbaron@3957 592 flexibility is sometimes useful for authors (for example, when
dbaron@3957 593 commenting out parts of an expression) and may also be useful for
dbaron@3957 594 authoring tools.</p>
dbaron@3957 595
dbaron@3957 596 <div class="example">
dbaron@3957 597 <p>For example, authors may write:</p>
dbaron@3957 598 <pre>@supports ((display: flexbox)) {
dbaron@3957 599 // ...
dbaron@3957 600 }</pre>
dbaron@3957 601 </div>
dbaron@3957 602
jackalmage@6793 603 <p>A trailing ''!important'' on a declaration being tested is allowed,
jackalmage@6793 604 though it won't change the validity of the declaration.
jackalmage@6793 605
jackalmage@6793 606 <div class="example">
jackalmage@6793 607 <p>For example, the following rule is valid:
jackalmage@6793 608 <pre>@supports (display: flexbox !important) {
jackalmage@6793 609 // ...
jackalmage@6793 610 }</pre>
jackalmage@6793 611 </div>
dbaron@6306 612
jackalmage@6617 613 <h3 id="support-definition">Definition of support</h3>
dbaron@3021 614
dbaron@6741 615 <p>For forward-compatibility,
dbaron@6741 616 <a href="http://www.w3.org/TR/CSS21/syndata.html#declaration">section 4.1.8
dbaron@6741 617 (Declarations and properties)</a> of [[!CSS21]]
dbaron@6741 618 defines rules for handling invalid properties and values.
dbaron@6741 619 CSS processors that
dbaron@6741 620 do not implement or partially implement a specification
dbaron@6741 621 <strong>must</strong> treat any part of a value that they
dbaron@6741 622 do not implement, or
dbaron@6741 623 do not have a usable level of support for,
dbaron@6741 624 as invalid according to this rule
dbaron@6741 625 for handling invalid properties and values,
dbaron@6741 626 and therefore <strong>must</strong> discard the declaration as a parse error.</p>
dbaron@6741 627
jackalmage@6617 628 <p>A CSS processor is considered to <dfn id="dfn-support">support</dfn>
dbaron@6741 629 a declaration (consisting of a property and value) if it accepts that
dbaron@6741 630 declaration (rather than discarding it as a parse error).
dbaron@6741 631 If a processor does not implement, with a usable level of support,
dbaron@6741 632 the value given,
dbaron@6741 633 then it <strong>must not</strong>
dbaron@6741 634 accept the declaration or claim support for it.</p>
dbaron@3021 635
dbaron@7382 636 <p class="note">Note that properties or values
dbaron@7382 637 whose support is effectively disabled by user preferences
dbaron@7382 638 are still considered as supported by this definition.
dbaron@7382 639 For example, if a user has enabled a high-contrast mode
dbaron@7382 640 that causes colors to be overridden,
dbaron@7382 641 the CSS processor is still considered to support the 'color' property
dbaron@7382 642 even though declarations of the 'color' property may have no effect.
dbaron@7382 643 On the other hand, a developer-facing preference
dbaron@7382 644 whose purpose is to enable or disable support for an experimental CSS feature
dbaron@7382 645 does affect this definition of support.</p>
dbaron@7382 646
dbaron@6742 647 <p>These rules (and the equivalence between them) allow
dbaron@3021 648 authors to use fallback (either in the [[CSS1]] sense of declarations
dbaron@3021 649 that are overridden by later declarations or with the new capabilities
dbaron@3021 650 provided by the ''@supports'' rule in this specification) that works
dbaron@3021 651 correctly for the features implemented. This applies especially to
dbaron@3021 652 compound values; implementations must implement all parts of the value
dbaron@3021 653 in order to consider the declaration supported, either inside a ruleset
dbaron@3021 654 or in the declaration condition of an ''@supports'' rule.</p>
dbaron@3021 655
jackalmage@6838 656 <!--
jackalmage@6617 657 <h2 id="at-document">Document queries: the '@document' rule</h2>
dbaron@2974 658
dbaron@2983 659 <p>The <dfn>'@document' rule</dfn> is a conditional group
dbaron@3027 660 rule whose condition depends on the
dbaron@3027 661 <a href="#url-of-doc">URL of the document being styled</a>.
dbaron@2974 662 This allows style sheets, particularly user style sheets, to have styles
dbaron@2974 663 that only apply to a set of pages rather than to all pages using the
dbaron@2974 664 style sheet.</p>
dbaron@2974 665
dbaron@2974 666 <p class="issue">Given that this @-rule is intended primarily for user
dbaron@2974 667 style sheets, what should this specification say about its use in author
dbaron@2974 668 style sheets? Should it be forbidden? Should use instead be
dbaron@2974 669 discouraged? Or should this specification remain neutral on the
dbaron@2986 670 topic, since there are valid uses in author style sheets?</p>
dbaron@2974 671
jackalmage@6617 672 <p id="url-of-doc">The <dfn>URL of the document being styled</dfn> is
dbaron@3027 673 the URI at which the document is located, excluding any fragment
dbaron@3027 674 identifiers. (This means, for example, that HTTP redirects have been
dbaron@3027 675 followed.) If the styles are being applied inside a complete document
dbaron@3246 676 embedded into the presentation of another (e.g., [[HTML5]]&#39;s <code
dbaron@3027 677 class="html">iframe</code>, <code class="html">object</code>, or <code
dbaron@3027 678 class="html">img</code> elements), the relevant URI is that of the
dbaron@3027 679 frame, not of its container. However, if content from other documents
dbaron@3027 680 is mixed in via mechanisms that mix content from one document into
dbaron@3246 681 another (e.g., [[SVG11]]&#39;s <code>use</code> element), then the
dbaron@3027 682 address of the container document is used.</p>
dbaron@3027 683
dbaron@3027 684 <p class="note">Note: In [[HTML5]], this is the
fantasai@6697 685 <a href="http://dev.w3.org/html5/spec/dom.html#documents">document's address</a>
dbaron@3027 686 of a document in a
dbaron@3027 687 <a href="http://dev.w3.org/html5/spec/browsers.html#browsing-context">browsing context</a>.</p>
dbaron@3027 688
dbaron@3240 689 <div class="issue">What form of normalization is done on URLs and domains
dbaron@3240 690 before matching? In particular, this specification needs to describe:
dbaron@3240 691 <ul>
dbaron@3240 692 <li>what form is used for the <a href="#url-of-doc">URL of the document
dbaron@3240 693 being styled</a> (and what has been normalized in that form)</li>
dbaron@3240 694 <li>what normalization (if any) happens to the argument of each of the match
dbaron@3240 695 functions before the comparison that they describe and</li>
dbaron@3240 696 <li>whether the
dbaron@3240 697 comparison algorithm used is string comparison or some other URL
dbaron@3240 698 comparison algorithm.</li></ul></div>
dbaron@3027 699
dbaron@2983 700 <p>The '@document' rule's condition is written as a
dbaron@2974 701 comma-separated list of <dfn>URL matching functions</dfn>, and the
dbaron@2974 702 condition evaluates to true whenever any one of those functions
dbaron@2974 703 evaluates to true. The following URL matching functions are
dbaron@2974 704 permitted:</p>
dbaron@2974 705
dbaron@2974 706 <dl>
jackalmage@6617 707 <dt><dfn id="url-exact" title="url()|URL matching functions::exact">&lt;url&gt;</dfn></dt>
dbaron@2974 708
dbaron@2974 709 <dd>
dbaron@2983 710 <p>The 'url()' function is the <dfn>exact url matching
dbaron@3027 711 function</dfn>. It evaluates to true whenever the <a
dbaron@3027 712 href="#url-of-doc">URL of the document being styled</a> is exactly
dbaron@3027 713 the URL given.</p>
dbaron@2974 714
dbaron@2983 715 <p class="Note">The 'url()' function, since it is a core syntax
dbaron@2974 716 element in CSS, is allowed (subject to different character
dbaron@2974 717 limitations and thus escaping requirements) to contain an unquoted
dbaron@2974 718 value (in addition to the string values that are allowed as
dbaron@2974 719 arguments for all four functions).</p>
dbaron@2974 720
dbaron@2974 721 <div class="example">
dbaron@2974 722 <p>For example, this rule:</p>
dbaron@2974 723 <pre>@document url("http://www.w3.org/Style/CSS/") {
dbaron@2974 724 #summary { background: yellow; color: black}
dbaron@2974 725 }</pre>
dbaron@2983 726 <p>styles the <code class="html">summary</code> element on the page
dbaron@2974 727 <code>http://www.w3.org/Style/CSS/</code>, but not on any other
dbaron@2974 728 pages.</p>
dbaron@2974 729 </div>
dbaron@2974 730 </dd>
dbaron@2974 731
jackalmage@6617 732 <dt><dfn id="url-prefix" title="url-prefix()|URL matching functions::prefix">url-prefix(&lt;string&gt;)</dfn></dt>
dbaron@2974 733
dbaron@2974 734 <dd>
dbaron@2983 735 <p>The 'url-prefix()' function is the <dfn>url prefix
dbaron@3027 736 matching function</dfn>. It evaluates to true whenever the
dbaron@3027 737 <a href="#url-of-doc">URL of the document being styled</a>
dbaron@3027 738 has the argument to the function as an
dbaron@2974 739 initial substring (which is true when the two strings are equal).
dbaron@2974 740 When the argument is the empty string, it evaluates to true for all
dbaron@2974 741 documents.</p>
dbaron@2974 742 <div class="example">
dbaron@2974 743 <p>For example, this rule:</p>
dbaron@2974 744 <pre>@document url-prefix("http://www.w3.org/Style/CSS/") {
dbaron@2974 745 #summary { background: yellow; color: black}
dbaron@2974 746 }</pre>
dbaron@2983 747 <p>styles the <code class="html">summary</code> element on the page
dbaron@2974 748 <code>http://www.w3.org/Style/CSS/</code> and on the page
dbaron@2974 749 <code>http://www.w3.org/Style/CSS/Test</code>, but it does not
dbaron@2974 750 affect the page <code>http://www.w3.org/</code> or the page
dbaron@2974 751 <code>http://www.example.com/Style/CSS/</code>.</p>
dbaron@2974 752 </div>
dbaron@2974 753 </dd>
dbaron@2974 754
jackalmage@6617 755 <dt><dfn id="url-domain" title="domain()|URL matching functions::domain">domain(&lt;string&gt;)</dfn></dt>
dbaron@2974 756
dbaron@2974 757 <dd>
dbaron@2983 758 <p>The 'domain()' function is the <dfn>domain
dbaron@2974 759 matching function</dfn>. It evaluates to true whenever
dbaron@3027 760 the <a href="#url-of-doc">URL of the document being styled</a>
dbaron@3027 761 has a host subcomponent (as defined in [[!URI]])
dbaron@2974 762 and that host subcomponent is exactly the argument to the
dbaron@2983 763 'domain()' function or a final substring of the host
dbaron@2974 764 component is a period (U+002E) immediately followed by the argument
dbaron@2983 765 to the 'domain()' function.</p>
dbaron@2974 766 <div class="example">
dbaron@2974 767 <p>For example, this rule:</p>
dbaron@2974 768 <pre>@document domain("w3.org") {
dbaron@2974 769 body { font-size: 16px ! important }
dbaron@2974 770 }</pre>
dbaron@2974 771 <p>changes the font size of the body element for pages such as
dbaron@2974 772 <code>http://www.w3.org/Style/CSS/</code> and
dbaron@2974 773 <code>http://w3.org/Style/CSS/</code> and
dbaron@2974 774 <code>http://lists.w3.org/Archives/Public/www-style/</code>
dbaron@2974 775 but it does not affect the page
dbaron@2974 776 <code>http://www.example.com/Style/CSS/</code>.</p>
dbaron@2974 777 </div>
dbaron@2974 778 </dd>
dbaron@2974 779
jackalmage@6617 780 <dt><dfn id="url-regexp" title="regexp()|URL matching functions::regular expression">regexp(&lt;string&gt;)</dfn></dt>
dbaron@2974 781
dbaron@2974 782 <dd>
dbaron@2986 783 <p>The contents of the &lt;string&gt; argument <strong>must</strong>
dbaron@3068 784 match the JavaScript <code>Pattern</code> production
dbaron@3068 785 ([[!ECMA-262-5.1]], section 15.10.1). However,
dbaron@2986 786 failing to do so is not a CSS syntax error and does not trigger any
dbaron@2986 787 error handling for CSS syntax errors.</p>
dbaron@2986 788
dbaron@2986 789 <p>The ''regexp()'' function evaluates to true whenever the string
dbaron@2986 790 argument compiled as a JavaScript regular expression with the
dbaron@2986 791 <code>global</code>, <code>ignoreCase</code> and
dbaron@2986 792 <code>multiline</code> flags <em>disabled</em>
dbaron@3068 793 (see [[!ECMA-262-5.1]], sections 15.10.7.2 through 15.10.7.4)
dbaron@2986 794 compiles successfully and the resulting regular expression matches
dbaron@3027 795 the entirety of the
dbaron@3027 796 <a href="#url-of-doc">URL of the document being styled</a>.</p>
dbaron@2986 797
dbaron@2986 798 <p class="note">Note that regular expression must match the entire
dbaron@2986 799 URL, not just a part of it.</p>
dbaron@2974 800
dbaron@3018 801 <p class="note">Note that this definition intentionally matches the
dbaron@3018 802 behavior of the <a
dbaron@2983 803 href="http://dev.w3.org/html5/spec/common-input-element-attributes.html#attr-input-pattern"><code class="html">pattern</code>
dbaron@2983 804 attribute</a> on the <code class="html">input</code> element
dbaron@2983 805 in [[HTML5]].</p>
dbaron@2986 806
dbaron@2986 807 <div class="example">
dbaron@2986 808 <p>For example, this rule:</p>
dbaron@2986 809 <pre>@document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") {
dbaron@2986 810 body { font-size: 20px ! important }
dbaron@2986 811 }</pre>
dbaron@2986 812 <p>changes the font size of the body element for pages such as
dbaron@2986 813 <code>http://www.w3.org/TR/2011/PR-CSS2-20110412/</code>.</p>
dbaron@2986 814 <p class="note">Note that the backslashes in the regular
dbaron@2986 815 expression require CSS escaping as ''\\''.</p>
dbaron@2986 816 </div>
dbaron@2974 817 </dd>
dbaron@2974 818
dbaron@2974 819 </dl>
dbaron@2974 820
dbaron@2979 821 <p>Implementations <strong>must</strong> treat any unknown URL matching
dbaron@3045 822 functions as a syntax error, and thus ignore the '@document' rule.
dbaron@3045 823 <span class="issue">Should we instead have more complicated error
dbaron@3045 824 handling rules to make forward-compatibility work differently, or is
dbaron@3045 825 this rule the best solution for such future expansion anyway?</span></p>
dbaron@2974 826
dbaron@5293 827 <div class="issue">This syntax doesn't offer any ability to do negations,
dbaron@5293 828 which has been requested in <a
jackalmage@6617 829 href="https://bugzilla.mozilla.org/show_bug.cgi?id=349813">Mozilla bug
dbaron@5293 830 349813</a>. Use cases that people have wanted negations for
dbaron@5293 831 include:
dbaron@5293 832 <ul>
dbaron@5293 833 <li>User style sheets that want a particular rule in general, but know
dbaron@5293 834 that that rule does more harm than good on specific sites.</li>
dbaron@5293 835 <li>Authors who have a rule that they want to apply to most of their
dbaron@5293 836 pages, but wish to make a few exceptions for.</li>
dbaron@5293 837 </ul>
dbaron@5293 838 </div>
dbaron@5293 839
dbaron@2974 840 <p>This extends the lexical scanner in the
dbaron@2974 841 <a href="http://www.w3.org/TR/CSS21/grammar.html">Grammar of CSS 2.1</a>
dbaron@2974 842 ([[!CSS21]], Appendix G) by adding:
dbaron@2974 843 <pre>@{D}{O}{C}{U}{M}{E}{N}{T} {return DOCUMENT_SYM;}</pre>
dbaron@2974 844 <p>and the grammar by adding</p>
dbaron@7032 845 <pre><dfn>document_rule</dfn>
dbaron@7032 846 : DOCUMENT_SYM S+ <i>url_match_fn</i> ( "," S* <i>url_match_fn</i> )* <i>group_rule_body</i>
dbaron@2974 847 ;
dbaron@2974 848
dbaron@7032 849 <dfn>url_match_fn</dfn>
dbaron@6740 850 : (URI | FUNCTION S* STRING S* ')' ) S*
dbaron@2974 851 ;</pre>
jackalmage@6838 852 -->
jackalmage@6838 853
dbaron@2974 854
jackalmage@6617 855 <h2 id="apis">APIs</h2>
dbaron@3416 856
jackalmage@6617 857 <h3 id='extentions-to-cssrule-interface'>
jackalmage@6315 858 Extensions to the <code>CSSRule</code> interface</h3>
dbaron@3416 859
jackalmage@6315 860 <p>The <code>CSSRule</code> interface is extended as follows:
jackalmage@6315 861
jackalmage@6315 862 <pre class='idl'>partial interface CSSRule {
jackalmage@6315 863 const unsigned short SUPPORTS_RULE = 12;
jackalmage@6838 864 <!--
jackalmage@6315 865 const unsigned short DOCUMENT_RULE = 13;
jackalmage@6838 866 -->
jackalmage@6315 867 }</pre>
jackalmage@6315 868
jackalmage@6315 869
jackalmage@6655 870 <h3 id='the-cssgroupingrule-interface'>
jackalmage@6655 871 The <code>CSSGroupingRule</code> interface</h3>
jackalmage@6655 872
jackalmage@6655 873 <p>The <dfn><code>CSSGroupingRule</code></dfn> interface represents an at-rule that contains other rules nested inside itself.
jackalmage@6655 874
jackalmage@6655 875 <pre class='idl'>interface CSSGroupingRule : CSSRule {
dbaron@7102 876 readonly attribute <a href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRuleList">CSSRuleList</a> cssRules;
jackalmage@6655 877 unsigned long insertRule (DOMString rule, unsigned long index);
jackalmage@6655 878 void deleteRule (unsigned long index);
jackalmage@6655 879 }</pre>
jackalmage@6655 880
jackalmage@6655 881 <dl class='idl-attributes'>
dbaron@7102 882 <dt><code>cssRules</code> of type <code><a href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRuleList">CSSRuleList</a></code>, readonly
jackalmage@6655 883 <dd>The <code>cssRules</code> attribute must return a <code>CSSRuleList</code>
jackalmage@6655 884 object for the list of CSS rules nested inside the grouping rule.
jackalmage@6655 885 </dl>
jackalmage@6655 886
jackalmage@6655 887 <dl class='idl-methods'>
jackalmage@6655 888 <dt><code>insertRule(DOMString rule, unsigned long index)</code>, returns
jackalmage@6655 889 <code>unsigned long</code>
dbaron@7104 890 <dd>
dbaron@7104 891 The <code>insertRule</code> operation must
dbaron@7104 892 insert a CSS rule <var>rule</var>
dbaron@7104 893 into the CSS rule list returned by <code>cssRules</code>,
dbaron@7104 894 such that the inserted rule will be at position <var>index</var>,
dbaron@7104 895 and any rules previously at <var>index</var> or higher
dbaron@7104 896 will increase their index by one.
dbaron@7104 897 It must throw INDEX_SIZE_ERR
dbaron@7104 898 if index is greater than <code>cssRules.length</code>.
dbaron@7104 899 It must throw SYNTAX_ERR
dbaron@7104 900 if the rule has a syntax error and is unparseable;
dbaron@7104 901 this does not include syntax errors handled by error handling rules
dbaron@7104 902 for constructs inside of the rule.
dbaron@7104 903 It must throw HIERARCHY_REQUEST_ERR
dbaron@7104 904 if the rule cannot be inserted at the location specified,
dbaron@7104 905 for example, if an ''@import'' rule is inserted inside a group rule.
dbaron@7104 906
dbaron@7104 907 <span class="issue">This needs to specify what to do
dbaron@7104 908 if <code>rule</code> is the empty string,
dbaron@7104 909 if it contains more than one CSS rule,
dbaron@7104 910 or if it contains garbage after a valid rule.</span>
jackalmage@6655 911
jackalmage@6655 912 <dt><code>deleteRule (unsigned long index)</code>, return <code>void</code>
dbaron@7104 913 <dd>
dbaron@7104 914 The <code>deleteRule</code> operation must
dbaron@7104 915 remove a CSS rule from
dbaron@7104 916 the CSS rule list returned by <code>cssRules</code> at <var>index</var>.
dbaron@7104 917 It must throw INDEX_SIZE_ERR
dbaron@7104 918 if index is greater than or equal to <code>cssRules.length</code>.
jackalmage@6655 919 </dl>
jackalmage@6655 920
jackalmage@6655 921
jackalmage@6618 922 <h3 id="the-cssconditionrule-interface">
jackalmage@6618 923 The <code>CSSConditionRule</code> interface</h3>
jackalmage@6315 924
jackalmage@6620 925 <p>The <dfn><code>CSSConditionRule</code></dfn> interface represents all the "conditional" at-rules,
jackalmage@6620 926 which consist of a condition and a statement block.
dbaron@6323 927
jackalmage@6655 928 <pre class='idl'>interface CSSConditionRule : CSSGroupingRule {
dbaron@6324 929 attribute DOMString conditionText;
jackalmage@6315 930 }</pre>
jackalmage@6315 931
jackalmage@6315 932 <dl class='idl-attributes'>
dbaron@6732 933
jackalmage@6619 934 <dt><code>conditionText</code> of type <code>DOMString</code>
dbaron@6732 935 <dd>
dbaron@6732 936 <p>The <code>conditionText</code> attribute represents
dbaron@6732 937 the condition of the rule.
dbaron@6732 938 Since what this condition does
dbaron@6732 939 varies between the derived interfaces of <code>CSSConditionRule</code>,
dbaron@6732 940 those derived interfaces
dbaron@6732 941 may specify different behavior for this attribute
dbaron@6732 942 (see, for example, <code>CSSMediaRule</code> below).
dbaron@6732 943 In the absence of such rule-specific behavior,
dbaron@6732 944 the following rules apply:</p>
dbaron@6732 945
dbaron@6732 946 <p>The <code>conditionText</code> attribute, on getting, must return
jackalmage@6618 947 the result of serializing the associated condition.
jackalmage@6315 948
dbaron@6324 949 <p>On setting the <code>conditionText</code> attribute these steps
jackalmage@6315 950 must be run:
jackalmage@6315 951
jackalmage@6315 952 <ol>
jackalmage@6315 953 <li>Trim the given value of white space.
jackalmage@6315 954 <li>If the given value matches the grammar of the
jackalmage@6618 955 appropriate condition production for the given rule,
jackalmage@6618 956 replace the associated CSS condition with the given value.
jackalmage@6315 957 <li>Otherwise, do nothing.
jackalmage@6315 958 </ol>
jackalmage@6315 959 </dl>
jackalmage@6315 960
jackalmage@6618 961
jackalmage@6618 962 <h3 id="the-cssmediarule-interface">
jackalmage@6618 963 The <code>CSSMediaRule</code> interface</h3>
jackalmage@6618 964
jackalmage@6618 965 <p>The <dfn><code>CSSMediaRule</code></dfn> interface represents a ''@media'' rule:
jackalmage@6618 966
jackalmage@6618 967 <pre class='idl'>interface CSSMediaRule : CSSConditionRule {
dbaron@7102 968 readonly attribute <a href="http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-MediaList">MediaList</a> media;
jackalmage@6618 969 }</pre>
jackalmage@6618 970
jackalmage@6618 971 <dl class='idl-attributes'>
dbaron@7102 972 <dt><code>media</code> of type <code><a href="http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-MediaList">MediaList</a></code>, readonly
jackalmage@6618 973 <dd>The <code>media</code> attribute must return a <code>MediaList</code> object
jackalmage@6618 974 for the list of media queries specified with the ''@media'' rule.
jackalmage@6618 975
dbaron@7387 976 <dt><code>conditionText</code> of type <code>DOMString</code> (CSSMediaRule-specific definition for attribute on CSSConditionRule)
jackalmage@6618 977 <dd>The <code>conditionText</code> attribute (defined on the <code>CSSConditionRule</code> parent rule),
jackalmage@6618 978 on getting, must return the value of <code>media.mediaText</code> on the rule.
jackalmage@6618 979
jackalmage@6621 980 <p>Setting the <code>conditionText</code> attribute
jackalmage@6621 981 must set the <code>media.mediaText</code> attribute on the rule.
jackalmage@6621 982 </dl>
jackalmage@6618 983
jackalmage@6618 984
jackalmage@6618 985 <h3 id="the-csssupportsrule-interface">
jackalmage@6618 986 The <code>CSSSupportsRule</code> interface</h3>
jackalmage@6618 987
jackalmage@6618 988 <p>The <dfn><code>CSSSupportsRule</code></dfn> interface represents a ''@supports'' rule.</p>
jackalmage@6618 989
jackalmage@6621 990 <pre class='idl'>interface CSSSupportsRule : CSSConditionRule {
jackalmage@6618 991 }</pre>
jackalmage@6618 992
dbaron@7387 993 <dl class='idl-attributes'>
dbaron@7387 994 <dt><code>conditionText</code> of type <code>DOMString</code> (CSSSupportsRule-specific definition for attribute on CSSConditionRule)
dbaron@7387 995 <dd>The <code>conditionText</code> attribute (defined on the <code>CSSConditionRule</code> parent rule),
dbaron@7387 996 on getting, must return the condition that was specified,
dbaron@7387 997 without any logical simplifications,
dbaron@7387 998 so that the returned condition will evaluate to the same result
dbaron@7387 999 as the specified condition
dbaron@7387 1000 in any conformant implementation of this specification
dbaron@7387 1001 (including implementations that implement future extensions
dbaron@7387 1002 allowed by the <i>general_enclosed</i> exensibility mechanism in this specification).
dbaron@7387 1003 In other words,
dbaron@7387 1004 token stream simplifications are allowed
dbaron@7387 1005 (such as reducing whitespace to a single space
dbaron@7387 1006 or omitting it in cases where it is known to be optional),
dbaron@7387 1007 but logical simplifications are not allowed.
dbaron@7387 1008
dbaron@7387 1009 </dl>
dbaron@7387 1010
jackalmage@6838 1011 <!--
jackalmage@6618 1012 <h3 id="the-cssdocumentrule-interface">
jackalmage@6618 1013 The <code>CSSDocumentRule</code> interface</h3>
jackalmage@6618 1014
jackalmage@6618 1015 <p>The <dfn><code>CSSDocumentRule</code></dfn> interface represents a ''@document'' rule.</p>
jackalmage@6618 1016
jackalmage@6621 1017 <pre class='idl'>interface CSSDocumentRule : CSSConditionRule {
jackalmage@6618 1018 }</pre>
jackalmage@6838 1019 -->
jackalmage@6315 1020
jackalmage@6315 1021
jackalmage@6620 1022 <h3 id='the-css-interface'>
jackalmage@6620 1023 The <code>CSS</code> interface, and the <code title=''>supports()</code> function</h3>
jackalmage@6315 1024
jackalmage@6620 1025 <p>The <dfn id='CSS-interface'><code>CSS</code></dfn> interface holds useful CSS-related functions that do not belong elsewhere.
jackalmage@6315 1026
jackalmage@6620 1027 <pre class='idl'>interface CSS {
dbaron@7043 1028 static boolean supports(DOMString property, DOMString value);
dbaron@7105 1029 static boolean supports(DOMString conditionText);
jackalmage@6620 1030 }</pre>
jackalmage@6620 1031
jackalmage@6620 1032 <dl class='idl-methods'>
jackalmage@6620 1033 <dt><code>supports(DOMString property, DOMString value)</code>,
jackalmage@6620 1034 returns <code>boolean</code>
jackalmage@6625 1035 <dt><code>supports(DOMString conditionText)</code>,
jackalmage@6620 1036 returns <code>boolean</code>
jackalmage@6620 1037 <dd>
jackalmage@6620 1038 When the <code title=''>supports()</code> method is invoked with two arguments <var>property</var> and <var>value</var>,
jackalmage@6620 1039 it must return <code>true</code> if <var>property</var> is a literal match for the name of a CSS property that the UA supports,
jackalmage@6620 1040 and <var>value</var> would be successfully parsed as a supported value for that property.
jackalmage@6620 1041 Otherwise, it must return <code>false</code>.
jackalmage@6620 1042
jackalmage@6620 1043 <p>
jackalmage@6625 1044 When invoked with a single <var>conditionText</var> argument,
jackalmage@6625 1045 it must return <code>true</code> if <var>conditionText</var>,
jackalmage@6625 1046 when parsed and evaluated as a <code>supports_condition</code>,
jackalmage@6625 1047 would return true.
jackalmage@6620 1048 Otherwise, it must return <code>false</code>.
jackalmage@6620 1049 </dl>
jackalmage@6620 1050
dbaron@3417 1051
fantasai@6831 1052 <h2 class=no-num id="grammar">Grammar</h2>
fantasai@6831 1053
fantasai@6831 1054 <p>In order to allow these new @-rules in CSS style sheets, this
fantasai@6831 1055 specification modifies the <code>stylesheet</code> production in the <a
fantasai@6831 1056 href="http://www.w3.org/TR/CSS21/grammar.html">Appendix G</a> grammar of
fantasai@6831 1057 [[!CSS21]] by replacing the <code>media</code> production defined in
fantasai@6831 1058 [[!CSS21]] with the <code>media</code> production defined in this one,
jackalmage@6838 1059 and additionally inserting <code>| supports_rule</code>
fantasai@6831 1060 alongside <code>ruleset | media | page</code>.</p>
fantasai@6831 1061
fantasai@6831 1062
jackalmage@6617 1063 <h2 id="conformance">Conformance</h2>
dbaron@2974 1064
jackalmage@6617 1065 <h3 id="base-modules">Base Modules</h3>
dbaron@3022 1066
dbaron@3022 1067 <p>This specification defines conformance in terms of base modules,
dbaron@3022 1068 which are modules that this specification builds on top of. The base
dbaron@3022 1069 modules of this module are:</p>
dbaron@3022 1070
dbaron@3022 1071 <ul>
dbaron@3022 1072 <li>[[!CSS21]]</li>
dbaron@3022 1073 </ul>
dbaron@3022 1074
dbaron@3022 1075 <p>All of the conformance requirements of all base modules are
dbaron@3022 1076 incorporated as conformance requirements of this module, except where
dbaron@3022 1077 overridden by this module.</p>
dbaron@3022 1078
dbaron@3022 1079 <p>Additionally, all conformance requirements related to validity of
dbaron@3022 1080 syntax in this module and all of its base modules are to be interpreted
dbaron@3022 1081 as though all syntax in all of those modules is valid.</p>
dbaron@3022 1082
dbaron@3022 1083 <div class="example"><p>For example, this means that grammar presented
dbaron@3022 1084 in modules other than [[!CSS21]] must obey the requirements that
dbaron@3022 1085 [[!CSS21]] defines for the parsing of properties, and that requirements
dbaron@3022 1086 for handling invalid syntax in [[!CSS21]] do not treat syntax added by
dbaron@3022 1087 other modules as invalid.</p></div>
dbaron@3022 1088
dbaron@3022 1089 <p>Additionally, the set of valid syntax can be increased by the
dbaron@3022 1090 conformance of a style sheet or processor to additional modules; use of
dbaron@3022 1091 such syntax does not make a style sheet nonconformant and failure to
dbaron@3022 1092 treat such syntax as invalid does not make a processor
dbaron@3022 1093 nonconformant.</p>
dbaron@3022 1094
jackalmage@6617 1095 <h3 id="conformance-classes">Conformance Classes</h3>
dbaron@2974 1096
dbaron@2974 1097 <p>Conformance to the CSS Conditional Rules Module is defined for three
dbaron@2974 1098 conformance classes:
dbaron@2974 1099 <dl>
jackalmage@6617 1100 <dt><dfn title="conformance::style sheet" id="conform-style-sheet">style sheet</dfn>
dbaron@2974 1101 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
dbaron@3022 1102 style sheet</a>.</dd>
jackalmage@6617 1103 <dt><dfn title="conformance::processor" id="conform-processor">processor</dfn></dt>
dbaron@3022 1104 <dd>A tool that reads CSS style sheets: it may be a renderer or
dbaron@3022 1105 <a
dbaron@3022 1106 href="http://www.w3.org/TR/CSS21/conform.html#user-agent">user-agent</a>
dbaron@2974 1107 that interprets the semantics of a style sheet and renders
dbaron@3022 1108 documents that use style sheets, or it may be a validator that
dbaron@3022 1109 checks style sheets.</dd>
jackalmage@6617 1110 <dt><dfn title="conformance::authoring tool" id="conform-authoring-tool">authoring tool</dfn></dt>
dbaron@3022 1111 <dd>A tool that writes a style sheet.</dd>
dbaron@2974 1112 </dl>
dbaron@3022 1113
dbaron@3022 1114 <p>A style sheet is conformant to the CSS Conditional Rules Module
dbaron@3022 1115 if it meets all of the conformance requirements in the module that are
dbaron@3022 1116 described as requirements of style sheets.</p>
dbaron@3022 1117
dbaron@3022 1118 <p>A processor is conformant to the CSS Conditional Rules Module if it
dbaron@3022 1119 meets all applicable conformance requirements in the module that are
dbaron@3022 1120 described as requirements of processors. In general, all requirements
dbaron@3022 1121 are applicable to renderers. Requirements concerning a part of CSS
dbaron@3022 1122 not performed by a processor are not applicable, e.g., requirements
dbaron@3022 1123 related to rendering are not applicable to a validator. The inability
dbaron@3022 1124 of a processor to correctly render a document due to limitations of
dbaron@3022 1125 the device does not make it non-conformant. (For example, a renderer
dbaron@3022 1126 is not required to render color on a monochrome monitor.)</p>
dbaron@3022 1127
dbaron@3022 1128 <p>An authoring tool is conformant to the CSS Conditional Rules Module
dbaron@3022 1129 if it writes style sheets that conform to the module and (if it reads
dbaron@3022 1130 CSS) it is a conformant processor.</p>
dbaron@2974 1131
jackalmage@6617 1132 <h3 id="partial">
dbaron@2974 1133 Partial Implementations</h3>
dbaron@2974 1134
dbaron@2974 1135 <p>So that authors can exploit the forward-compatible parsing rules to
dbaron@2974 1136 assign fallback values, CSS renderers <strong>must</strong>
dbaron@2974 1137 treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
dbaron@2974 1138 as appropriate</a>) any at-rules, properties, property values, keywords,
dbaron@2974 1139 and other syntactic constructs for which they have no usable level of
dbaron@2974 1140 support. In particular, user agents <strong>must not</strong> selectively
dbaron@2974 1141 ignore unsupported component values and honor supported values in a single
dbaron@2974 1142 multi-value property declaration: if any value is considered invalid
dbaron@2974 1143 (as unsupported values must be), CSS requires that the entire declaration
dbaron@2974 1144 be ignored.</p>
dbaron@2974 1145
jackalmage@6617 1146 <h3 id="experimental">Experimental Implementations</h3>
dbaron@2974 1147
dbaron@2974 1148 <p>To avoid clashes with future CSS features, the CSS specifications
dbaron@2974 1149 reserve a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
dbaron@2974 1150 syntax</a> for proprietary property and value extensions to CSS. The CSS
dbaron@2974 1151 Working Group recommends that experimental implementations of features in
dbaron@2974 1152 CSS Working Drafts also use vendor-prefixed property or value names. This
dbaron@2974 1153 avoids any incompatibilities with future changes in the draft. Once a
dbaron@2974 1154 specification reaches the Candidate Recommendation stage, implementors
dbaron@2974 1155 should implement the non-prefixed syntax for any feature they consider to
dbaron@2974 1156 be correctly implemented according to spec.</p>
dbaron@2974 1157
jackalmage@6617 1158 <h3 id="cr-exit-criteria">CR Exit Criteria</h3>
dbaron@2974 1159
dbaron@3244 1160 <p>For this specification to be advanced to Proposed Recommendation,
dbaron@2974 1161 there must be at least two independent, interoperable implementations
dbaron@2974 1162 of each feature. Each feature may be implemented by a different set of
dbaron@2974 1163 products, there is no requirement that all features be implemented by
dbaron@2974 1164 a single product. For the purposes of this criterion, we define the
dbaron@2974 1165 following terms:
dbaron@2974 1166
dbaron@2974 1167 <dl>
dbaron@2974 1168 <dt>independent <dd>each implementation must be developed by a
dbaron@2974 1169 different party and cannot share, reuse, or derive from code
dbaron@2974 1170 used by another qualifying implementation. Sections of code that
dbaron@2974 1171 have no bearing on the implementation of this specification are
dbaron@2974 1172 exempt from this requirement.
dbaron@2974 1173
dbaron@2974 1174 <dt>interoperable <dd>passing the respective test case(s) in the
dbaron@2974 1175 official CSS test suite, or, if the implementation is not a Web
dbaron@2974 1176 browser, an equivalent test. Every relevant test in the test
dbaron@2974 1177 suite should have an equivalent test created if such a user
dbaron@2974 1178 agent (UA) is to be used to claim interoperability. In addition
dbaron@2974 1179 if such a UA is to be used to claim interoperability, then there
dbaron@2974 1180 must one or more additional UAs which can also pass those
dbaron@2974 1181 equivalent tests in the same way for the purpose of
dbaron@2974 1182 interoperability. The equivalent tests must be made publicly
dbaron@2974 1183 available for the purposes of peer review.
dbaron@2974 1184
dbaron@2974 1185 <dt>implementation <dd>a user agent which:
dbaron@2974 1186
dbaron@2974 1187 <ol class=inline>
dbaron@2974 1188 <li>implements the specification.
dbaron@2974 1189
dbaron@2974 1190 <li>is available to the general public. The implementation may
dbaron@2974 1191 be a shipping product or other publicly available version
dbaron@2974 1192 (i.e., beta version, preview release, or “nightly build”).
dbaron@2974 1193 Non-shipping product releases must have implemented the
dbaron@2974 1194 feature(s) for a period of at least one month in order to
dbaron@2974 1195 demonstrate stability.
dbaron@2974 1196
dbaron@2974 1197 <li>is not experimental (i.e., a version specifically designed
dbaron@2974 1198 to pass the test suite and is not intended for normal usage
dbaron@2974 1199 going forward).
dbaron@2974 1200 </ol>
dbaron@2974 1201 </dl>
dbaron@2974 1202
dbaron@2974 1203 <p>The specification will remain Candidate Recommendation for at least
dbaron@2974 1204 six months.
dbaron@2974 1205
fantasai@6831 1206 <h2 id="changes">
fantasai@6831 1207 Changes</h2>
dbaron@2974 1208
fantasai@6831 1209 <p>The following (non-editorial) changes were made to this specification since the
fantasai@6831 1210 <a href="http://www.w3.org/TR/2012/WD-css3-conditional-20120911/">11 September 2012 Working Draft</a>:
fantasai@6831 1211
fantasai@6831 1212 <ul>
fantasai@6846 1213 <li>Removed ''@document'' rule; it has been deferred to Level 4.
fantasai@6845 1214 <li>Allow functional notation in ''@supports'' queries to be valid (to allow for future extensions),
fantasai@6845 1215 but treat such notations as always being false.
fantasai@6831 1216 <li>Corrected the grammar as follows:
fantasai@6831 1217 <pre>
fantasai@6831 1218 - : SUPPORTS_SYM S+ supports_condition group_rule_body
fantasai@6831 1219 + : SUPPORTS_SYM S* supports_condition group_rule_body
fantasai@6831 1220 </pre>
fantasai@6842 1221 <pre>
fantasai@6842 1222 - : (URI | FUNCTION) S*
fantasai@6842 1223 + : (URI | FUNCTION S* STRING S* ')' ) S*
fantasai@6842 1224 </pre>
fantasai@6842 1225 <li>Switched "and", "or", and "not" keywords to use appropriate productions rather than literals.
fantasai@6846 1226 <li>Clarified definition of support used for interpreting ''@support'' rules
fantasai@6846 1227 and its relationship to CSS forwards-compatible parsing rules.
fantasai@6831 1228 </ul>
dbaron@2974 1229
jackalmage@6617 1230 <h2 class=no-num id="acknowledgments">Acknowledgments</h2>
dbaron@2974 1231
dbaron@2974 1232 <p>
dbaron@2974 1233 Thanks to the ideas and feedback from
dbaron@3418 1234 Tab Atkins,
dbaron@2974 1235 <span lang="tr">Tantek Çelik</span>,
dbaron@3418 1236 Alex Danilo,
dbaron@2974 1237 Elika Etemad,
dbaron@2974 1238 Pascal Germroth,
dbaron@2974 1239 <span lang="de">Björn Höhrmann</span>,
dbaron@3417 1240 Paul Irish,
dbaron@7044 1241 <span lang="nl">Anne van Kesteren</span>,
dbaron@3418 1242 Vitor Menezes,
dbaron@2977 1243 Alex Mogilevsky,
dbaron@2974 1244 Chris Moschini,
dbaron@6740 1245 Simon Sapin,
dbaron@2974 1246 Ben Ward,
dbaron@2974 1247 Zack Weinberg,
dbaron@3430 1248 Estelle Weyl,
dbaron@2974 1249 Boris Zbarsky,
dbaron@2974 1250 and all the rest of the <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
dbaron@2974 1251
dbaron@2974 1252 </p>
dbaron@2974 1253
jackalmage@6617 1254 <h2 class=no-num id="references">References</h2>
dbaron@2974 1255
dbaron@2974 1256
jackalmage@6617 1257 <h3 class="no-num" id="normative-references">Normative references</h3>
dbaron@2974 1258 <!--normative-->
dbaron@2974 1259
jackalmage@6617 1260 <h3 class="no-num" id="other-references">Other references</h3>
dbaron@2974 1261 <!--informative-->
dbaron@2974 1262
jackalmage@6617 1263 <h2 class="no-num" id="index">Index</h2>
dbaron@2974 1264 <!--index-->
dbaron@2974 1265
dbaron@2974 1266 </body>
dbaron@2974 1267 </html>
dbaron@2974 1268 <!-- Keep this comment at the end of the file
dbaron@2974 1269 Local variables:
dbaron@2974 1270 mode: sgml
dbaron@2974 1271 sgml-declaration:"~/SGML/HTML4.decl"
dbaron@2974 1272 sgml-default-doctype-name:"html"
dbaron@2974 1273 sgml-minimize-attributes:t
dbaron@2974 1274 sgml-nofill-elements:("pre" "style" "br")
dbaron@2974 1275 sgml-live-element-indicator:t
dbaron@2974 1276 sgml-omittag:nil
dbaron@2974 1277 sgml-shorttag:nil
dbaron@2974 1278 sgml-namecase-general:t
dbaron@2974 1279 sgml-general-insert-case:lower
dbaron@2974 1280 sgml-always-quote-attributes:t
dbaron@2974 1281 sgml-indent-step:nil
dbaron@2974 1282 sgml-indent-data:t
dbaron@2974 1283 sgml-parent-document:nil
dbaron@2974 1284 sgml-exposed-tags:nil
dbaron@2974 1285 sgml-local-catalogs:nil
dbaron@2974 1286 sgml-local-ecat-files:nil
dbaron@2974 1287 End:
dbaron@2974 1288 -->
dbaron@2974 1289

mercurial