-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtmlattribute.js
54 lines (41 loc) · 954 Bytes
/
htmlattribute.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
/*
**
** The author disclaims copyright to this source code.
**
*/
function HTMLAttribute(options){
var _N = this;
_N.options = null;
_N.attrName = "";
_N.attrValue = "";
_N.debug = false;
if(typeof options != 'undefined'){
_N.options = options;
if(typeof options.name != 'undefined'){
_N.attrName = options.name;
}
if(typeof options.value != 'undefined'){
_N.attrValue = options.value;
}
if(typeof options.debug != 'undefined'){
_N.debug = options.debug;
}
}
if(_N.options == null && _D.debug){
console.log("[debug] No Attribute Options Specified");
}
_N.setName = function(name){
_N.attrName = name;
}
_N.setValue = function(value){
_N.attrValue = value;
}
_N.toString = function(){
var out = _N.attrName;
if(_N.attrValue.length > 0){
out += '="' + _N.attrValue + '"';
}
return out;
}
}
module.exports = HTMLAttribute;