snapshot-node
v0.0.1
Published
Clone a HTML node & apply computed styles recursively to the cloned node.
Downloads
1
Readme
snapshot-node
Clone a HTML node & apply computed styles recursively to the cloned node.
Install
npm install snapshot-node --save
Usage
import {snapshotNode} from 'snapshot-node'
const target = document.getElementById('target')
const snapshot = snapshotNode(target)
// target element and its ancestors's computed styles will be saved as inline styles of snapshot's corresponding element.
See test for a more complete example.
Limitations
Only HTMLElement & SVGElements' styles are snapshotted.
License
MIT