- From: Bert Bos <bert@w3.org>
- Date: Sat, 21 Feb 2004 01:02:12 +0100
- To: www-style@w3.org
fantasai writes: > 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"> > <!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> I think I'm starting to see what you mean. It's not about whether the selector matches. It's about the word "default." You interpret the comment "default property settings" different from how we intended it: - Your meaning is that these are the *default properties* that apply to all EXAMPLE elements, independent of what attribute the element has. - Our meaning is that those are the properties that apply to the EXAMPLE element when its attribute has the value that is declared as the *default value* in the DTD. When you said: "If a declaration from this rule conflicts with one from a more specific rule, then it will be overridden," we thought that was a rather subtle way of saying it. *Of course* the declarations will be overridden: the rule that overrides them is right there in the example. Why use the word "if"? All the properties that should apply uniformly to all EXAMPLE elements, independent of the attribute, are outside the example somewhere. Probably in another rule: EXAMPLE { /* ... common properties... */ } I still think the example if fine, though. But once we have pinpointed the exact problem and a fix is still necessary, we can correct it at any time. It's not an essential part of the specification. Bert -- Bert Bos ( W 3 C ) http://www.w3.org/ http://www.w3.org/people/bos/ W3C/ERCIM bert@w3.org 2004 Rt des Lucioles / BP 93 +33 (0)4 92 38 76 92 06902 Sophia Antipolis Cedex, France
Received on Friday, 20 February 2004 19:02:19 UTC