-
-
Notifications
You must be signed in to change notification settings - Fork 19
The SVG 'style' attribute parsing is not CSS standard compliant #145
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The AttributeNode.preprocessAttributes method has the following code:
private static void preprocessAttributes(@NotNull Map<String, String> attributes,
@NotNull Map<String, String> styleAttributes) {
String styleStr = attributes.get("style");
if (styleStr != null && !isBlank(styleStr)) {
String[] styles = styleStr.split(";");
for (String style : styles) {
if (isBlank(style)) continue;
String[] styleDef = style.split(":", 2);
styleAttributes.put(styleDef[0].trim().toLowerCase(Locale.ENGLISH), styleDef[1].trim());
}
}
}It parses the style attribute by splitting on ; and then :. This is not CSS standard compliant, as it doesn't consider comments, quoted strings, etc. It should be parsed like a declaration in a style sheet, according to the standard: https://www.w3.org/TR/css-style-attr/.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working