Re: Possible? External SVG, styled from parent document

On Sat, Aug 16, 2014 at 7:45 AM, Nathan Long <nathanmlong@gmail.com> wrote:
> The SVG Parameters doc (http://www.w3.org/TR/SVGParamPrimer/) gives examples
> of passing in values that include colors. Ordinarily, one would expect to
> set such values with CSS. Is there a reason that this isn't possible, or
> could not be made possible?

The SVG Parameters doc is currently out-of-date.  The plan at the
moment is to integrate it with CSS Custom Properties and var(); the
spec will then become an alternative way to define a custom property.



> My use case: I have a graph that I want to use multiple times in the same
> document, but with different parts emphasized as I discuss them. The SVG
> data is identical in every case, and it would make most sense to reference
> it as an external .svg file.
>
> For example (rough pseudocode - I don't know if <img> or <object> or <svg>
> would make most sense)
>
> <head>
> <style type="text/css">
>   #one #some_line { stroke_width: 5px; }
>   #one #other_line { stroke_width: 5px; }
> </style
> </head>
> <body>
> <img id="one" src="my.svg">
> <img id="two" src="my.svg">
> </body>

SVG <img>s are actually in a separate document entirely; it's
basically the same as an <iframe>, just locked down more strictly.  We
don't allow direct selection across document boundaries for a
combination of security, sanity, and performance reasons.

That said, it seems reasonable for the Parameters spec to define a way
to take values from the referencing environment, so you'd set the
property on the <img> itself and it would transfer through to the
contained document *at the document's request*.

~TJ

Received on Monday, 18 August 2014 15:12:36 UTC