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

Hi :smiley: I've been a silent observer, I think it's time I contributed.

This change affected over 50 products I helped develop, effectively breaking them in FireFox since 2017. Styling 'use' elements based on the _instance-context_ was relied upon as a fundamental building block in such a way that re-writing them was infeasible.

Out of necessity, I've written an "**unpolyfill**" (i think that might be a first? :grin:) to restore partial support for contextual styling of use instance trees (only in the _instance-context_ not the _reference-context_). Perhaps this will provide some quick relief for others affected here too:

https://github.com/ThomasBrierley/svg2use-unpolyfill

@markofca has already passionately argued how this change deprives 'use' of it's most powerful utility (which I could not agree with more). I would instead like to add a couple other concerns which _I think_ are the underlying failures at the center of this issue.

_This is intended to be constructive :) we are all here because we care about SVG_...

#### Implementation vs Utility:

The SVG 1.1 'use' spec for styling required complex implementations, striving for simplification is completely understandable, implementation matters and there is a delicate a balance to strike between simplicity and maintaining a useful level of utility. Unfortunately I don't think these two concerns have been balanced very well here.

On paper the change looks good, on a per-feature basis it appears to retain the majority of the spec _and_ unifies it with another very well developed spec (the shadow DOM). The only problem is those features are not equal. I _suspect_ the prospect of unifying with the shadow DOM proved so attractive that the required omissions were not carefully weighed.

#### Unextensible and Unversioned

SVG 2 does not respect older version declarations. To be honest, this one feels a bit like a [cardinal sin for the w3c](https://www.w3.org/TR/webarch/#ext-version)... perhaps it was assumed this feature was too obscure or poorly supported to matter, I can only contest the latter:

Styling 'use' instance trees based on instance-context was implemented consistently across all major browsers, even IE9 supported it (I know, because I had to support it).

I think if this principle had been respected I probably wouldn't be here, I wouldn't like the change, but it wouldn't have suddenly broken so much content when it landed in FireFox.

...

Perhaps it's too late to address these issues completely, but I do hope restoring styling in the _instance-context_ is carefully considered by the w3c for SVG 2.1 - This behavior makes 'use' worthwhile, without it, it's looks pretty useless, pun intended :wink: thanks for reading if you got this far.

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

Received on Friday, 4 October 2019 00:23:01 UTC