W3C home > Mailing lists > Public > public-svg-wg@w3.org > April to June 2008

Re: Errors in approved tests

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 29 May 2008 11:00:22 +1000
To: "public-svg-wg@w3.org" <public-svg-wg@w3.org>
Message-ID: <20080529010022.GA12959@arc.mcc.id.au>

Hi Erik.

Erik Dahlström:
> While going over some of the 1.2T tests I found some things that
> slipped by the F2F review.
>
> udom-svg-234-t.svg:
> Error: expects "red" instead of any canonical form of red, such as
> rgb(255,0,0), rgb(100%,0%,0%), #f00, #ff0000.

Agreed.  Also, after setting the xlink:href trait to "#rect2", the trait
getter must return the absolute IRI, not just "#rect2".

> What about automatic type conversion? See e.g. "Conversion to
> Strings"[1]. All ecmascript objects can (and will) provide a string
> representation, so if you pass any type of object as the value into
> setTrait(NS) it will always be converted to string format, so at most
> you'd get an INVALID_ACCESS_ERR exception if the string couldn't be
> parsed.

All native ECMAScript objects can be converted to strings (via the
[[DefaultValue]] internal property), but this is not necessarily the
case for host objects.  But it is rare for host objects not to be
stringifiable.  Web IDL defines how values passed to a host object’s
method are coerced into the right type (e.g. by passing the value to the
ToString operator defined in ECMA-262 if the parameter type is
DOMString, which is what you get when you pass the value to the global
String() function).  So I agree that the appropriate behaviour would be
for the parameter value to be stringified before being passed to
setTraitNS() and for an INVALID_ACCESS_ERR DOMException to be thrown,
but there isn’t any normative text that would require that.

> I'd like to revoke the approval of this test and have a further
> discussion on this.
> 
> udom-svg-235-t.svg:
> What about automatic type conversion? See e.g. "Conversion to
> Numbers"[1].
>
> IMHO null and "" should not throw exceptions, since you then lose the
> benefit of being able to specify setFloatTrait("x", "3") for example.
> I'd like to revoke the approval of this test and have a further
> discussion on this.

Also agreed.  Web IDL says that when the host object expects a float,
the ES value passed to it is coerced to a Number using the ToNumber
operator defined in ECMA-262 (which is what you get when you pass the
value to the global Number() function).

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 29 May 2008 01:01:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 29 May 2008 01:01:20 GMT