material 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/index.js +11 -2
  2. package/package.json +1 -1
  3. package/src/appbar.js +28 -28
  4. package/src/banner.js +20 -20
  5. package/src/button.js +18 -19
  6. package/src/calendar.js +8 -8
  7. package/src/card.js +4 -4
  8. package/src/checkbox.js +8 -8
  9. package/src/component.js +4 -4
  10. package/src/container.js +4 -4
  11. package/src/control/button.js +64 -88
  12. package/src/control/button.new.js +25 -25
  13. package/src/control/datehour.js +4 -4
  14. package/src/control/dialog.js +12 -11
  15. package/src/control/file.js +8 -8
  16. package/src/control/image.js +6 -6
  17. package/src/control/link.js +9 -9
  18. package/src/control/list.js +25 -35
  19. package/src/control/loading.js +10 -10
  20. package/src/control/menu.js +85 -0
  21. package/src/control/search.js +9 -9
  22. package/src/control/select.js +6 -6
  23. package/src/control/selecter.js +15 -15
  24. package/src/control/snackbar.js +91 -0
  25. package/src/control/switch.js +18 -18
  26. package/src/control/switcher.js +16 -16
  27. package/src/control/text.js +11 -7
  28. package/src/control/textfield.js +12 -12
  29. package/src/dialog.js +19 -19
  30. package/src/divider.js +4 -4
  31. package/src/drawer.js +11 -11
  32. package/src/element.js +6 -31
  33. package/src/field/email.js +5 -5
  34. package/src/field/image.js +4 -4
  35. package/src/form/build.js +7 -7
  36. package/src/form.js +6 -6
  37. package/src/icon.js +8 -8
  38. package/src/image.js +14 -14
  39. package/src/item.js +7 -7
  40. package/src/layout.js +10 -10
  41. package/src/list/add.js +1 -1
  42. package/src/list/build.js +7 -7
  43. package/src/list/display.js +10 -10
  44. package/src/list/search.js +2 -2
  45. package/src/list.js +13 -13
  46. package/src/map/build.js +6 -6
  47. package/src/map/display.js +8 -8
  48. package/src/menu.js +15 -15
  49. package/src/{component → mixin}/control.js +10 -10
  50. package/src/{component → mixin}/create.js +1 -1
  51. package/src/mixin/display.js +76 -0
  52. package/src/mixin/emitter.js +23 -0
  53. package/src/{component → mixin}/events.js +2 -2
  54. package/src/{component → mixin}/focus.js +2 -3
  55. package/src/{component → mixin}/insert.js +1 -1
  56. package/src/module/build.js +44 -0
  57. package/src/{component → module}/classify.js +0 -13
  58. package/src/module/dataset.js +12 -0
  59. package/src/module/dom.js +1 -57
  60. package/src/module/events.js +57 -0
  61. package/src/module/jsontohtml.js +20 -0
  62. package/src/module/last.js +0 -0
  63. package/src/{component → module}/ripple.js +15 -42
  64. package/src/progress.js +7 -7
  65. package/src/select.js +16 -16
  66. package/src/selector.js +32 -32
  67. package/src/skin/material/control/menu.sass +29 -0
  68. package/src/skin/material/control/snackbar.sass +65 -0
  69. package/src/slider.js +32 -32
  70. package/src/snackbar.js +8 -8
  71. package/src/switch.js +9 -9
  72. package/src/tabs.js +8 -8
  73. package/src/tabview.js +8 -8
  74. package/src/text.js +5 -5
  75. package/src/textfield.js +16 -16
  76. package/src/toolbar.js +28 -28
  77. package/src/tooltip.js +11 -11
  78. package/src/tree.js +12 -16
  79. package/src/view/build.js +7 -7
  80. package/src/view/display.js +16 -16
  81. package/src/view.js +5 -5
  82. package/src/component/click.js +0 -17
  83. /package/src/{component → mixin}/controller.js +0 -0
  84. /package/src/{component → mixin}/icon.js +0 -0
  85. /package/src/{component → mixin}/init.js +0 -0
  86. /package/src/{component → mixin}/label.js +0 -0
  87. /package/src/{component → mixin}/settings.js +0 -0
