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

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

From: Blaine Brodie <bbrodie@savagesoftware.com>
Date: Mon, 26 Jun 2000 11:29:56 -0700
Message-id: <fc.0085846d0000974d0085846d00009427.976b@savagesoftware.com>
To: www-dom@w3.org
www-dom@w3.org writes:
>Blaine Brodie wrote:
>> 
>> Should an INVALID_MODIFICATION_ERR be added to the list of possible
>> exceptions that can be generated using the setCssText() method, for the
>> case where the user attempts to change the value type from
>> CSS_PRIMITIVE_VALUE, CSS_CUSTOM, or CSS_VALUE_LIST to a different type
>via
>> the setCssText() method? (e.g. from type CSS_PRIMITIVE_VALUE to
>> CSS_VALUE_LIST).
>
>CSSValue.setCssText() raises a SYNTAX_ERR in that case:
>SYNTAX_ERR: Raised if the specified CSS string value
>has a syntax error (according to the attached property) or is
>unparsable. 
>
>CSSValue are typed (according to the underlying property).

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

If the above is considered to be correct behavior then that is fine with
me.  Eventhough,
as a user I  wouldn't expect this type of error to be thrown since "5 3 2
5 3 2" 
is still syntactically correct for the 'stroke-dasharray' property type.

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
----OR---
pValue == null //returns true


Thanks,
Blaine 
Received on Monday, 26 June 2000 14:29:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT