Skip to content

Get initial values for all CSS properties, as implemented by user agent.

License

Notifications You must be signed in to change notification settings

sbichenko/initial-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

initial-style.js

Compute initial values for all CSS and SVG properties, as implemented by user agent. Ignores perspective-origin and transform-origin properties. Designed primarily for use in extensions.

Works in Chrome and Firefox: Build Status

Install

Bower

bower install initial-style

Without bower

Simply include the initial-style.js file, as it has no dependencies.

Usage

Call:

var initialStyles = InitialStyle.get(options)

Result:

{
    animation-delay:'0s',
    animation-direction:'normal',
    animation-duration:'0s',
    animation-fill-mode:'none',
    animation-iteration-count:'1',
    animation-name:'none',
    ...
    x:'0px',
    y:'0px',
    r:'0px',
    rx:'0px',
    ry:'0px'
}

Options

parentNode - A DOM node to which the dummy element, that is used to calculate style, will be appended. This DOM node should be attached to the document body or be the body itself. Default: document.body.

Participation

I will gladly accept pull requests if the tests are provided.

About

Get initial values for all CSS properties, as implemented by user agent.

Resources

License

Stars

Watchers

Forks

Packages

No packages published