mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
Convert element children to xast
Ref https://github.com/syntax-tree/xast Renamed content to children to match xast spec.
This commit is contained in:
@ -26,19 +26,19 @@ exports.params = {
|
||||
* @author Kir Belevich, Lev Solntsev
|
||||
*/
|
||||
exports.fn = function (item, params) {
|
||||
if (item.type !== 'element' || item.isEmpty()) return;
|
||||
if (item.type !== 'element' || item.children.length === 0) return;
|
||||
|
||||
var prevContentItem = null,
|
||||
prevContentItemKeys = null;
|
||||
|
||||
item.content = item.content.filter(function (contentItem) {
|
||||
item.children = item.children.filter(function (contentItem) {
|
||||
if (
|
||||
prevContentItem &&
|
||||
prevContentItem.isElem('path') &&
|
||||
prevContentItem.isEmpty() &&
|
||||
prevContentItem.children.length === 0 &&
|
||||
prevContentItem.hasAttr('d') &&
|
||||
contentItem.isElem('path') &&
|
||||
contentItem.isEmpty() &&
|
||||
contentItem.children.length === 0 &&
|
||||
contentItem.hasAttr('d')
|
||||
) {
|
||||
const computedStyle = computeStyle(contentItem);
|
||||
|
Reference in New Issue
Block a user