Closed Bug 1395221 Opened 7 years ago Closed 7 years ago

SVG use instances do not inherit CSS-specified overrides of their source's attributes.

Categories

(Core :: SVG, defect, P2)

defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox57 --- affected

People

(Reporter: wisniewskit, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [webcompat])

Attachments

(1 file)

Attached file testcase.html
In the attached testcase, the <symbol> has both the attribute fill="none" and the CSS fill:red. However, the red does not apply to <use> instances, when it should (all other browsers behave this way). As such the <use> instances end up with no fill, rather than a red fill, unlike in other browsers (Edge, Chrome, Safari).

The reason seems to be that since the CSS is applied specifically to the original symbol's path, it is not copied over to the instances as well. If I add in an old-school CSS hack (as in the comment in the attached test-case), then Firefox will also propagate the fill accordingly.

I'm unsure if this is an edge-case missed in bug 265894 or not, but I thought I'd mention it just in case.
Flags: webcompat?
I don't think this is valid per https://www.w3.org/TR/SVG2/struct.html#UseStyleInheritance and I don't think any other UA has implemented this part of SVG 2 yet either. Someone has to be first and this time it's us.
Priority: -- → P2
Depends on: 376027
per https://www.w3.org/TR/SVG2/struct.html#UseStyleInheritance


If a CSS rule uses a complex selector to match an element based on its ancestors or siblings, and those ancestors or siblings are not cloned as part of the shadow tree, then that rule would no longer match the element instance.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
That's fine and good, but it's still an interop issue, given that every other major engine does this but Firefox. Should we simply ignore that?
Flags: needinfo?(longsonr)
You could always take it up with w3c (https://lists.w3.org/Archives/Public/www-svg/) they wrote the spec. We were much less interoperable before with our <use> implementation.
Flags: needinfo?(longsonr)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: