Re: [svgwg] SVG2 spec means elements within a <use> tag can not be targeted for styling (#367)

Thanks @ThomasBrierley.

To clarify, I was personally surprised by the removal of reference styling, e.g. the inclusion of " property values resulting from the CSS cascade", though the issues with instance styling are also surprising. 

In the case a user wanted a kind of template for reuse-with-tweaks, e.g. an enemy space-ship in a game or a person in a crowd, a `symbol` contained in `defs` that can be instanced by `use` seems to fit the occasion perfectly. This approach also mirrors the `template` reuse pattern in html. (I believe this is also how Illustrator exports symbols when exporting SVGs.)

In contrast, achieving this same end by referencing a fragment inside the document where the fragment may or may not be affected by style cascades seems risky (you'll need to be aware of and understand the priorities of any relevant selectors AND how they interact with instance styling rules), _unless the goal was for the instance to appear exactly the way the reference appears in its particular context_.  

Re-presenting an element as it appears effectively provides a kind of render-to-texture result that doesn't otherwise exist in a browser absent complex canvas workarounds. 

This ability also provides a fast way to hack around z-index limitations in some cases, especially when re-organizing a complex document tree to achieve proper z-order would effect the appearance of the elements. [Aside: Is z-index still in SVG2 even?]

It seems this result is not possible to achieve at all in SVG2. Absent a way to control for version,  there's no way implement alternative CSS or JS to get cross platform consistency. So this feature is dead even though SVG2 support is minimal.  

It seems it's only my recollection though that, at least a few years ago, _mixing_ styles was what was flaky — that reference and instance styling could be used somewhat reliably if relatively _independently_.... (I've had minimal contact with SVG before maybe 2015 though — I stuck to Flash as long as possible in no small part to avoid this kind of thing.) 


-- 
GitHub Notification of comment by IanBellomy
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/367#issuecomment-640615559 using your GitHub account

Received on Monday, 8 June 2020 13:50:12 UTC