Re: [CSS21] response to issue 82

Bert Bos wrote:
> This is the CSS WG's response to an issue you raised on the last CSS
> 2.1 draft (http://www.w3.org/TR/2003/WD-CSS21-20030915). We want to
> publish CSS 2.1 as a CR in about two weeks. Please let us know this
> week if you think our response is wrong.
> 
> Your e-mail:
>     http://www.w3.org/mid/3F875337.6080406@escape.com
>     Default Attributes
>     S5.8.2 <http://www.w3.org/TR/2003/WD-CSS21-20030915/selector.html#q11>
>     #    EXAMPLE { /*... default property settings ...*/ }
>     # Because this selector is less specific than an attribute selector,
>     # it will only be used for the default case.
>     This is false. The selector will be used for all cases, not just the
>     default case. If a declaration from this rule conflicts with one from
>     a more specific rule, then it will be overridden--but the declaration
>     still applies.
> 
> CSS WG response:
>     It's only an example and is accurate enough, we think.

It's not accurate at all. Suppose I set *different properties* for
the default and non-default cases, using the method in this example.
The declarations I'd set for the default case will also wind up
applying for the non-default case, since they haven't been overridden
by a more specific style. Then even the illusion that omitting the
attribute selector makes it a "default value selector" breaks.

 > (We couldn't come up with better text that didn't sound stilted.)

Then you should have asked me to try.

Here:

<div class="example"><P style="display:none">Example(s):</P>
<P>For example, consider an element EXAMPLE with an attribute "notation"
that has a default value of "decimal". The DTD fragment might be

<pre class="dtd-example">
&lt;!ATTLIST EXAMPLE notation (decimal,octal) "decimal">
</pre>

<p>If the style sheet contains the rules

<pre class="example">
EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
EXAMPLE[notation=octal]   { /*... other settings...*/ }
</pre>

<p>the first rule will not match elements whose "notation" attribute
is set by default, i.e. not set explicitly. To catch all cases, the
attribute selector for the default value must be dropped:</p>

<pre class="example">
EXAMPLE                   { /*... default property settings ...*/ }
EXAMPLE[notation=octal]   { /*... other settings...*/ }
</pre>

<p>Here, because the selector <code>EXAMPLE[notation=octal]</code> is
more <a href="cascade.html#specificity">specific</a> than the tag
selector alone, the style declarations in the second rule will override
those in the first for elements that have a "notation" attribute value
of "octal". Care has to be taken that all property declarations that
are to apply only to the default case are overridden in the non-default
cases' style rules.
</div>

~fantasai

Received on Friday, 20 February 2004 15:35:59 UTC