- From: Cameron McCormack <cam@mcc.id.au>
- Date: Mon, 6 Apr 2009 15:50:59 +1000
- To: public-svg-wg@w3.org
SVG Working Group Issue Tracker:
> When assigning to SVGLength.valueAsString (or SVGAngle.valueAsString),
> the unitType should be changed to whatever was parsed from the given
> string. For example:
>
> var l = /* an SVGLength object */;
> l.valueAsString = '1em';
> assert(l.unitType == SVGLength.SVG_LENGTHTYPE_EMS);
> assert(l.valueInSpecifiedUnits == 1);
>
> But the current text describing valueAsString says:
>
> The value as a string value, in the units expressed by unitType. Setting this
> attribute will cause value and valueInSpecifiedUnits to be updated
> automatically to reflect this setting.
>
> which doesn't make this clear.
>
> There's also no indication of what exception would be thrown if the
> given SVGLength string couldn't be parsed, or what exactly is the
> acceptable syntax.
Here is proposed erratum replacement text for the description of
valueAsString:
DOMString valueAsString
The length value as a string, in the units expressed by unitType.
Setting this attribute will cause value, valueInSpecifiedUnits
and unitType to be updated automatically to reflect this setting.
Exceceptions on setting
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to
change the value of a readonly attribute.
DOMException SYNTAX_ERR: Raised if valueAsString cannot be parsed
as a valid <length>.
> Similarly, there are no exceptions declared for the
> newValueSpecifiedUnits() or convertToSpecifiedUnits() methods. I’d
> expect exceptions to be thrown if an invalid unitType were given.
Proposed replacement text for those two methods:
newValueSpecifiedUnits
…
Exceptions
DOMException NOT_SUPPORTED_ERR: Raised if unitType is not a valid
unit type constant (one of the SVG_LENGTHTYPE_* constants
defined on this interface).
convertToSpecifiedUnits
…
Exceptions
DOMException NOT_SUPPORTED_ERR: Raised if unitType is not a valid
unit type constant (one of the SVG_LENGTHTYPE_* constants
defined on this interface).
(Aside: I’m not sure why the convertToSpecifiedUnits() method is needed.
Why not just make unitType a read-write attribute?)
--
Cameron McCormack ≝ http://mcc.id.au/
Received on Monday, 6 April 2009 05:51:50 UTC