- From: Doug Schepers <schepers@w3.org>
- Date: Thu, 15 Jul 2010 10:51:03 -0400
- To: Tavmjong Bah <tavmjong@free.fr>
- CC: Robert Longson <longsonr@gmail.com>, www-svg@w3.org, Erik Dahlstrom <ed@opera.com>
Hi, Tav- Tavmjong Bah wrote (on 7/15/10 9:34 AM): > > I am confused again!! The<length> entry in "4.2 Basic data types" > states: > > "For properties defined in CSS2 [CSS2], a length unit identifier must be > provided. For length values in SVG-specific properties and their > corresponding presentation attributes, the length unit identifier is > optional. If not provided, the length value represents a distance in the > current user coordinate system. In presentation attributes for all > properties, whether defined in this specification or in CSS2, the length > identifier, if specified, must be in lower case." > > My interpretation of this is that since "font-size" is a CSS2 property > (see 6.1) it must have a unit regardless of where it is defined while > "stroke-width" is an SVG only property so it must have a unit only when > defined in a CSS style sheet or the style attribute. You're right, this section should be reworded in terms of syntax context. You're missing the subtle distinction there between properties and attributes, because it's stated too vaguely [1]. How about something like this (assume a bulleted list for the asterisks)? [[ A length is a distance measurement, given as a number, along with a unit which may be optional. Lengths are specified in one of two ways, depending upon whether they are used in CSS property syntax or SVG presentation attribute syntax: * When a <length> is used in a stylesheet or with a property in a 'style' attribute, the syntax must match the following pattern: length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")? See the CSS2 specification for the meanings of the unit identifiers. For properties defined in CSS2 [CSS2], a length unit identifier must be provided. For length values in SVG-specific properties, the length unit identifier is optional (as with their corresponding presentation attributes). If a unit is not provided, the length value represents a distance in the current user coordinate system. * When a <length> is are used in an SVG presentation attribute, unit identifiers may be optional, so the syntax must match the following pattern instead: length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")? The unit identifiers in such <length> values must be in lower case when used in an SVG presentation attribute. Note that a percentage unit identifier is allowed in the presentation attribute (non-property) <length> definition. The meaning of a percentage length value depends on the attribute for which the percentage length value has been specified. Two common cases are: (a) when a percentage length value represents a percentage of the viewport width or height (refer to the section that discusses units in general), and (b) when a percentage length value represents a percentage of the bounding box width or height on a given object (refer to the section that describes object bounding box units). In the SVG DOM, <length> values are represented using SVGLength or SVGAnimatedLength objects. ]] Note that there is an outstanding issue for whether SVG-defined properties when used in stylesheets or style attributes must use unit identifiers. This change glosses over that issue, and simply addresses a clarification for what is already in the SVG spec without changing the intent. [1] http://www.w3.org/TR/SVG/types.html#DataTypeLength Regards- -Doug Schepers W3C Team Contact, SVG and WebApps WGs
Received on Thursday, 15 July 2010 14:51:10 UTC