1
0
mirror of https://github.com/svg/svgo.git synced 2025-04-19 10:22:15 +03:00

9 Commits

Author SHA1 Message Date
Bogdan Chadkin
c9ecc384c7 Add descendants test and universal selector support 2021-08-23 19:24:04 +03:00
Bogdan Chadkin
5bf41deb3c Support more attributes selectors 2021-08-23 16:54:35 +03:00
Bogdan Chadkin
3ce763a2dc Add selectors list test 2021-08-23 14:37:04 +03:00
Bogdan Chadkin
8dc2806bdc Move tests to selectAll 2021-08-23 14:30:09 +03:00
Bogdan Chadkin
4da3ede37b Support matches and combinations 2021-08-23 14:30:09 +03:00
Bogdan Chadkin
2d0d3e2889 Replace css-select with custom implementation
There are a few benefits of custom implementation

- csstree instead of css-what parser
- 9 less dependecies
- only standard features are supported (css-select has :parent from jquery)
- new implementation allows to get rid of parentNode
2021-08-23 14:30:09 +03:00
Bogdan Chadkin
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
Bogdan Chadkin
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
Bogdan Chadkin
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