W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2000

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

From: Philippe Le Hegaret <plh@w3.org>
Date: Mon, 26 Jun 2000 14:49:56 -0400
Message-ID: <3957A5D4.BDA153EA@w3.org>
To: Blaine Brodie <bbrodie@savagesoftware.com>
CC: www-dom@w3.org
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.

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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC