Sha256: e8c81f987343edfffe70f324f41f9fd03b80bf25b1d6f95d0cd26a19a040dbfa

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

'use strict';

var TYPES = require('../parsers').TYPES;
var valueType = require('../parsers').valueType;
var shorthandParser = require('../parsers').shorthandParser;
var shorthandSetter = require('../parsers').shorthandSetter;
var shorthandGetter = require('../parsers').shorthandGetter;

var shorthand_for = {
    'font-family': require('./fontFamily'),
    'font-size': require('./fontSize'),
    'font-style': require('./fontStyle'),
    'font-variant': require('./fontVariant'),
    'font-weight': require('./fontWeight'),
    'line-height': require('./lineHeight')
};

var static_fonts = ['caption', 'icon', 'menu', 'message-box', 'small-caption', 'status-bar', 'inherit'];

module.exports.isValid = function isValid(v) {
    return (shorthandParser(v, shorthand_for) !== undefined) ||
        (valueType(v) === TYPES.KEYWORD && static_fonts.indexOf(v.toLowerCase()) !== -1);
};

var setter = shorthandSetter('font', shorthand_for);

module.exports.definition = {
    set: function (v) {
        var short = shorthandParser(v, shorthand_for);
        if (short !== undefined) {
            return setter.call(this, v);
        }
        if (valueType(v) === TYPES.KEYWORD && static_fonts.indexOf(v.toLowerCase()) !== -1) {
            this._setProperty('font', v);
        }
    },
    get: shorthandGetter('font', shorthand_for),
    enumerable: true,
    configurable: true
};

Version data entries

6 entries across 5 versions & 4 rubygems

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