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

Hi :smiley:

This change affected over 50 products I helped develop, 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**" 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 by this change:

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

@markofca has already passionately argued how this change deprives 'use' of it's most powerful utility, which I agree with. I would add: the idea of unifying the spec with the shadow DOM appears to have taken priority over careful weighing of the required omissions _individually_. The 1.1 spec accommodated styling in many possible ways, but the choice was not simply to retain all or none.

However, I wouldn't be here debating this change at all had SVG 2 respected version declarations or required a new declaration like HTML5 to prevent existing content from breaking. Maybe it was assumed this feature was too obscure or poorly supported to qualify as a breaking change... I can only contest the latter: Styling 'use' instance trees based on _instance-context_ was implemented consistently across _all major browsers_, all the way back to IE9 (I know, because I had to support it).

Perhaps it's too late to address versioning, but I hope restoring styling in the _instance-context_ is carefully considered for SVG 2.1 (independently of how well it fits the shadow DOM) - This behavior makes 'use' worthwhile, without it, it's capable of little more than visually identical copies. By only retaining one half of the context based styling implementation is also vastly simplified.

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

Received on Tuesday, 8 October 2019 00:55:38 UTC