Skip to content

Commit 33b3a92

Browse files
committed
Specify the results of the discussion on parenthesis nesting: extra parentheses should be allowed.
1 parent 79be051 commit 33b3a92

2 files changed

Lines changed: 82 additions & 45 deletions

File tree

css3-conditional/Overview.html

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
<h1>CSS Conditional Rules Module Level 3</h1>
1919

20-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 24 November
20+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 25 November
2121
2011</h2>
2222

2323
<dl>
2424
<dt>This version:
2525

26-
<dd><a href="http://www.w3.org/TR/2011/ED-css3-conditional-20111124/">
27-
http://www.w3.org/TR/2011/ED-css3-conditional-20111124/</a>
26+
<dd><a href="http://www.w3.org/TR/2011/ED-css3-conditional-20111125/">
27+
http://www.w3.org/TR/2011/ED-css3-conditional-20111125/</a>
2828

2929
<dt>Latest version:
3030

@@ -564,7 +564,11 @@ <h2 id=at-supports><span class=secno>6. </span>Feature queries: the
564564

565565
supports_condition
566566
: supports_negation | supports_conjunction | supports_disjunction |
567-
supports_declaration_condition
567+
supports_condition_in_parens
568+
;
569+
570+
supports_condition_in_parens
571+
: ( '(' supports_condition ')' S* ) | supports_declaration_condition
568572
;
569573

570574
supports_negation
@@ -579,10 +583,6 @@ <h2 id=at-supports><span class=secno>6. </span>Feature queries: the
579583
: supports_condition_in_parens ( 'or' S* supports_condition_in_parens )+
580584
;
581585

582-
supports_condition_in_parens
583-
: ( '(' supports_condition ')' S* ) | supports_declaration_condition
584-
;
585-
586586
supports_declaration_condition
587587
: '(' S* core_declaration ')' S*
588588
;</pre>
@@ -598,16 +598,6 @@ <h2 id=at-supports><span class=secno>6. </span>Feature queries: the
598598
not</strong> use such a rule and processors <strong>must</strong> ignore
599599
such a rule.
600600

601-
<p class=issue>The grammar above attempted to prevent nesting of extra
602-
parentheses; however, discussion in the working group has led to the
603-
conclusion that this was a bad idea, and therefore it should be changed to
604-
allow arbitrary nesting of extra parentheses (which, for example, makes it
605-
easier to comment things out). There was also discussion of allowing the
606-
toplevel parentheses around a declaration to be omitted, though opinion
607-
tended towards thinking this was a bad idea. See <a
608-
href="http://lists.w3.org/Archives/Public/www-style/2011Aug/thread.html#msg247">thread</a>
609-
on www-style.
610-
611601
<p class=note>Note that this means that declarations that meet the
612602
forward-compatible syntax for declarations are permitted (and support for
613603
them is then tested by the &lsquo;<code class=css>@supports</code>&rsquo;
@@ -629,6 +619,12 @@ <h2 id=at-supports><span class=secno>6. </span>Feature queries: the
629619

630620
<dd> The result is the result of the single child term.
631621

622+
<dt>supports_condition_in_parens
623+
624+
<dd> The result is the result of the single
625+
<code>supports_condition</code> or
626+
<code>supports_declaration_condition</code> child term.
627+
632628
<dt>supports_negation
633629

634630
<dd> The result is the <em>negation</em> of the result of the
@@ -646,12 +642,6 @@ <h2 id=at-supports><span class=secno>6. </span>Feature queries: the
646642
<code>supports_condition_in_parens</code> child terms is true; otherwise
647643
it is false.
648644

649-
<dt>supports_condition_in_parens
650-
651-
<dd> The result is the result of the single
652-
<code>supports_condition</code> or
653-
<code>supports_declaration_condition</code> child term.
654-
655645
<dt>supports_declaration_condition
656646

657647
<dd> The result is whether the CSS processor <a
@@ -751,6 +741,37 @@ <h2 id=at-supports><span class=secno>6. </span>Feature queries: the
751741
}</pre>
752742
</div>
753743

