computed-style
Copies computed styles from source DOM Element to target DOM Element as inline styles.
Install
npm install Hypercubed/copy-styles
Usage
; const source = document;const target = document; ;
Styles object
An optional third parameter can be passed to copyStyles
. If true all computed styles are copied. If false no styles are copied (function has no effect). If the third parameter is an object only those keys with a truthy value are copied. If a value is false or equal to the value of the that property it will not be copied. For example:
;
In this case, the color
style will be copied, font-family
will not (same result if font-family
is absent), margin-left
will only be copied if not equal to '0px'.
See API
License
MIT © J. Harshbarger