RE: comments: DOM Level2 19991210 (long)

Hi,

It's well after the deadline now, but I think that this is still worth
raising.  I'm coming to the conclusion that CSSValue and its subclasses need
to be audited by the wg. The problem is that despite the comments in the
draft, CSSValue is a standalone object, and it shouldn't be.

issue css-12:
CSSPrimitive.setFloatValue(short), states in its comments: 'If the property
attached with this value can not accept the specified unit or the float
value, the value will be unchanged and a DOMException will be raised'. There
is nowhere in the CSSOM that such a property explicitly exists, other than
in arguments into CSSStyleDeclaration, but more of that in a minute. 

The CSSValue object states: 'A CSSValue object only occurs in a context of a
CSS property'. Since values cannot explicitly refer to their targets, in the
object model at least, values *do* occur in the absence of a property. 

The main workaround as things stand is for a client to call the
getPropertyValue(DOMString) or getPropertyCSSValue(DOMString) from
CSSStyleDeclaration, hold a  reference to the argument string and let the
client check itself that the new value is sound. Apart from being a poorly
encapsulated design, this beggars the question of the need for
CSSPrimitiveValue's signature to demand an exception in the first place.
It's also not much use when implementing CSSPrimitiveValue itself. How is it
to know that the incming unit type is ok? As things stand with
CSSPrimitiveValue, I can try and induce whether the incoming new value is ok
*only* in term of the existing value, *not* the 'attached' property.
 
I suggest either a) adding the method getParentProperty(): DOMString to
CSSValue.  A direct reference is of great advantage since a lot of CSSOM
processing time is going to be spent manipulating CSSValue and its
subclasses. Or b) as I have mentioned before, creating a full CSSProperty
object, and making CSSStyleDeclaration a list container for such objects.
Adjustments to values can be controlled from this object.


regards,

Bill de hOra 

Received on Monday, 24 January 2000 07:23:08 UTC