@@ -1,117 +1,107 @@
1
- import emitter from '../module/emitter'
2
- import attach from '../module/attach'
3
-
4
- import dataset from '../view/dataset'
5
-
6
- const defaults = {
7
- class: 'button',
8
- tag: 'button',
9
- styles: ['style', 'color'],
10
- stopPropagation: false,
11
- events: [
12
- ['root.click', 'click'],
13
- ['root.mousedown', 'mousedown'],
14
- ['root.mouseup', 'mouseup'],
15
- ['root.mouseleave', 'mouseup'],
16
- ['root.touchstart', 'mousedown'],
17
- ['root.touchend', 'mouseup']
18
- ]
1
+ import EventEmitter from '../mixin/emitter'
19
2
 
20
- }
3
+ import build from '../module/build'
4
+ import display from '../mixin/display'
5
+ import bindEvents from '../module/events'
6
+
7
+ import dataset from '../module/dataset'
8
+ import ripple from '../module/ripple'
21
9
 
22
- class Button {
10
+ class Button extends EventEmitter{
23
11
  static isComponent () {
24
12
  return true
25
13
  }
26
14
 
15
+ static defaults = {
16
+ class: 'button',
17
+ tag: 'button',
18
+ modules: [build, bindEvents],
19
+ styles: ['style', 'color'],
20
+ ripple: false,
21
+ stopPropagation: false,
22
+ events: [
23
+ ['element.click', 'click'],
24
+ ['element.mousedown', 'mousedown'],
25
+ ['element.mouseup', 'mouseup'],
26
+ ['element.mouseleave', 'mouseup'],
27
+ ['element.touchstart', 'mousedown'],
28
+ ['element.touchend', 'mouseup']
29
+ ]
30
+ }
31
+
27
32
  /**
28
33
  * Constructor
29
34
  * @param {Object} options - Component options
30
35
  * @return {Object} Class instance
31
36
  */
32
37
  constructor (options) {
33
- this.options = Object.assign({}, defaults, options || {})
34
- Object.assign(this, emitter, attach)
35
- // console.log('options', options)
36
-
37
- this.init()
38
-
39
- return this
40
- }
38
+ super()
41
39
 
42
- init () {
40
+ this.init(options)
43
41
  this.build()
44
42
  this.setup()
45
- this.attach()
43
+ this.bindEvents()
46
44
 
47
45
  if (this.options.container) {
48
46
  this.append(this.options.container)
49
47
  }
48
+
49
+ return this
50
50
  }
51
51
 
52
- /**
53
- * Build Method
54
- * @return {Object} This class instance
55
- */
56
- build () {
57
- this.root = document.createElement(this.options.tag)
52
+ init (options) {
53
+ this.options = Object.assign({}, Button.defaults, options || {})
54
+ Object.assign(this, build, display, bindEvents)
58
55
 
59
- if (this.options.class !== 'button') {
60
- this.root.setAttribute('class', 'button ' + this.options.class)
61
- } else {
62
- this.root.classList.add('button')
63
- }
56
+ }
64
57
 
58
+ setup () {
65
59
  this.styleAttributes()
66
60
 
67
61
  this.buildIcon()
68
62
  this.buildLabel()
69
63
 
70
64
  if (this.options.text) {
71
- this.root.innerHTML = this.root.innerHTML + this.options.text
65
+ this.element.innerHTML = this.element.innerHTML + this.options.text
72
66
  }
73
67
 
74
- return this
75
- }
76
-
77
- setup () {
78
68
  if (this.options.data) {
79
- dataset(this.root, this.options.data)
69
+ dataset(this.element, this.options.data)
80
70
  }
81
71
 
82
72
  if (this.options.type) {
83
- this.root.setAttribute('type', this.options.type)
73
+ this.element.setAttribute('type', this.options.type)
84
74
  } else {
85
- this.root.setAttribute('type', 'button')
75
+ this.element.setAttribute('type', 'button')
86
76
  }
87
77
 
88
78
  if (this.options.name) {
89
- this.root.setAttribute('name', this.options.name)
79
+ this.element.setAttribute('name', this.options.name)
90
80
  }
91
81
 
92
82
  if (this.options.value) {
93
- this.root.setAttribute('value', this.options.value)
83
+ this.element.setAttribute('value', this.options.value)
94
84
  }
95
85
 
96
86
  if (this.options.title) {
97
- this.root.setAttribute('title', this.options.title)
87
+ this.element.setAttribute('title', this.options.title)
98
88
  }
99
89
 
100
- this.root.setAttribute('aria-label', this.options.text || this.options.label || this.options.class)
90
+ this.element.setAttribute('aria-label', this.options.text || this.options.label || this.options.class)
101
91
 
102
92
  if (this.options.tooltip) {
103
- this.root.setAttribute('data-tooltip', this.options.tooltip)
93
+ this.element.setAttribute('data-tooltip', this.options.tooltip)
104
94
  }
105
95
 
106
96
  if (this.options.case) {
107
- this.root.classList.add(this.options.case + '-case')
97
+ this.element.classList.add(this.options.case + '-case')
108
98
  }
109
99
  }
110
100
 
111
101
  append (container) {
112
102
  container = container || this.options.container
113
103
  if (this.options.container) {
114
- container.appendChild(this.root)
104
+ container.appendChild(this.element)
115
105
  }
116
106
  }
117
107
 
@@ -123,7 +113,7 @@ class Button {
123
113
  this.label.classList.add('label')
124
114
  this.label.innerHTML = this.options.label
125
115
 
126
- this.root.appendChild(this.label)
116
+ this.element.appendChild(this.label)
127
117
  }
128
118
  }
129
119
 
@@ -135,25 +125,25 @@ class Button {
135
125
  this.icon.classList.add('icon')
136
126
  this.icon.innerHTML = this.options.icon
137
127
 
138
- this.root.appendChild(this.icon)
128
+ this.element.appendChild(this.icon)
139
129
  }
140
130
  }
141
131
 
142
132
  styleAttributes () {
143
133
  if (this.options.style) {
144
- this.root.classList.add('style-' + this.options.style)
134
+ this.element.classList.add('style-' + this.options.style)
145
135
  }
146
136
 
147
137
  if (this.options.size) {
148
- this.root.classList.add(this.options.size + '-size')
138
+ this.element.classList.add(this.options.size + '-size')
149
139
  }
150
140
 
151
141
  if (this.options.color) {
152
- this.root.classList.add('color-' + this.options.color)
142
+ this.element.classList.add('color-' + this.options.color)
153
143
  }
154
144
 
155
145
  if (this.options.bold) {
156
- this.root.classList.add('bold')
146
+ this.element.classList.add('bold')
157
147
  }
158
148
  }
159
149
 
@@ -164,10 +154,10 @@ class Button {
164
154
  * @return {Object} The class instance
165
155
  */
166
156
  set (prop, value) {
167
- // console.log('set', this.root, prop, value)
157
+ // console.log('set', this.element, prop, value)
168
158
  switch (prop) {
169
159
  case 'value':
170
- this.root.value = value
160
+ this.element.value = value
171
161
  break
172
162
  case 'label':
173
163
  if (this.label) {
@@ -175,16 +165,16 @@ class Button {
175
165
  }
176
166
  break
177
167
  case 'text':
178
- this.root.innerHTML = value
168
+ this.element.innerHTML = value
179
169
  break
180
170
  case 'icon':
181
- if (this.label) {
171
+ if (this.icon) {
182
172
  this.icon.innerHTML = value
183
173
  }
184
174
  break
185
175
  default:
186
176
  // console.log('prop', prop)
187
- this.root.innerHTML = prop
177
+ this.element.innerHTML = prop
188
178
  }
189
179
 
190
180
  return this
@@ -200,7 +190,7 @@ class Button {
200
190
  if (this.label) {
201
191
  this.setLabel(value)
202
192
  } else {
203
- this.root.innerHTML = value
193
+ this.element.innerHTML = value
204
194
  }
205
195
  }
206
196
 
@@ -213,34 +203,20 @@ class Button {
213
203
  get (prop, value) {
214
204
  switch (prop) {
215
205
  case 'value':
216
- return this.root.value
206
+ return this.element.value
217
207
  case 'label':
218
208
  return this.label.innerHTML
219
209
  default:
220
- return this.root.value
210
+ return this.element.value
221
211
  }
222
212
  }
223
213
 
224
214
  disable () {
225
- this.root.disabled = true
215
+ this.element.disabled = true
226
216
  }
227
217
 
228
218
  enable () {
229
- this.root.disabled = false
230
- }
231
-
232
- hide () {
233
- this.root.classList.add('hide')
234
- }
235
-
236
- show () {
237
- this.root.classList.remove('hide')
238
- }
239
-
240
- destroy () {
241
- if (this.root && this.root.parentNode) {
242
- this.root.parentNode.removeChild(this.root)
243
- }
219
+ this.element.disabled = false
244
220
  }
245
221
 
246
222
  click (ev) {
@@ -252,11 +228,11 @@ class Button {
252
228
  }
253
229
 
254
230
  mousedown (ev) {
255
- this.root.classList.add('pushed')
231
+ this.element.classList.add('pushed')
256
232
  }
257
233
 
258
234
  mouseup (ev) {
259
- this.root.classList.remove('pushed')
235
+ this.element.classList.remove('pushed')
260
236
  }
261
237
  }
262
238
 
@@ -41,17 +41,17 @@ class Button {
41
41
  * @return {Object} This class instance
42
42
  */
43
43
  build () {
44
- this.root = document.createElement(this.options.tag)
44
+ this.element = document.createElement(this.options.tag)
45
45
 
46
46
  if (this.options.class !== 'button') {
47
- this.root.classList.add('button')
47
+ this.element.classList.add('button')
48
48
  }
49
49
 
50
- this.root.classList.add(this.options.class)
50
+ this.element.classList.add(this.options.class)
51
51
  this.styleAttributes()
52
52
 
53
53
  if (this.options.text) {
54
- this.root.innerHTML = this.options.text
54
+ this.element.innerHTML = this.options.text
55
55
  }
56
56
 
57
57
  if (this.options.label) {
@@ -63,33 +63,33 @@ class Button {
63
63
 
64
64
  setup () {
65
65
  if (this.options.data) {
66
- dataset(this.root, this.options.data)
66
+ dataset(this.element, this.options.data)
67
67
  }
68
68
 
69
69
  if (this.options.type) {
70
- this.root.setAttribute('type', this.options.type)
70
+ this.element.setAttribute('type', this.options.type)
71
71
  } else {
72
- this.root.setAttribute('type', 'button')
72
+ this.element.setAttribute('type', 'button')
73
73
  }
74
74
 
75
75
  if (this.options.name) {
76
- this.root.setAttribute('name', this.options.name)
76
+ this.element.setAttribute('name', this.options.name)
77
77
  }
78
78
 
79
- this.root.setAttribute('aria-label', this.options.text || this.options.label || this.options.class)
79
+ this.element.setAttribute('aria-label', this.options.text || this.options.label || this.options.class)
80
80
 
81
81
  if (this.options.tooltip) {
82
- this.root.setAttribute('data-tooltip', this.options.tooltip)
82
+ this.element.setAttribute('data-tooltip', this.options.tooltip)
83
83
  }
84
84
 
85
85
  if (this.options.case) {
86
- this.root.classList.add(this.options.case + '-case')
86
+ this.element.classList.add(this.options.case + '-case')
87
87
  }
88
88
  }
89
89
 
90
90
  append (container) {
91
91
  if (this.options.container) {
92
- this.options.container.appendChild(this.root)
92
+ this.options.container.appendChild(this.element)
93
93
  }
94
94
  }
95
95
 
@@ -97,7 +97,7 @@ class Button {
97
97
  if (this.options.label) {
98
98
  this.label = document.createElement('label')
99
99
  this.label.innerHTML = this.options.label
100
- this.root.appendChild(this.label)
100
+ this.element.appendChild(this.label)
101
101
  }
102
102
  }
103
103
 
@@ -105,26 +105,26 @@ class Button {
105
105
  if (this.options.icon) {
106
106
  this.label = document.createElement('label')
107
107
  this.label.innerHTML = this.options.label
108
- this.root.appendChild(this.label)
108
+ this.element.appendChild(this.label)
109
109
  }
110
110
  }
111
111
 
112
112
  styleAttributes () {
113
113
  if (this.options.style) {
114
- this.root.classList.add('style-' + this.options.style)
114
+ this.element.classList.add('style-' + this.options.style)
115
115
  }
116
116
 
117
117
  if (this.options.color) {
118
- this.root.classList.add('color-' + this.options.color)
118
+ this.element.classList.add('color-' + this.options.color)
119
119
  }
120
120
 
121
121
  if (this.options.bold) {
122
- this.root.classList.add('bold')
122
+ this.element.classList.add('bold')
123
123
  }
124
124
  }
125
125
 
126
126
  attach () {
127
- this.root.addEventListener('click', (ev) => {
127
+ this.element.addEventListener('click', (ev) => {
128
128
  this.emit('click', ev)
129
129
  })
130
130
  }
@@ -138,7 +138,7 @@ class Button {
138
138
  set (prop, value) {
139
139
  switch (prop) {
140
140
  case 'value':
141
- this.root.value = value
141
+ this.element.value = value
142
142
  break
143
143
  case 'label':
144
144
  if (this.ui.label) {
@@ -151,7 +151,7 @@ class Button {
151
151
  }
152
152
  break
153
153
  default:
154
- this.root.value = value
154
+ this.element.value = value
155
155
  }
156
156
 
157
157
  return this
@@ -166,24 +166,24 @@ class Button {
166
166
  get (prop, value) {
167
167
  switch (prop) {
168
168
  case 'value':
169
- return this.root.value
169
+ return this.element.value
170
170
  case 'label':
171
171
  return this.ui.label.innerHTML
172
172
  default:
173
- return this.root.value
173
+ return this.element.value
174
174
  }
175
175
  }
176
176
 
177
177
  disable () {
178
- this.root.disabled = true
178
+ this.element.disabled = true
179
179
  }
180
180
 
181
181
  enable () {
182
- this.root.disabled = false
182
+ this.element.disabled = false
183
183
  }
184
184
 
185
185
  destroy () {
186
- this.root.parentNode.removeChild(this.root)
186
+ this.element.parentNode.removeChild(this.element)
187
187
  }
188
188
  }
189
189
 
@@ -33,11 +33,11 @@ class DateHour {
33
33
  * @return {Object} This class instance
34
34
  */
35
35
  build () {
36
- this.root = document.createElement(this.options.tag)
37
- this.root.classList.add(this.options.class)
36
+ this.element = document.createElement(this.options.tag)
37
+ this.element.classList.add(this.options.class)
38
38
 
39
39
  if (this.options.container) {
40
- this.options.container.appendChild(this.root)
40
+ this.options.container.appendChild(this.element)
41
41
  }
42
42
 
43
43
  return this
@@ -47,7 +47,7 @@ class DateHour {
47
47
  // console.log('set', src)
48
48
  var d = new Date(date)
49
49
  var formatted = this.format(d)
50
- this.root.innerHTML = formatted
50
+ this.element.innerHTML = formatted
51
51
  }
52
52
 
53
53
  format (date) {
@@ -1,5 +1,3 @@
1
- 'use strict'
2
-
3
1
  // dialog related modules
4
2
  import emitter from '../module/emitter'
5
3
  import attach from '../module/attach'
@@ -27,7 +25,7 @@ let defaults = {
27
25
  ]
28
26
  ],
29
27
  events: [
30
- ['root.click', 'onClickRoot'],
28
+ ['element.click', 'onClickRoot'],
31
29
  ['surface.click', 'onClick'],
32
30
  ['ui.ok.click', 'ok'],
33
31
  ['ui.cancel.click', 'cancel'],
@@ -59,26 +57,28 @@ class Dialog {
59
57
  * @return {Object} The class instance
60
58
  */
61
59
  build () {
62
- this.root = document.createElement('div')
63
- this.root.classList.add('dialog')
60
+ this.element = document.createElement('div')
61
+ this.element.classList.add('dialog')
62
+
63
+ this.element = this.element
64
64
 
65
65
  if (this.options.class !== 'dialog') {
66
- this.root.classList.add(this.options.class)
66
+ this.element.classList.add(this.options.class)
67
67
  }
68
68
 
69
69
  if (this.options.position) {
70
- this.root.classList.add('position-' + this.options.position)
70
+ this.element.classList.add('position-' + this.options.position)
71
71
  }
72
72
 
73
73
  this.surface = document.createElement('div')
74
74
  this.surface.classList.add('surface')
75
- this.root.appendChild(this.surface)
75
+ this.element.appendChild(this.surface)
76
76
 
77
77
  this.layout = new Layout(this.options.layout, this.surface)
78
78
  this.ui = this.layout.component
79
79
 
80
80
  if (this.options.container) {
81
- this.options.container.appendChild(this.root)
81
+ this.options.container.appendChild(this.element)
82
82
  }
83
83
 
84
84
  if (this.options.display === 'show') {
@@ -149,6 +149,7 @@ class Dialog {
149
149
  }
150
150
 
151
151
  onClickRoot (e) {
152
+ // console.log('onClickRoot')
152
153
  e.stopPropagation()
153
154
  if (!this.options.modal) {
154
155
  this.destroy()
@@ -156,11 +157,11 @@ class Dialog {
156
157
  }
157
158
 
158
159
  emphase () {
159
- this.root.classList.add('emphase')
160
+ this.element.classList.add('emphase')
160
161
  var it
161
162
  it = setTimeout(() => {
162
163
  clearTimeout(it)
163
- this.root.classList.remove('emphase')
164
+ this.element.classList.remove('emphase')
164
165
  }, 100)
165
166
  }
166
167
 
@@ -28,18 +28,18 @@ class File {
28
28
  * @return {Object} This class instance
29
29
  */
30
30
  build () {
31
- this.root = document.createElement('div')
32
- this.root.classList.add('file')
31
+ this.element = document.createElement('div')
32
+ this.element.classList.add('file')
33
33
 
34
34
  if (this.options.class !== 'file') {
35
- this.root.classList.add(this.options.class)
35
+ this.element.classList.add(this.options.class)
36
36
  }
37
37
 
38
38
  this.buildLabel()
39
39
  this.buildInput()
40
40
 
41
41
  if (this.options.data) {
42
- dataset(this.root, this.options.data)
42
+ dataset(this.element, this.options.data)
43
43
  }
44
44
 
45
45
  if (this.options.focus) {
@@ -47,7 +47,7 @@ class File {
47
47
  }
48
48
 
49
49
  if (this.options.container) {
50
- this.options.container.appendChild(this.root)
50
+ this.options.container.appendChild(this.element)
51
51
  }
52
52
 
53
53
  return this
@@ -58,18 +58,18 @@ class File {
58
58
  this.label = document.createElement('label')
59
59
  this.label.classList.add('label')
60
60
  this.label.innerHTML = this.options.label
61
- this.root.appendChild(this.label)
61
+ this.element.appendChild(this.label)
62
62
  }
63
63
  }
64
64
 
65
65
  buildInput () {
66
66
  this.field = document.createElement('div')
67
67
  this.field.classList.add('field')
68
- this.root.appendChild(this.field)
68
+ this.element.appendChild(this.field)
69
69
 
70
70
  this.input = document.createElement('input')
71
71
  this.input.setAttribute('type', 'file')
72
- this.root.appendChild(this.input)
72
+ this.element.appendChild(this.input)
73
73
 
74
74
  attributes(this.input, this.options)
75
75
 
@@ -38,14 +38,14 @@ class Image {
38
38
  * @return {Object} This class instance
39
39
  */
40
40
  build () {
41
- this.root = document.createElement(this.options.tag)
42
- this.root.classList.add(this.options.class)
41
+ this.element = document.createElement(this.options.tag)
42
+ this.element.classList.add(this.options.class)
43
43
  if (this.options.class !== 'image') {
44
- this.root.classList.add('image')
44
+ this.element.classList.add('image')
45
45
  }
46
46
 
47
47
  if (this.options.container) {
48
- this.options.container.appendChild(this.root)
48
+ this.options.container.appendChild(this.element)
49
49
  }
50
50
 
51
51
  return this
@@ -54,7 +54,7 @@ class Image {
54
54
  set (src) {
55
55
  // console.log('set', src)
56
56
  if (!src) {
57
- this.root.style.backgroundImage = ''
57
+ this.element.style.backgroundImage = ''
58
58
  } else {
59
59
  var url = null
60
60
 
@@ -75,7 +75,7 @@ class Image {
75
75
  url = src.url
76
76
  }
77
77
 
78
- this.root.style.backgroundImage = 'url(' + url + src.filename + ')'
78
+ this.element.style.backgroundImage = 'url(' + url + src.filename + ')'
79
79
  }
80
80
  }
81
81
 
@@ -24,11 +24,11 @@ class Link {
24
24
  * @return {Object} This class instance
25
25
  */
26
26
  build () {
27
- this.root = document.createElement(this.options.tag)
28
- this.root.classList.add(this.options.class)
27
+ this.element = document.createElement(this.options.tag)
28
+ this.element.classList.add(this.options.class)
29
29
 
30
30
  if (this.options.class !== 'link') {
31
- this.root.classList.add('link')
31
+ this.element.classList.add('link')
32
32
  }
33
33
 
34
34
  if (this.options.link) {
@@ -36,15 +36,15 @@ class Link {
36
36
  }
37
37
 
38
38
  if (this.options.target !== 'blank') {
39
- this.root.target = this.options.target
39
+ this.element.target = this.options.target
40
40
  }
41
41
 
42
42
  if (this.options.container) {
43
- this.options.container.appendChild(this.root)
43
+ this.options.container.appendChild(this.element)
44
44
  }
45
45
 
46
46
  if (this.options.text) {
47
- this.root.innerHTML = this.options.text
47
+ this.element.innerHTML = this.options.text
48
48
  }
49
49
 
50
50
  return this
@@ -55,13 +55,13 @@ class Link {
55
55
  if (link === undefined) return
56
56
 
57
57
  if (this.options.target === 'blank') {
58
- this.root.href = '#'
59
- this.root.addEventListener('click', () => {
58
+ this.element.href = '#'
59
+ this.element.addEventListener('click', () => {
60
60
  window.open(link)
61
61
  return false
62
62
  })
63
63
  } else {
64
- this.root.href = link
64
+ this.element.href = link
65
65
  }
66
66
  }
67
67
  }