Project Docs Github
Log in
ittf site docs t _js wz cssBuilder.js.ittf Edit
  • /ittf/site/docs/t/_js/wz/cssBuilder.js.ittf

/ittf/site/docs/t/_js/wz/cssBuilder.js.ittf (primary)

edit
                                            
1 $group
2 class wzCssRule
3 ctor
4 param name
5 set this.name = name
6 set this.values = {}
7 m set
8 param name
9 param value
10 set this.values[name] = value
11 toCss
12 var ret = [ this.name ]
13 foreach name in Object.keys(this.values)
14 var item = this.values[name]
15 _ ret.push
16 @ '\t' + item.name + ': ' + item.value + ';'
17 return ret.join('\n')
18 class wzCssBuilder
19 ctor
20 param elementId
21 param tag
22 set this.elementId = elementId
23 set this.root
24 {
25 @ tag tag || 'div'
26 @ parent null
27 { attributes
28 [ children
29 set this.current = this.root
30 m set
31 param attributeName
32 param attributeValue
33 set this.current[attributeName] = attributeValue
34 _ this.update
35 m add
36 param tag
37 _ this.current.children.push
38 {
39 @ tag tag || 'div'
40 @ parent this.current
41 { attributes
42 [ children
43 _ this.update
44 return this.current.children[this.current.children.length - 1]
45 m toCss
46 var ret = []
47 foreach rule in this.rules
48 _ ret.push
49 _ rule.toCss
50 return ret.join('\n')
51 m update
52 var element = document.querySelector('#' + this.elementId)
53 set element.innerHTML = this.toCss()
Save
Save & Refresh
Cancel