Properly handle invalid CSS property names e.g. those that begin with double dash
Found by Martin in #3268 (comment 378199615)
Summary:
Inkscape should handle invalid property names like those that begin with -- or a number, e.g. 0color. Note that in SVG2/CSS3, some of these are now valid.
https://www.w3.org/TR/CSS21/syndata.html#declaration
A user agent must ignore a declaration with an invalid property name or an invalid value. Every CSS property has its own syntactic and semantic restrictions on the values it accepts.
where ignore links to https://www.w3.org/TR/CSS21/syndata.html#ignore, which treats h1 { color: red; rotation: 70minutes } as
h1 { color: red }
Steps to reproduce:
- open inkscape-css-invalid-ident.svg in Inkscape
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg height="100" width="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<style>
rect {
fill:red;
0color:green;
stroke:blue;
}
</style>
<rect width="50" height="50" />
</svg>
What happened?
- style tag is ignored and rect remains unset
What should have happened?
- only the invalid property is ignored
Note: https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier defines invalid properties in CSS2.1, https://www.w3.org/TR/css-syntax-3/#ident-token-diagram defines invalid properties for CSS syntax 3 (laxer rules)
Version Info:
- Inkscape 0.92.3 (2405546, 2018-03-11) Linux Mint 19.1
- Inkscape 1.1-dev (bd77302e35, 2020-07-12, custom) Linux Mint 19.1
Search terms for duplicate search: css and style