1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-04 16:42:27 +03:00
Commit Graph

4 Commits

Author SHA1 Message Date
3ca57d1856 Add visitSkip symbol (#1547)
This should help to avoid node.parentNode and closestByName
in some cases by skiping visiting children of current node.

Works only in `enter` listener.
2021-08-27 17:01:29 +03:00
c3695ae533 Migrate to jest (#1520)
Mocha doesn't have a lot of features provided by jest.
There is a great assertion library out of the box.
And the most cool feature is inline snapshots.
Mocha also hides errors which makes debugging a nightmare sometimes.
2021-08-12 18:06:10 +03:00
35b7356ff0 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.
2021-08-12 13:05:09 +03:00
27bef1a954 Add "visitor" plugins support (#1454)
Visitor is a simple pattern which helps to avoid many type checks
and provide both "perItem" and "perItemReverse" functionality without
fragmentation.

The most important case is an ability to define state which in many
plugins specified either on module level or by polluting `params`.

In this diff I added visit and detachFromParent utilities and refactored
new mergeStyles plugin with it.

Also fixed bug when cdata content is merged into "text" node which is
not always valid.
2021-03-28 11:20:17 +03:00