computed-styles
v1.1.2
Published
Get the computed styles of a DOM element in a cross browser consistent manner
Downloads
6,685
Maintainers
Readme
computed-style
Get the computed styles of a DOM element in a cross browser consistent manner
Install
npm install computed-styles
Usage
Get computed styles
import computedStyles from 'computed-styles';
computedStyles(document.querySelector('#node')) // returns computed styles as an object
Convert computed styles to inline styles
import computedStyles from 'computed-styles';
var node = document.querySelector('#node');
computedStyles(node, node.styles);
Copy computed styles to another element
import computedStyles from 'computed-styles';
var source = document.querySelector('#source');
var target = document.querySelector('#target');
computedStyles(source, target.styles);
See API
License
MIT © J. Harshbarger