744+
<p>The declaration being tested must always occur within parentheses, when
745+
it is the only thing in the expression.
746+
747+
<p>
748+
749+
<div class=example>
750+
<p>For example, the following rule is not valid:
751+
752+
<pre class=illegal-example>@supports display: flexbox {
753+
// ...
754+
}</pre>
755+
756+
<p>Instead, authors must write:</p>
757+
758+
<pre>@supports (display: flexbox) {
759+
// ...
760+
}</pre>
761+
</div>
762+
763+
<p>The syntax allows extra parentheses when they are not needed. This
764+
flexibility is sometimes useful for authors (for example, when commenting
765+
out parts of an expression) and may also be useful for authoring tools.
766+
767+
<div class=example>
768+
<p>For example, authors may write:</p>
769+
770+
<pre>@supports ((display: flexbox)) {
771+
// ...
772+
}</pre>
773+
</div>
774+
754775
<h3 id=support-definition><span class=secno>6.1. </span>Definition of
755776
support</h3>
756777

css3-conditional/Overview.src.html

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,11 @@ <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
377377

378378
supports_condition
379379
: supports_negation | supports_conjunction | supports_disjunction |
380-
supports_declaration_condition
380+
supports_condition_in_parens
381+
;
382+
383+
supports_condition_in_parens
384+
: ( '(' supports_condition ')' S* ) | supports_declaration_condition
381385
;
382386

383387
supports_negation
@@ -392,10 +396,6 @@ <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
392396
: supports_condition_in_parens ( 'or' S* supports_condition_in_parens )+
393397
;
394398

395-
supports_condition_in_parens
396-
: ( '(' supports_condition ')' S* ) | supports_declaration_condition
397-
;
398-
399399
supports_declaration_condition
400400
: '(' S* core_declaration ')' S*
401401
;</pre>
@@ -408,16 +408,6 @@ <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
408408
above is invalid. Style sheets <strong>must not</strong> use such a
409409
rule and processors <strong>must</strong> ignore such a rule.</p>
410410

411-
<p class="issue">The grammar above attempted to prevent nesting of extra
412-
parentheses; however, discussion in the working group has led to the
413-
conclusion that this was a bad idea, and therefore it should be changed
414-
to allow arbitrary nesting of extra parentheses (which, for example,
415-
makes it easier to comment things out). There was also discussion of
416-
allowing the toplevel parentheses around a declaration to be omitted,
417-
though opinion tended towards thinking this was a bad idea. See
418-
<a href="http://lists.w3.org/Archives/Public/www-style/2011Aug/thread.html#msg247">thread</a>
419-
on www-style.</p>
420-
421411
<p class="note">Note that this means that declarations that meet the
422412
forward-compatible syntax for declarations are permitted (and support
423413
for them is then tested by the ''@supports'' rule), but declarations
@@ -438,6 +428,12 @@ <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
438428
The result is the result of the single child term.
439429
</dd>
440430

431+
<dt>supports_condition_in_parens</dt>
432+
<dd>
433+
The result is the result of the single <code>supports_condition</code>
434+
or <code>supports_declaration_condition</code> child term.
435+
</dd>
436+
441437
<dt>supports_negation</dt>
442438
<dd>
443439
The result is the <em>negation</em> of the result of the
@@ -458,12 +454,6 @@ <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
458454
otherwise it is false.
459455
</dd>
460456

461-
<dt>supports_condition_in_parens</dt>
462-
<dd>
463-
The result is the result of the single <code>supports_condition</code>
464-
or <code>supports_declaration_condition</code> child term.
465-
</dd>
466-
467457
<dt>supports_declaration_condition</dt>
468458
<dd>
469459
The result is whether the CSS processor <a
@@ -545,6 +535,32 @@ <h2 id="at-supports">Feature queries: the '@supports' rule</h2>
545535
}</pre>
546536
</div>
547537

538+
<p>The declaration being tested must always occur within parentheses,
539+
when it is the only thing in the expression.<p>
540+
541+
<div class="example">
542+
<p>For example, the following rule is not valid:
543+
<pre class="illegal-example">@supports display: flexbox {
544+
// ...
545+
}</pre>
546+
<p>Instead, authors must write:</p>
547+
<pre>@supports (display: flexbox) {
548+
// ...
549+
}</pre>
550+
</div>
551+
552+
<p>The syntax allows extra parentheses when they are not needed. This
553+
flexibility is sometimes useful for authors (for example, when
554+
commenting out parts of an expression) and may also be useful for
555+
authoring tools.</p>
556+
557+
<div class="example">
558+
<p>For example, authors may write:</p>
559+
<pre>@supports ((display: flexbox)) {
560+
// ...
561+
}</pre>
562+
</div>
563+
548564
<h3 id="support-definition">Definition of support</h3>
549565

550566
<p>A CSS processor is considered to <dfn id="dfn-support">support</dfn>

0 commit comments

Comments
 (0)