material 0.6.2 → 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 (82) 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 -92
  12. package/src/control/button.new.js +25 -25
  13. package/src/control/datehour.js +4 -4
  14. package/src/control/dialog.js +10 -10
  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 +3 -3
  19. package/src/control/loading.js +10 -10
  20. package/src/control/menu.js +2 -2
  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 +7 -5
  25. package/src/control/switch.js +18 -18
  26. package/src/control/switcher.js +16 -16
  27. package/src/control/text.js +8 -8
  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/field/email.js +5 -5
  33. package/src/field/image.js +4 -4
  34. package/src/form/build.js +7 -7
  35. package/src/form.js +6 -6
  36. package/src/icon.js +8 -8
  37. package/src/image.js +14 -14
  38. package/src/item.js +7 -7
  39. package/src/layout.js +10 -10
  40. package/src/list/add.js +1 -1
  41. package/src/list/build.js +7 -7
  42. package/src/list/display.js +10 -10
  43. package/src/list/search.js +2 -2
  44. package/src/list.js +13 -13
  45. package/src/map/build.js +6 -6
  46. package/src/map/display.js +8 -8
  47. package/src/menu.js +15 -15
  48. package/src/{component → mixin}/control.js +10 -10
  49. package/src/{component → mixin}/create.js +1 -1
  50. package/src/{module → mixin}/display.js +10 -22
  51. package/src/{component → mixin}/events.js +2 -2
  52. package/src/{component → mixin}/focus.js +2 -3
  53. package/src/{component → mixin}/insert.js +1 -1
  54. package/src/module/build.js +4 -3
  55. package/src/{component → module}/classify.js +0 -13
  56. package/src/module/dom.js +1 -57
  57. package/src/module/events.js +4 -2
  58. package/src/module/last.js +0 -0
  59. package/src/{component → module}/ripple.js +15 -42
  60. package/src/progress.js +7 -7
  61. package/src/select.js +16 -16
  62. package/src/selector.js +32 -32
  63. package/src/slider.js +32 -32
  64. package/src/snackbar.js +8 -8
  65. package/src/switch.js +9 -9
  66. package/src/tabs.js +8 -8
  67. package/src/tabview.js +8 -8
  68. package/src/text.js +5 -5
  69. package/src/textfield.js +16 -16
  70. package/src/toolbar.js +28 -28
  71. package/src/tooltip.js +11 -11
  72. package/src/tree.js +12 -16
  73. package/src/view/build.js +6 -6
  74. package/src/view/display.js +16 -16
  75. package/src/view.js +5 -5
  76. package/src/component/click.js +0 -17
  77. /package/src/{component → mixin}/controller.js +0 -0
  78. /package/src/{component → mixin}/emitter.js +0 -0
  79. /package/src/{component → mixin}/icon.js +0 -0
  80. /package/src/{component → mixin}/init.js +0 -0
  81. /package/src/{component → mixin}/label.js +0 -0
  82. /package/src/{component → mixin}/settings.js +0 -0
