Re: Alternate ways of referencing

On Tue, Jan 20, 2015 at 2:40 PM, Rick <graham.rick@gmail.com> wrote:
> I see the group is discussing referencing CSS Values and Units instead
> of specifying <length> in SVG
>
> Other useful alternatives occur to me.  I don't know if this has been discussed.
>
> Could it be possible to have one length (or other) value tied to
> another in the following fashion?
>
> <rect id="rect_1" width="6" height="6"/>
> <rect id="rect_2" width="url(#rect_1):width" height="12"/>
>
> There are many ways this could be encoded, the objective, to tie the
> value of one attribute to the value of another using a declarative
> method in a fashion similar to <use>, but at the attribute level.

The closest thing is the use of CSS Variables
<http://dev.w3.org/csswg/css-variables/>, which are definitely usable
in style attributes on the element and should be usable in all
presentation attributes.  That way you can define a given value once,
and use it in multiple places, like:

<g style="--width: 6;">
  <rect width="var(--width)" height="6" />
  <rect width="var(--width)" height="12" />
</g>

~TJ

Received on Tuesday, 20 January 2015 22:47:45 UTC