Re: Developing CSSOM Value APIs for SVG / replacing SVGLength

Hi Tab,

Thanks for following this up. In general I like it. It brings us closer 
to what I think roc originally suggested last year in Auckland.

I just have a couple of thoughts:

(2012/09/26 9:32), Tab Atkins Jr. wrote:
> [Constructor,
>   Constructor(float value, DOMString unitType),
>   Constructor(DOMString value)]

Those ctors are very similar to what Cameron has added to SVGLength with 
the exception of using a DOMString for the unitType instead of an 
optional unsigned short.[1]

It seems like it would be good if SVGLength's ctors matched here (whilst 
possibly providing an additional typed ctor like we have now).

> interface CSSLengthComponentValue {

We brought this up at the F2F, but if the CSSOM is still in flux I'd 
*really* like if this was shortened since it is an interface name you 
actually do type out, e.g. var len = new CSSLengthComponentValue(...)

(Even just typing out this email I've ended up copying and pasting that 
name everywhere!)

> Question: one of the motivations for doing this interface is to give
> us a backdoor to reinvent the baseVal/animVal thing that authors tend
> to hate.  I think we can do this cleanly by just making
> SVGAnimatedLength inherit from CSSLengthComponentValue.

I'm a little unsure about the inheritance. If you have a CSS length 
returned from an library of some sort, e.g. '5px', it seems it would be 
good if you could pass that straight into SVG's API wherever it takes an 
SVGLength.

Perhaps we could (a) make the SVG API take a CSSLengthComponentValue 
everywhere it currently takes an SVGLength, (b) add 
CSSLengthComponentValue.toSVGLength(), (c) add a ctor to SVGLength to 
take a CSSLengthComponentValue, (d) make them the same interface and 
deprecate the stuff we don't like from SVGLength, (e) lots of other 
possibilities.

I prefer (a) assuming we rename CSSLengthComponentValue to something 
reasonable.

Best regards,

Brian

[1] https://svgwg.org/svg2-draft/types.html#InterfaceSVGLength

Received on Wednesday, 26 September 2012 04:55:26 UTC