computed-styles

1.1.2 • Public • Published

computed-style

NPM version Build Status Downloads

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

Package Sidebar

Install

npm i computed-styles

Weekly Downloads

2,041

Version

1.1.2

License

MIT

Last publish

Collaborators

  • hypercubed