get-default-style.js
v1.0.3
Published
An API which is able to get default computed value(except for width / height) in state of non specified style via dummy ifame in the browser.
Downloads
6
Readme
getDefaultStyle
An API which is able to get default computed value(except for width / height) in state of non specified style via dummy ifame in the browser.
Installation
bower install get-default-style.js
or
yarn add get-default-style.js
Load with script tag
<script src="/path/to/get-default-style.js">
Usage
Almost the same as getComputedStyle
let style = getDefaultStyle(element[, pseudoElt]);
API
getPropertyValue
style.getPropertyValue(propertyName);//any value
Example
let div = document.querySelector('div');
let style = getDefaultStyle(div);
style.getPropertyValue('width');//auto
style.getPropertyValue('margin-top');//0px
style.getPropertyValue('background-position');//0% 0%