mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
Prepare root and element nodes for xast
Ref https://github.com/syntax-tree/xast - added type: root | element - renamed elem to name - replaced "elem" property checks with check for correct type
This commit is contained in:
@ -81,7 +81,7 @@ function findStyleElems(ast) {
|
||||
|
||||
if (item.isElem('style') && !item.isEmpty()) {
|
||||
styles.push(item);
|
||||
} else if (item.isElem() && item.hasAttr('style')) {
|
||||
} else if (item.type === 'element' && item.hasAttr('style')) {
|
||||
styles.push(item);
|
||||
}
|
||||
}
|
||||
@ -118,8 +118,8 @@ function collectUsageData(ast, options) {
|
||||
safe = false;
|
||||
}
|
||||
|
||||
if (item.isElem()) {
|
||||
usageData.tags[item.elem] = true;
|
||||
if (item.type === 'element') {
|
||||
usageData.tags[item.name] = true;
|
||||
|
||||
if (item.hasAttr('id')) {
|
||||
usageData.ids[item.attr('id').value] = true;
|
||||
|
Reference in New Issue
Block a user