1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

Pass parent node to visitor (#1517)

Wrapping each node with JSAPI class and passing parent to it is not
reliable. Parent may be changed but the reference will stay.

Here I wasn't able to detach comment from parent node for some reason.
Explicit parent node inferred while ast traverse is easier to debug and
work with. Eventually we will not need to wrap each node with JSAPI class.
This commit is contained in:
Bogdan Chadkin
2021-08-12 13:05:09 +03:00
committed by GitHub
parent 2c0c361074
commit 35b7356ff0
6 changed files with 43 additions and 41 deletions

View File

@ -88,7 +88,7 @@ exports.fn = (root, params) => {
floatPrecision,
noSpaceAfterFlags,
});
detachNodeFromParent(child);
detachNodeFromParent(child, node);
continue;
}