Re: SVG Parameters


On Sep 16, 2015, at 4:18 AM, Tab Atkins Jr. <jackalmage@gmail.com<mailto:jackalmage@gmail.com>> wrote:

Heya everyone, I've been threatening to merge Doug's old SVG
Parameters spec with CSS Variables for some time.  I just now got
around to it:

https://tabatkins.github.io/specs/svg-params/


It is a great document. To the issue with presentation attributes: There is no reason why it would not apply. Presentation attributes are style definitions within a different hierarchy in the cascade. We even use CSS3 Syntax for those attributes.

SVG params were about setting SVG attributes (not only presentation attributes) too. This is not described in the document and it feels like a decreased functionality (but not necessarily bad initially).

SVG params would require an implementation of custom properties which not all major browsers have yet. However, I don’t think that this is a blocker of any kind.

I support an ED of the document and would suggest adding it to the agenda of the FXTF.

Greetings,
Dirk



Basic idea is to introduce a param() fragment identifier that can
specify a custom property, like:

http://example.com/image.svg#param(--color%20blue)

Within CSS, where you might want to pass one of the page's own custom
properties down into a referenced SVG, the url() function sprouts a
param() function as well:

background-image: url("image.svg" param(--color var(--page-color)));

Either syntax sets the initial value of the given custom property to
the given value, allowing it to be used in any CSS properties on the
page.  (And, I think, presentation attributes, if they're parsed as
CSS.)

This does not handle passing text content into SVG, at least until
<text> allows the 'content' property to work.  However, the styling
possibilities are significant.

Thoughts?

~TJ

Received on Wednesday, 16 September 2015 19:11:56 UTC