Nagging Penguin Matriarchs
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    css-propertypublic

    css-property Build Status Coverage Status

    NPM

    CSS property constructor

    Install

    Install with npm

    npm install --save css-property
    

    Usage v2

    var selector = require('style-selector'),
        property = require('css-property'),
        bodySelector = selector('body'),
        prop = property('font-family', 'Arial', bodySelector);
     
    console.log(prop.prop);             // font-family
    console.log(prop.value);            // Arial
    console.log(prop.selector.text);    // body
    console.log(prop.toString());       // font-family: Arial;

    Usage v1

    var Selector = require('style-selector'),
        Property = require('css-property'),
        bodySelector = new Selector('body'),
        prop = new Property('font-family', 'Arial', bodySelector);
     
    console.log(prop.prop);             // font-family
    console.log(prop.value);            // Arial
    console.log(prop.selector.text);    // body
    console.log(prop.toString());       // font-family: Arial;

    v2 API

    property(prop, value, selector)

    prop

    Type: String
    Default: none

    Property

    value

    Type: String
    Default: none

    Value

    selector

    Type: Object
    Default: none

    Selector the property originates from.

    property.compare(property)

    Compares with another Property based on Selector#specificity.

    property

    Type: Object
    Default: none

    Property to compare.

    property.toString()

    Returns CSS property.

    v1 API

    Property(prop, value, selector)

    prop

    Type: String
    Default: none

    Property

    value

    Type: String
    Default: none

    Value

    selector

    Type: Object
    Default: none

    Selector the property originates from.

    Property.prototype.compare(property)

    Compares with another Property based on Selector#specificity.

    property

    Type: Object
    Default: none

    Property to compare.

    Property.prototype.toString()

    Returns CSS property.

    Credit

    The code for this module was originally taken from the Juice library.

    License

    MIT

    install

    npm i css-property

    Downloadsweekly downloads

    3,265

    version

    2.0.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar