Re: Clarification of readonly attributes

Hi Tim.

Tim Rowley:
> The IDL prose for SVGLength states:
> 
>    float value
> 
>        The value as an floating point value, in user
>        units. Setting this attribute will cause
>        valueInSpecifiedUnits and valueAsString to be updated
>        automatically to reflect this setting.
> 
>      Exceptions on setting
> 
>         DOMException NO_MODIFICATION_ALLOWED_ERR: Raised on an
>         attempt to change the value of a readonly attribute.
> 
> Since the attributes are readonly down to the scalar level, does
> that mean that the value of x can't be modified by anything other
> than setAttribute?

No, the value on the SVGLength interface isn't readonly.

> As in, should "fooInstance.x.baseVal.value = 42" throw an exception?

No, but this would through an exception:

  fooInstance.x.baseVal =
    fooInstance.ownerDocument.rootElement.createSVGLength();

You can't change which SVGLength object fooInstance.x.baseVal refers to,
but you can change properties of the existing SVGlength object (assuming
they aren't themselves readonly).

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

Received on Friday, 19 November 2004 07:49:47 UTC