W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Re(2): Expected behavior of CSSRule's setCssText.

From: Blaine Brodie <bbrodie@savagesoftware.com>
Date: Thu, 14 Sep 2000 17:41:43 -0700
Message-id: <fc.0085846d00011a803b9aca0023705192.11a8a@savagesoftware.com>
To: www-dom@w3.org, plh@w3.org
>> It will remove it.  setCssText is setting the _entire_ cssText -
>otherwise,
>> it should be called "appendCssText".
>> 
>[[[
>Setting this attribute will result in the parsing of the new value and
>resetting of the properties in the declaration block. It also allows the
>insertion of additional properties and their values into the block.
>]]]
>
>-- Document Object Model CSS
>http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/css.html#CSS-CSSStyleDeclaration
>Wed, 10 May 2000 15:09:02 GMT
>
>Hum, the cssText description could be better. What about :
>
>Setting this attribute will result in the parsing of the new value and
>resetting of all the properties in the declaration block including
>theremoval or addition of properties.

Yes, this description is good.  Can you please tell me what would happen
in the following case where I retrieve a CSSValue from the rule's style
declaration, and then make a call to the rule's setCssText method which
removes the value's property from the declaration?  Does the outstanding
CSSValue reference become detached from its parent rule and simply perform
method calls on the old data [without affecting the rule's declaration
values] or does the reference become invalid and invalid state exceptions
are thrown on any of the value's method calls?
Example.
	styleRule.setCssText("H1 { ascent: 10 }");
	CSSValue styleValue = style.getPropertyCSSValue("ascent");
	style.setCssText("H1 {} "); //**** ascent property is removed eventhough
a reference is outstanding ***//
	( (CSSPrimitiveValue)styleValue).getFloatValue(); 

Does the last call throw an invalid state exception or does it return the
old value 10?

Thanks,
Blaine
Received on Thursday, 14 September 2000 20:41:50 GMT

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