-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcssdeclaration.js
63 lines (49 loc) · 1.07 KB
/
cssdeclaration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
**
** The author disclaims copyright to this source code.
**
*/
function CSSDeclaration(options){
var _D = this;
_D.options = null;
_D.declName = "";
_D.declValue = "";
_D.declImportant = false;
_D.debug = false;
if(typeof options != 'undefined'){
_D.options = options;
if(typeof options.name != 'undefined'){
_D.declName = options.name;
}
if(typeof options.value != 'undefined'){
_D.declValue = options.value;
}
if(typeof options.important != 'undefined'){
_D.declImportant = options.important;
}
if(typeof options.debug != 'undefined'){
_D.debug = options.debug;
}
}
if(_D.options == null && _D.debug){
console.log("[debug] No CSS Declaration Options Specified");
}
_D.setName = function(name){
_D.declName = name;
}
_D.setValue = function(value){
_D.declValue = value;
}
_D.toString = function(){
var out = _D.declName;
if(_D.declValue.length > 0){
out += ': ' + _D.declValue;
if(_D.declImportant){
out += ' !important'
}
out += ';';
}
return out;
}
}
module.exports = CSSDeclaration;