get-default-style.js

1.0.3 • Public • Published

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%

/get-default-style.js/

    Package Sidebar

    Install

    npm i get-default-style.js

    Weekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • igari