react / wstein / node_modules / jest-cli / node_modules / jsdom / node_modules / cssstyle / lib / properties / border.js
81145 views'use strict';12var shorthandParser = require('../parsers').shorthandParser;3var shorthandSetter = require('../parsers').shorthandSetter;4var shorthandGetter = require('../parsers').shorthandGetter;56var shorthand_for = {7'border-width': require('./borderWidth'),8'border-style': require('./borderStyle'),9'border-color': require('./borderColor')10};1112var isValid = function isValid(v) {13return shorthandParser(v, shorthand_for) !== undefined;14};15module.exports.isValid = isValid;1617var parser = function (v) {18if (v.toString().toLowerCase() === 'none') {19v = '';20}21if (isValid(v)) {22return v;23}24return undefined;25};2627var myShorthandSetter = shorthandSetter('border', shorthand_for);28var myShorthandGetter = shorthandGetter('border', shorthand_for);2930module.exports.definition = {31set: function (v) {32if (v.toString().toLowerCase() === 'none') {33v = '';34}35myShorthandSetter.call(this, v);36this.removeProperty('border-top');37this.removeProperty('border-left');38this.removeProperty('border-right');39this.removeProperty('border-bottom');40this._values['border-top'] = this._values.border;41this._values['border-left'] = this._values.border;42this._values['border-right'] = this._values.border;43this._values['border-bottom'] = this._values.border;44},45get: myShorthandGetter,46enumerable: true,47configurable: true48};495051