@@ -10,9 +10,9 @@ export default {
10
10
  show () {
11
11
  // console.log('show', this.visible)
12
12
 
13
- this.root.getBoundingClientRect()
13
+ this.element.getBoundingClientRect()
14
14
 
15
- this.root.classList.add('show')
15
+ this.element.classList.add('show')
16
16
  this.visible = true
17
17
 
18
18
  if (this.underlay) {
@@ -26,11 +26,11 @@ export default {
26
26
  },
27
27
 
28
28
  hide () {
29
- // console.log('hide', this.root.style.display)
29
+ // console.log('hide', this.element.style.display)
30
30
 
31
- if (!this.root) return
31
+ if (!this.element) return
32
32
 
33
- this.root.classList.remove('show')
33
+ this.element.classList.remove('show')
34
34
  this.visible = false
35
35
 
36
36
  if (this.underlay) {
@@ -43,8 +43,8 @@ export default {
43
43
 
44
44
  destroy () {
45
45
  // console.log('destroy', this.options.transition)
46
- if (this.options.transition && this.root) {
47
- this.root.classList.remove('show')
46
+ if (this.options.transition && this.element) {
47
+ this.element.classList.remove('show')
48
48
 
49
49
  if (this.underlay) {
50
50
  this.underlay.classList.remove('show')
@@ -63,9 +63,9 @@ export default {
63
63
  },
64
64
 
65
65
  removeChild () {
66
- if (this.root && this.root.parentNode) {
67
- this.root.parentNode.removeChild(this.root)
68
- this.root = null
66
+ if (this.element && this.element.parentNode) {
67
+ this.element.parentNode.removeChild(this.element)
68
+ this.element = null
69
69
  }
70
70
 
71
71
  if (this.underlay && this.underlay.parentNode) {
@@ -111,7 +111,7 @@ export default {
111
111
 
112
112
  // console.log('showSearch')
113
113
  this.mode = 'search'
114
- this.root.classList.add('search-mode')
114
+ this.element.classList.add('search-mode')
115
115
 
116
116
  if (this.ui.search) {
117
117
  this.ui.search.root.classList.add('selected')
@@ -136,7 +136,7 @@ export default {
136
136
  hideSearch (notfetch) {
137
137
  // console.log('hideSearch', notfetch)
138
138
  this.mode = 'standard'
139
- this.root.classList.remove('search-mode')
139
+ this.element.classList.remove('search-mode')
140
140
 
141
141
  if (this.ui.search) {
142
142
  this.ui.search.root.classList.remove('selected')
package/src/list.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import Item from './item'
4
4
  import Divider from './divider'
5
5
 
6
- // import init from './component/init'
6
+ // import init from './mixin/init'
7
7
  import emitter from './module/emitter'
8
8
  import insert from './element/insert'
9
9
  import css from './module/css'
@@ -86,19 +86,19 @@ class List {
86
86
  // define main tag
87
87
  var tag = this.options.tag || 'ul'
88
88
 
89
- this.root = document.createElement(tag)
90
- css.add(this.root, 'material-' + this.options.class)
89
+ this.element = document.createElement(tag)
90
+ css.add(this.element, 'material-' + this.options.class)
91
91
 
92
92
  if (options.name) {
93
- css.add(this.root, options.class + '-' + options.name)
93
+ css.add(this.element, options.class + '-' + options.name)
94
94
  }
95
95
 
96
96
  if (options.type) {
97
- css.add(this.root, 'type-' + options.type)
97
+ css.add(this.element, 'type-' + options.type)
98
98
  }
99
99
 
100
100
  if (options.layout) {
101
- css.add(this.root, 'layout-' + options.layout)
101
+ css.add(this.element, 'layout-' + options.layout)
102
102
  }
103
103
 
104
104
  if (this.options.list) {
@@ -106,10 +106,10 @@ class List {
106
106
  }
107
107
 
108
108
  if (this.options.container) {
109
- insert(this.root, this.options.container)
109
+ insert(this.element, this.options.container)
110
110
  }
111
111
 
112
- // this.root.addEventListener("click", function(e) {
112
+ // this.element.addEventListener("click", function(e) {
113
113
  // // console.log("list", this, e);
114
114
  // // e.target was the clicked element
115
115
  // });
@@ -207,7 +207,7 @@ class List {
207
207
  }
208
208
 
209
209
  scrollToBottom () {
210
- this.root.scrollTop = this.root.scrollHeight - this.root.getBoundingClientRect().height
210
+ this.element.scrollTop = this.element.scrollHeight - this.element.getBoundingClientRect().height
211
211
  }
212
212
 
213
213
  /**
@@ -221,9 +221,9 @@ class List {
221
221
 
222
222
  var where = 'bottom'
223
223
  if (item.root) {
224
- insert(item.root, this.root, where)
224
+ insert(item.root, this.element, where)
225
225
  } else {
226
- insert(item, this.root, where)
226
+ insert(item, this.element, where)
227
227
  }
228
228
 
229
229
  this.items.push(item)
@@ -232,11 +232,11 @@ class List {
232
232
  }
233
233
 
234
234
  insert (container, context) {
235
- insert(this.root, container, context)
235
+ insert(this.element, container, context)
236
236
  }
237
237
 
238
238
  empty () {
239
- this.root.innerHTML = ''
239
+ this.element.innerHTML = ''
240
240
  this.items = []
241
241
  this.item = null
242
242
  }
package/src/map/build.js CHANGED
@@ -13,11 +13,11 @@ export default {
13
13
  * @return {void} This class instance
14
14
  */
15
15
  build () {
16
- this.root = document.createElement(this.options.tag)
17
- this.root.classList.add(this.options.class)
16
+ this.element = document.createElement(this.options.tag)
17
+ this.element.classList.add(this.options.class)
18
18
 
19
19
  if (this.options.container) {
20
- this.options.container.appendChild(this.root)
20
+ this.options.container.appendChild(this.element)
21
21
  }
22
22
 
23
23
  this.label = document.createElement('div')
@@ -27,7 +27,7 @@ export default {
27
27
  this.buildMap()
28
28
  this.screenSize()
29
29
 
30
- observer.insert(this.root, () => {
30
+ observer.insert(this.element, () => {
31
31
  // if (touch()) {
32
32
  // // console.log('pinchzoom', this.options.pichZoom)
33
33
  // this.draggable = new PinchZoom(this.slide, {
@@ -58,7 +58,7 @@ export default {
58
58
  })
59
59
  // }
60
60
 
61
- this.rect = this.root.getBoundingClientRect()
61
+ this.rect = this.element.getBoundingClientRect()
62
62
 
63
63
  this.screen = {
64
64
  y: window.pageYOffset,
@@ -84,7 +84,7 @@ export default {
84
84
  // console.log('buildmap')
85
85
  this.slide = document.createElement('div')
86
86
  this.slide.classList.add('slide')
87
- this.root.appendChild(this.slide)
87
+ this.element.appendChild(this.slide)
88
88
 
89
89
  this.map = document.createElement('div')
90
90
  this.map.classList.add('map')
@@ -82,24 +82,24 @@ export default {
82
82
  },
83
83
 
84
84
  updateRoot () {
85
- this.offsetX = this.screen.width - this.root.offsetWidth
86
- this.offsetY = this.screen.height - this.root.offsetHeight
85
+ this.offsetX = this.screen.width - this.element.offsetWidth
86
+ this.offsetY = this.screen.height - this.element.offsetHeight
87
87
 
88
88
  // console.log('--', this.offsetX / 2 + 'px')
89
89
 
90
- this.root.style.left = (this.offsetX / 2) + 'px'
91
- this.root.style.top = (this.offsetY / 2) + 'px'
90
+ this.element.style.left = (this.offsetX / 2) + 'px'
91
+ this.element.style.top = (this.offsetY / 2) + 'px'
92
92
 
93
93
  // if (isTouchScreen()) {
94
- // this.root.style.top = (this.offsetY / 2) + 70 + 'px'
94
+ // this.element.style.top = (this.offsetY / 2) + 70 + 'px'
95
95
  // } else {
96
- // this.root.style.top = -1200 + 'px'
96
+ // this.element.style.top = -1200 + 'px'
97
97
  // }
98
98
  },
99
99
 
100
100
  updateMap () {
101
- var offsetX = this.root.offsetWidth - this.map.offsetWidth
102
- // var offsetY = this.root.height - this.map.offsetHeight
101
+ var offsetX = this.element.offsetWidth - this.map.offsetWidth
102
+ // var offsetY = this.element.height - this.map.offsetHeight
103
103
 
104
104
  // console.log('--', this.offsetX / 2 + 'px')
105
105
 
package/src/menu.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
- import classify from './component/classify'
3
+ import classify from './module/classify'
4
4
  import css from './module/css'
5
- import events from './component/events'
5
+ import events from './mixin/events'
6
6
  import insert from './element/insert'
7
7
  import offset from './element/offset'
8
8
 
@@ -66,18 +66,18 @@ class Menu {
66
66
  * @return {Object} This class instance
67
67
  */
68
68
  build () {
69
- this.root = create(this.options.tag, this.options.css)
69
+ this.element = create(this.options.tag, this.options.css)
70
70
  this.mask = create(this.options.tag, this.options.class + '-mask')
71
71
 
72
72
  if (this.options.position) {
73
- this.root.style.position = this.options.position
73
+ this.element.style.position = this.options.position
74
74
  }
75
75
 
76
- classify(this.root, this.options)
76
+ classify(this.element, this.options)
77
77
 
78
78
  if (this.options.list) {
79
79
  this.list = new List({
80
- // root: this.root,
80
+ // root: this.element,
81
81
  list: this.options.list,
82
82
  target: '.material-item',
83
83
  height: 600,
@@ -86,17 +86,17 @@ class Menu {
86
86
  this.selected = item
87
87
  this.hide()
88
88
  }
89
- }).insert(this.root)
89
+ }).insert(this.element)
90
90
  }
91
91
 
92
- this.emit('built', this.root)
92
+ this.emit('built', this.element)
93
93
 
94
94
  return this
95
95
  }
96
96
 
97
97
  insert () {
98
98
  insert(this.mask, document.body)
99
- insert(this.root, document.body)
99
+ insert(this.element, document.body)
100
100
  }
101
101
 
102
102
  setup () {
@@ -113,7 +113,7 @@ class Menu {
113
113
 
114
114
  if (e) this.caller = e.target
115
115
 
116
- css.add(this.root, this.options.class + '-show')
116
+ css.add(this.element, this.options.class + '-show')
117
117
  this.position(this.caller)
118
118
  }
119
119
 
@@ -121,19 +121,19 @@ class Menu {
121
121
  if (!this.caller) return
122
122
  var offs = offset(this.caller)
123
123
 
124
- var offsw = this.offset = offset(this.root)
124
+ var offsw = this.offset = offset(this.element)
125
125
 
126
126
  // console.log('offset')
127
127
  // console.log('caller', this.caller, offs, screen.width)
128
128
 
129
- this.root.style.top = offs.top + 'px'
130
- this.root.style.left = offs.left - offsw.width + offs.width + 'px'
131
- // this.root.style.right = offs.right + offs.width + offsw.width + 'px'
129
+ this.element.style.top = offs.top + 'px'
130
+ this.element.style.left = offs.left - offsw.width + offs.width + 'px'
131
+ // this.element.style.right = offs.right + offs.width + offsw.width + 'px'
132
132
  }
133
133
 
134
134
  hide () {
135
135
  // console.log('hide')
136
- css.remove(this.root, this.options.class + '-show')
136
+ css.remove(this.element, this.options.class + '-show')
137
137
  css.remove(this.mask, 'mask-show')
138
138
  }
139
139
  }
@@ -32,12 +32,12 @@ var control = {
32
32
  */
33
33
  check (checked) {
34
34
  if (checked === true) {
35
- css.add(this.root, 'is-checked')
35
+ css.add(this.element, 'is-checked')
36
36
  this.element.input.checked = true
37
37
  this.checked = true
38
38
  this.emit('change', this.checked)
39
39
  } else {
40
- css.remove(this.root, 'is-checked')
40
+ css.remove(this.element, 'is-checked')
41
41
  this.element.input.checked = false
42
42
  this.checked = false
43
43
  this.emit('change', this.checked)
@@ -60,7 +60,7 @@ var control = {
60
60
 
61
61
  this.element.label.textContent = label
62
62
 
63
- container = container || this.root
63
+ container = container || this.element
64
64
 
65
65
  insert(this.element.label, container)
66
66
  },
@@ -73,7 +73,7 @@ var control = {
73
73
  icon (icon, container, position) {
74
74
  if (!icon) return
75
75
 
76
- container = container || this.root
76
+ container = container || this.element
77
77
 
78
78
  position = position || 'top'
79
79
  if (this.options.type === 'text-icon') {
@@ -104,14 +104,14 @@ var control = {
104
104
  this.element.error.textContent = text
105
105
  }
106
106
 
107
- insert(this.element.error, this.root, 'bottom')
107
+ insert(this.element.error, this.element, 'bottom')
108
108
  },
109
109
 
110
110
  disable () {
111
111
  this.disabled = true
112
112
 
113
113
  this.element.input.setAttribute('disabled', 'disabled')
114
- css.add(this.root, 'is-disabled')
114
+ css.add(this.element, 'is-disabled')
115
115
  return this
116
116
  },
117
117
 
@@ -119,7 +119,7 @@ var control = {
119
119
  this.disabled = false
120
120
 
121
121
  this.element.input.removeAttribute('disabled')
122
- css.remove(this.root, 'is-disabled')
122
+ css.remove(this.element, 'is-disabled')
123
123
  return this
124
124
  },
125
125
 
@@ -162,7 +162,7 @@ var control = {
162
162
  },
163
163
 
164
164
  getName () {
165
- return this.root.dataset.name
165
+ return this.element.dataset.name
166
166
  },
167
167
 
168
168
  /**
@@ -172,7 +172,7 @@ var control = {
172
172
  focus () {
173
173
  if (this.disabled === true) return this
174
174
 
175
- css.add(this.root, 'is-focused')
175
+ css.add(this.element, 'is-focused')
176
176
  if (this.element.input !== document.activeElement) { this.element.input.focus() }
177
177
  return this
178
178
  },
@@ -182,7 +182,7 @@ var control = {
182
182
  * @return {?} [description]
183
183
  */
184
184
  blur () {
185
- css.remove(this.root, 'is-focused')
185
+ css.remove(this.element, 'is-focused')
186
186
  return this
187
187
  }
188
188
  }
@@ -1,4 +1,4 @@
1
- import classify from './classify'
1
+ import classify from '../module/classify'
2
2
 
3
3
  function create (options) {
4
4
  var element = document.createElement(options.tag || 'div')
@@ -1,3 +1,4 @@
1
+ import dom from '../module/dom'
1
2
 
2
3
  export default {
3
4
  toggle () {
@@ -8,7 +9,7 @@ export default {
8
9
  },
9
10
 
10
11
  show () {
11
- console.log('show', this.visible)
12
+ // console.log('show', this.visible)
12
13
 
13
14
  // if (this.options.transition) {
14
15
  // this.element.style.display = 'initial'
@@ -28,12 +29,12 @@ export default {
28
29
  },
29
30
 
30
31
  hide () {
31
- console.log('hide')
32
+ // console.log('hide')
32
33
  // if (this.element.style.display === 'none') return
33
34
  // clearTimeout(this.displayTimeout)
34
- // this._display = getComputedStyle(this.root).display
35
+ // this._display = getComputedStyle(this.element).display
35
36
 
36
- if (!this.root) return
37
+ if (!this.element) return
37
38
 
38
39
  this.element.classList.remove('show')
39
40
  this.visible = false
@@ -54,8 +55,8 @@ export default {
54
55
  },
55
56
 
56
57
  destroy () {
57
- // console.log('destroy', this.options.transition, this.root)
58
- if (this.options.transition && this.root) {
58
+ // console.log('destroy', this.options.transition, this.element)
59
+ if (this.options.transition && this.element) {
59
60
  this.element.classList.remove('show')
60
61
 
61
62
  if (this.underlay) {
@@ -63,26 +64,13 @@ export default {
63
64
  }
64
65
 
65
66
  setTimeout(() => {
66
- this.removeChild()
67
+ dom.destroy(this.element)
67
68
  }, this.options.transition)
68
69
  } else {
69
- this.removeChild()
70
+ dom.destroy(this.element)
70
71
  }
71
72
 
72
- this.emit?.('destroy')
73
- },
74
-
75
- removeChild () {
76
- if (this.root && this.element.parentNode) {
77
- this.element.parentNode.removeChild(this.root)
78
- this.root = null
79
- }
80
73
 
81
- if (this.underlay && this.underlay.parentNode) {
82
- this.underlay.parentNode.removeChild(this.underlay)
83
- }
84
-
85
- this.emit?.('remove')
86
- return this
74
+ this.emit?.('destroy')
87
75
  }
88
76
  }
@@ -6,7 +6,7 @@ export default {
6
6
  * @param {Function} fn [description]
7
7
  */
8
8
  addEvent (event, fn) {
9
- var element = this.root
9
+ var element = this.element
10
10
  // avoid memory overhead of new anonymous functions for every event handler that's installed
11
11
  // by using local functions
12
12
  function listenHandler (e) {
@@ -45,7 +45,7 @@ export default {
45
45
  * @return {Object} [description]
46
46
  */
47
47
  removeEvent (event, fn) {
48
- var element = this.root
48
+ var element = this.element
49
49
 
50
50
  if (element.removeEventListener) {
51
51
  element.removeEventListener(event, fn, false)
@@ -8,7 +8,7 @@ export default {
8
8
  focus () {
9
9
  if (this.disabled === true) return this
10
10
 
11
- css.add(this.root, 'is-focused')
11
+ css.add(this.element, 'is-focused')
12
12
  if (this.element.input !== document.activeElement) { this.element.input.focus() }
13
13
  return this
14
14
  },
@@ -18,8 +18,7 @@ export default {
18
18
  * @return {?} [description]
19
19
  */
20
20
  blur () {
21
- css.remove(this.root, 'is-focused')
21
+ css.remove(this.element, 'is-focused')
22
22
  return this
23
23
  }
24
24
  }
25
-
@@ -18,7 +18,7 @@ export default {
18
18
  * @return {?} [description]
19
19
  */
20
20
  insert (container, context) {
21
- var element = this.root
21
+ var element = this.element
22
22
 
23
23
  this.insertElement(element, container, context)
24
24
 
@@ -5,7 +5,7 @@ export default {
5
5
  build () {
6
6
  this.element = document.createElement(this.options.tag || 'div')
7
7
  // for backward compatibility
8
- this.root = this.element
8
+ this.element = this.element
9
9
 
10
10
  const defaults = this.constructor.defaults || {}
11
11
 
@@ -16,7 +16,7 @@ export default {
16
16
  }
17
17
 
18
18
  if (this.options.data) {
19
- dataset(this.root, this.options.data)
19
+ dataset(this.element, this.options.data)
20
20
  }
21
21
 
22
22
  this.container = this.options.container
@@ -35,7 +35,8 @@ export default {
35
35
  container.appendChild(this.element)
36
36
  },
37
37
 
38
- addClass (c) {
38
+ addClass (clss) {
39
+ const c = clss.replace(/\s+/g, ' ').trim()
39
40
  const list = c.split(' ')
40
41
  list.forEach(item => this.element.classList.add(item))
41
42
  }
@@ -1,18 +1,5 @@
1
1
  import css from '../module/css'
2
2
 
3
- /**
4
- * Classify component related functions
5
- * @module component/classify
6
- * @category component
7
- */
8
-
9
- /**
10
- * Init component class
11
- * @param {element} element The component root element
12
- * @param {object} options component class options
13
- * @return {Instance} The Class instance
14
- *
15
- */
16
3
  function classify (element, options) {
17
4
  css.add(element, options.prefix + '-' + options.class)
18
5
 
package/src/module/dom.js CHANGED
@@ -1,98 +1,42 @@
1
- 'use strict'
1
+ // DOM manipulation function
2
2
 
3
- /**
4
- * Element insertion related methods
5
- * @module module/dom
6
- */
7
-
8
- /**
9
- * Inserts content specified by the container argument at the end of HTMLElement
10
- *
11
- * @param {HTMLElement} container
12
- * @param {String|HTMLElement} html
13
- * @return {HTMLElement} inserted element
14
- */
15
3
  function append (container, element) {
16
4
  container.appendChild(element)
17
5
  return element
18
6
  }
19
7
 
20
- /**
21
- * Inserts content specified by the html argument at the beginning of HTMLElement
22
- *
23
- * @param {HTMLElement} container
24
- * @param {string|HTMLElement} html
25
- * @returns {HTMLElement} inserted container
26
- */
27
8
  function prepend (container, element) {
28
9
  return container.insertBefore(element, container.firstChild)
29
10
  }
30
11
 
31
- /**
32
- * Inserts content specified by the html argument after the HTMLElement
33
- *
34
- * @param {HTMLElement} container
35
- * @returns {HTMLElement} inserted container
36
- */
37
12
  function after (container, element) {
38
13
  return container.parentNode.insertBefore(element, container.nextSibling)
39
14
  }
40
15
 
41
- /**
42
- * Inserts content specified by the html argument before the HTMLElement
43
- *
44
- * @param {HTMLElement} container
45
- * @returns {HTMLElement} inserted container
46
- */
47
16
  function before (container, element) {
48
17
  return container.insertBefore(element, container)
49
18
  }
50
19
 
51
- /**
52
- * Replaces given html container with content specified in html parameter
53
- *
54
- * @param {HTMLElement} container
55
- * @param {string|HTMLElement} html
56
- * @returns {HTMLElement} inserted container
57
- */
58
20
  function replace (container, element) {
59
21
  return container.parentNode.replaceChild(element, container)
60
22
  }
61
23
 
62
- /**
63
- * Removes HTMLElement from dom tree
64
- *
65
- * @param {HTMLElement} container
66
- * @returns {HTMLElement} removed container
67
- */
68
24
  function remove (element) {
69
25
  var parent = element.parentNode
70
26
  return parent.removeChild(element)
71
27
  }
72
28
 
73
- /**
74
- * [dispose description]
75
- * @return {Object} The class instance
76
- */
77
29
  function dispose (element) {
78
30
  var el = element
79
31
  return (el.parentNode) ? el.parentNode.removeChild(el) : el
80
32
  }
81
33
 
82
- /**
83
- * empty
84
- * @return {void}
85
- */
86
34
  function empty (element) {
87
35
  while (element.firstChild) {
88
36
  element.removeChild(element.firstChild)
89
37
  }
90
38
  }
91
39
 
92
- /**
93
- * [destroy description]
94
- * @return {Object} this class
95
- */
96
40
  function destroy (element) {
97
41
  return element.parentNode.removeChild(element)
98
42
  }