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

'stroke' shorthand

From: Dirk Schulze <dschulze@adobe.com>
Date: Tue, 12 Nov 2013 18:00:44 -0800
To: www-svg <www-svg@w3.org>
Message-ID: <D19F55EB-4626-47D7-8C2E-A6BBFC445837@adobe.com>

Currently we have the following properties with the introducing term ’stroke’ and their definitions:

stroke:    <paint> with <paint> = none | <color> <icccolor>? | <funciri> [ none | <color> <icccolor>? ]
stroke-width:    <length> | <precentage>
stroke-linecap:    butt | round | square
stroke-linejoin:    miter | round | bevel
stroke-miterlimit:    <miterlimit> with <miterlimit> = <number> (number must be >= 1)
stroke-opacity:    <opacity-values> with <opacity-values> = <number>
stroke-dasharray:    none | <dasharray> with <dasharray> = [ <length> | <percentage> ] [[,]? <length> | <percentage>]*
stroke-dashoffset:    <length> | <precentage>

In previous discussions, we talked about following the CSS rules regarding shorthands. Two points I want to discuss taking the example of ‘stroke’ and the other of the former listed properties as defined in SVG11[1]:

1) The CSS WG uses the shorter initial part of a term as a so called "shorthand property". A shorthand property sets all “longhand properties” by reseting them to the initial value or reseting them again. The “longhand properties” are all related properties which also share the same initial part of a term. Meaning, ‘stroke' would be the shorthand property for all other listed properties above.

That also means that in the following example, the shorthand property resets all previously set properties according to the regulations of the CSS WG:

stroke-width: 2px;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 4px 3px;
stroke: green;

stroke-width would be reset to 1px, stroke-linecap to butt stoke-linejoin to miter and stroke-dasharray to none, because stroke (the shorthand) is set after these properties.

2) Furthermore, a shorthand can not have its “own” syntax. It can only inherit the syntax of one of the longhand. Following the rules of CSS, we would need to introduce a new longhand property taking the values of the current ’stroke’ property.

The first of the two discussion points would make property handling significantly different in SVG and potentially break existing content.


[1] http://www.w3.org/TR/SVG/painting.html
Received on Wednesday, 13 November 2013 02:01:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:47 UTC