Re: CSSValue creation

Steve,
In DOM2, one cannot create a CSSValue using a factory method. You can only 
access after a CSSValue when a property definition has already been 
created. If you need to create a new property definition (i.e., a rule), 
you can only do so via string-oriented DOM facilities (e.g., 
setAttribute()). After assigning a value using one of these string-oriented 
calls, you can then access and modify the value using the CSSValue 
interface. Each CSSValue is "live" in that changes to the values inside of 
the object represent immediate changes to the document.

Adobe isn't thrilled with the way that CSSValue works. We would have 
preferred an approach along the lines which you have described, where it 
would be possible to create a CSSValue off on the side and then insert it 
into the document tree once it was set up properly. However, the approach 
used in DOM2 for CSSValue is acceptable and workable.

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated

At 01:41 PM 6/5/00 -0700, Steve Dickson wrote:

>I'd like some clarification about the use of CSSValue types in Exchange
>SVG.  According to section
>24.5 of the SVG spec of 2000/03/03, Exchange SVG defines a number of
>attributes of type
>CSSValue. e.g.
>                 attribute CSSValue fill-opacity;
>Since this is not a read-only attribute, it should have a mutator/set
>method as well as an
>accessor/get method.  The set method presumably takes a user-created
>CSSValue as an
>input parameter.
>
>My question is: how is the user supposed to create a CSSValue object to
>pass in to the set
>method?  From what I've been able to determine from reading the CSS spec,
>there are no factory
>methods for CSSValue.  It seems that the only way to get a handle on a
>CSSValue object is to do
>something like the following:
>
>[Assuming you have a DOMImplementationCSS variable created called "impl".]
>CSSStyleSheet s = impl.createCSSStyleSheet("","");
>s.insertRule("{fill-opacity: 1.0}");
>CSSStyleRule sr = (CSSStyleRule)s.getCSSRules().item(0);
>CSSValue fill_opacity = sr.getStyle().getPropertyCSSValue("fill-opacity");
>
>I must be missing something, since this doesn't seem viable in the context
>of Exchange SVG for two
>reasons: (1) one of the main purposes of Exchange SVG was to get away from
>the need for style
>sheets;  (2) it seems to place an awful burden on the user just to create
>a simple object.
>
>Is there a better (simpler, more lightweight, user-friendly) way to create
>a CSSValue object for use
>in Exchange SVG?
>
>S.
>
>
>
>
>

Received on Monday, 5 June 2000 22:01:20 UTC