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

5 Commits

Author SHA1 Message Date
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
2c0c361074
Collect stylesheet once per plugin (#1456)
computeStyle(node) in isolation is quite slow utility because it
collects style elements across whole document, parses and sort them.

In this diff I splitted it into `collectStylesheet(root)` and
`computeStyle(stylesheet, node)` which are easy integrate with new
visitor plugin api.
2021-08-12 03:08:39 +03:00
Bogdan Chadkin
4cacd9e676
Migrate ast traversing into xast module (#1434)
Replaced JSAPI methods with new utilities

- querySelectorAll(node, selector)
- querySelector(node, selector)
- matches(node, selector)
- closestByName(node, elementName)
- traverse(node, fn)

New traverse replaced many in-place implementations.
2021-03-19 11:06:41 +03:00
Bogdan Chadkin
ddbd7046b2 Ignore keyframes in computeStyle
Ref https://github.com/svg/svgo/issues/1408
2021-03-09 01:47:56 +03:00
Bogdan Chadkin
be28d65d78
Implement style computing (#1399)
Ref https://github.com/svg/svgo/issues/777

Currently a lot of optimisations are attributes specific and may be
broken because of inline or shared styles.

In this diff I'm trying to solve the problem with getComputedStyle
analog.

`computeStyle` collects attributes, shared css rules, inline styles
and inherited styles and checks whether they can be statically optimised
or left as deoptimisation.
2021-03-04 13:13:44 +03:00