Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81145 views
1
'use strict';
2
3
var shorthandParser = require('../parsers').shorthandParser;
4
var shorthandSetter = require('../parsers').shorthandSetter;
5
var shorthandGetter = require('../parsers').shorthandGetter;
6
7
var shorthand_for = {
8
'border-width': require('./borderWidth'),
9
'border-style': require('./borderStyle'),
10
'border-color': require('./borderColor')
11
};
12
13
var isValid = function isValid(v) {
14
return shorthandParser(v, shorthand_for) !== undefined;
15
};
16
module.exports.isValid = isValid;
17
18
var parser = function (v) {
19
if (v.toString().toLowerCase() === 'none') {
20
v = '';
21
}
22
if (isValid(v)) {
23
return v;
24
}
25
return undefined;
26
};
27
28
var myShorthandSetter = shorthandSetter('border', shorthand_for);
29
var myShorthandGetter = shorthandGetter('border', shorthand_for);
30
31
module.exports.definition = {
32
set: function (v) {
33
if (v.toString().toLowerCase() === 'none') {
34
v = '';
35
}
36
myShorthandSetter.call(this, v);
37
this.removeProperty('border-top');
38
this.removeProperty('border-left');
39
this.removeProperty('border-right');
40
this.removeProperty('border-bottom');
41
this._values['border-top'] = this._values.border;
42
this._values['border-left'] = this._values.border;
43
this._values['border-right'] = this._values.border;
44
this._values['border-bottom'] = this._values.border;
45
},
46
get: myShorthandGetter,
47
enumerable: true,
48
configurable: true
49
};
50
51