dom-inline-style-filter
v3.0.5
Published
High-pass data compression filter for inline styling (embedded CSS) by computed effect.
Readme
dom-inline-style-filter
dom-inline-style-filter library filters inline style declarations for a standalone DOM element tree by computed effect.
- As web developers, we would like elements that ship only with inline styling to be light so that they can be included in NPM packages.
- A main use case of this is SVG screenshots of HTML elements.
- Even after a filter algorithm to filter out user agent styling when inlining the style, there is some way to go with data size.
Usage
dominlinestylefilter(node)
Parameter: node - a HTMLElement with all style rules embedded as inline style attributes or <style> tags.
Returns: a Promise that resolves to node. Within node, all inline styling has been filtered to the minimum declarations that produce the same computed style.
dominlinestylefilter.sync(node)
Synchronous version. Returns node when the styling compression is completed.
