W3C home > Mailing lists > Public > www-svg@w3.org > November 2004

Re: Styling conflict

From: Chris Lilley <chris@w3.org>
Date: Thu, 18 Nov 2004 19:44:28 +0100
Message-ID: <1777934272.20041118194428@w3.org>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: Caleb Moore <donscarletti@internode.on.net>, www-svg@w3.org

On Wednesday, November 17, 2004, 6:07:22 PM, Boris wrote:


BZ> Caleb Moore wrote:
>> What should an svg renderer do when presentation attributes and style
>> attributes conflict? It never really comes up in the spec or anything

BZ> Sure it does.  SVG 1.1 says the following [1, paragraph after the second list]:

BZ>    For user agents that support CSS, the presentation attributes must be
BZ>    translated to corresponding CSS style rules according to rules described in
BZ>    section 6.4.4 of the CSS2 specification, Precedence of non-CSS presentational
BZ>    hints, with the additional clarification that the presentation attributes are
BZ>    conceptually inserted into a new author style sheet which is the first in the
BZ>    author style sheet collection. The presentation attributes thus will
BZ>    participate in the CSS2 cascade as if they were replaced by corresponding CSS
BZ>    style rules placed at the start of the author style sheet with a specificity
BZ>    of zero. In general, this means that the presentation attributes have lower
BZ>    priority than other CSS style rules specified in author style sheets or style
BZ>    attributes.

Thanks for pointing out the exact quote. I agree, its well specified in
general. There is in fact one lingering area of woolliness, which I hope
can be cleared up:

CSS 2.0, referenced by SVG 1.0 and 1.1, says that the specificity of the
style attribute is 100 and that the specificity of a single id selector
is also 100. Thus, in the following snippet (namespaces and attributes
not germane to the point being removed):

 <g id="foo">
   <circle class="bar" style="fill:red"/>
   <rect id="toto" style="fill:red"/>
 <g>

and given the following rules

#foo > .bar {fill: green }
#foo > #toto {fill: green }

the two shapes will have a green fill in CSS2 and a red fill in CSS
2.1. We are sometimes told that CSS2.1 replaces CSS 2.0, sometimes that
it will replace it but not yet, sometimes that CSS 2.0 will be withdrawn
when CSS 2.1 is a Rec, sometimes that it will not. in addition, the
large delays on CSS 2.1 moving to Rec have meant it is unclear which one
to reference.

BZ> Does the CSS 1.1 test suite not have a test for this?

CSS 2.1 does not have a test suite, nor does CSS 2, although a simple
transformation of the CSS 1 test suite would provide at least a start.

In the SVG test suite, I have held off testing this because of this
uncertainty. its easy to test that the style attribute overrides say
class selectors or element selectors, which in turn override
presentation attributes; i also wanted to test combinations of selectors
including ones with specificity 200 or 110 as in the example above.

Maybe I should just do the easy test and leave the one about the precise
specificity of the style attribute until CSS settles down.



-- 
 Chris Lilley                    mailto:chris@w3.org
 Chair, W3C SVG Working Group
 Member, W3C Technical Architecture Group
Received on Thursday, 18 November 2004 18:44:28 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:52 UTC