Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
SVG should specify what CSS attribute selectors and class selectors match on #328
Background: Mozilla bug 1365472
Given that attributes can be animated in SVG, SVG needs to specify if attribute selectors match on the animated value of the attribute or not. Similarly for class selectors.
That means that if we have:
<circle> <set attributeName="class" to="a"/> </circle>
Class and attribute selectors aren't perfectly symmetrical, given that class selectors are processed (tokenized). Even if you use the token form of the attribute selector, I'm sure there could be weird edge cases where you get inconsistent results.
In general, attribute selectors always match the literal attribute values, even if those are not valid values for the corresponding DOM properties, so you can get disconnects that way. For example,
But that said:
I would be quite happy to move towards an interpretation of SVG animation as more a declarative way of changing attributes, so the actual attribute value would change while the animation was in effect (just like it does if you're animating with JS). In other words, if you
But I think that goes against the argument for dropping
They have different case-sensitivity behavior in quirks mode, for what it's worth.
But also, the behavior @birtles proposes is what Safari and Firefox ship already. Edge doesn't support SMIL, and Chrome has broken
Conceptually, in spec terms as things stand, the "set of classes an element belongs to" is not necessarily a function of any of its attributes at all; it needs to be defined by relevant specifications that define that element.