Sha256: e02244694582bcd28b0b7dffde1fb17ce48958e19ec55fde61b95c2d3c2f3d15

Contents?: true

Size: 1019 Bytes

Versions: 4

Compression:

Stored size: 1019 Bytes

Contents

'use strict';

var parsers = require('../parsers');

// <length> <length>? | inherit
// if one, it applies to both horizontal and verical spacing
// if two, the first applies to the horizontal and the second applies to vertical spacing

var parse = function parse(v) {
    if (v === '' || v === null) {
        return undefined;
    }
    if (v.toLowerCase() === 'inherit') {
        return v;
    }
    var parts = v.split(/\s+/);
    if (parts.length !== 1 && parts.length !== 2) {
        return undefined;
    }
    parts.forEach(function (part) {
        if (parsers.valueType(part) !== parsers.TYPES.LENGTH) {
            return undefined;
        }
    });

    return v;
};

module.exports.isValid = function isValid(v) {
    return parse(v) !== undefined;
};

module.exports.definition = {
    set: function (v) {
        this._setProperty('border-spacing', parse(v));
    },
    get: function () {
        return this.getPropertyValue('border-spacing');
    },
    enumerable: true,
    configurable: true
};

Version data entries

4 entries across 4 versions & 4 rubygems

Version Path
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/cssstyle/lib/properties/borderSpacing.js
locomotivecms-3.4.0 app/javascript/node_modules/jest-environment-jsdom/node_modules/cssstyle/lib/properties/borderSpacing.js
lanes-0.8.0 node_modules/cssstyle/lib/properties/borderSpacing.js
select_all-rails-0.3.1 node_modules/cssstyle/lib/properties/borderSpacing.js