1
0
mirror of https://github.com/svg/svgo.git synced 2025-08-09 02:22:08 +03:00

Convert cdata and text nodes to xast

Ref https://github.com/syntax-tree/xast

More consistent naming and distinction by type looks a bit cleaner.
This commit is contained in:
Bogdan Chadkin
2021-03-10 16:02:37 +03:00
parent 10ac712282
commit c50decb438
9 changed files with 55 additions and 38 deletions

View File

@@ -154,8 +154,9 @@ const computeStyle = (node) => {
) {
const children = styleNode.content || [];
for (const child of children) {
const css = child.text || child.cdata;
stylesheet.push(...parseStylesheet(css, dynamic));
if (child.type === 'text' || child.type === 'cdata') {
stylesheet.push(...parseStylesheet(child.value, dynamic));
}
}
}
}