Open longsonr opened 9 months ago
If I read the spec correctly:
::first-line
/::first-letter
has an allowlist of properties which doesn't include SVG properties::first-line
/::first-letter
on SVG text
elements do not support SVG-only propertiesSo the issue should be the other way around: whether/how to allow SVG-only properties in ::first-line
/::first-letter
only when the originating element is an SVG text
element
Well the SVG specification says that SVG text supports ::first-letter and ::first-line but if you can change the font-size but not the fill/stroke/stroke-width/stroke-dasharray/ etc then it's not that much use for SVG text - that partial support would be pretty surprising for anyone who tried to use it with SVG. Firefox intends to support most applicable SVG properties from version 124.
For HTML text you can, of course change the colour via the color property.
Or maybe everything is working correctly, and no work is needed?
Currently, SVG properties can be applied to HTML elements and cascade as normal. They just don't do anything to the rendering.
Test case: https://jsfiddle.net/dmjhtnps/ , where we can see SVG property rx
is treated as a normal property on HTML elements. The behavior is same on Chrome and Firefox.
So SVG properties can be always allowed in ::first-letter
and ::first-line
, and they don't do anything if the originating element is not an SVG element.
@xiaochengh The css-pseudo specification says that only whitelisted HTML properties are applied. I'm saying
You can try a Firefox nightly today and see the difference: https://codepen.io/CodeRedDigital/pen/MWxROBR
It's not a very strict whitelist. It also includes:
- any other properties defined to apply to ::first-line by their respective specifications
Which means the SVG spec can add more allowed properties.
The specification says
However the SVG 2 specification says...
No mention of ::placeholder in SVG 2 and I don't really see how you can have SVG text as a placeholder. Whereas SVG text content obviously has a first letter and somewhat less obviously a first line. E.g.
The letter F is the first-letter and we should be able to apply the usual set of SVG text formatting to it e.g. fill, stroke, stroke-width etc.
So perhaps the [css-pseudo] specification should instead say something like