Re: Missing Exception for the setCssText method of the CSSValue interface.

Blaine Brodie wrote:
> Hello Philippe,
> Ok, I'd like to confirm my understanding of what you are saying with a
> concrete
> example.  In the current SVG spec there exists a CSS property called
> 'stroke-dasharray'  (I'm quoting SVG because this is the only concrete
> example I can
> find.).  The representation for this property is either "ident or list of
> lengths".  The syntax
> for this property is 'none | <dasharray> | inherit'.
> Assume I obtain this CSS value from the getPropertyCssValue() method...
> 
> value = style.getPropertyCssValue("stroke-dasharray");
> value.getCssText();  //returns "none"
> value.getValueType(); //returns CSS_PRIMITIVE_VALUE
> CSSPrimitiveValue pValue = (CSSPrimitiveValue)value;
> pValue.getPrimitiveType(); //returns CSS_IDENT
> 
> pValue.setCssText("5 3 2 5 3 2"); //Throws SYNTAX_ERR exception

No, it doesn't return a SYNTAX_ERR since, according to the attached
property, the syntax is correct.

> However, if the above behavior is not correct and a SYNTAX_ERR exception
> is not thrown
> (ie the value type is changed), then can you please tell me which of the
> following behavior
> would be considered correct...
> 
> pValue.getCssText(); //returns "5 3 4 5 3 2"
> pValue.getValueType(); //returns CSS_VALUE_LIST
> pValue.getPrimitiveType(); //returns CSS_UNKNOWN

The result of pValue.getPrimitiveType is undefined since it is no longer
a primivite value. From a Java programmer point of view, it could
throw a java.lang.IllegalStateException (for example). In ECMAScript, you
might get an unknown property error. In any case, this is outside the
scope of the specification.

Philippe

Received on Monday, 26 June 2000 14:49:58 UTC