vaderjs 1.4.2-kml56 → 1.4.2-npiml56

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.
@@ -2,6 +2,7 @@ window.vader = {
2
2
  version: '1.0.0'
3
3
  }
4
4
  globalThis.isServer = false
5
+ globalThis.preRender = false;
5
6
  window.hasRan = []
6
7
  globalThis.memoizedFunctions = []
7
8
  const memoizedRefs = []
@@ -11,40 +12,40 @@ const memoizedRefs = []
11
12
  * @param {HTMLElement} newNode
12
13
  * @returns
13
14
  */
14
- function calculateDiff(oldNode, newNode){
15
- if(oldNode === undefined || newNode === undefined){
15
+ function calculateDiff(oldNode, newNode) {
16
+ if (oldNode === undefined || newNode === undefined) {
16
17
  return []
17
18
  }
18
- let diff = []
19
- if(oldNode?.children.length > 0){
20
- for(var i = 0; i < oldNode.children.length; i++){
21
- diff.push(...calculateDiff(oldNode.children[i], newNode.children[i]))
22
-
23
- }
19
+ let diff = []
20
+ if (oldNode?.children.length > 0) {
21
+ for (var i = 0; i < oldNode.children.length; i++) {
22
+ diff.push(...calculateDiff(oldNode.children[i], newNode.children[i]))
23
+
24
+ }
24
25
  return diff
25
- }
26
- if(!oldNode?._isRoot){
27
- if(oldNode.nodeType === 3 && oldNode.nodeValue !== newNode.nodeValue){
28
- diff.push({type: 'REPLACE', oldNode, newNode})
26
+ }
27
+ if (!oldNode?._isRoot) {
28
+ if (oldNode.nodeType === 3 && oldNode.nodeValue !== newNode.nodeValue) {
29
+ diff.push({ type: 'REPLACE', oldNode, newNode })
29
30
  }
30
- else if(oldNode.nodeType === 1 && oldNode.innerHTML !== newNode.innerHTML
31
- ){
32
- diff.push({type: 'REPLACE', oldNode, newNode})
31
+ else if (oldNode.nodeType === 1 && oldNode.innerHTML !== newNode.innerHTML
32
+ ) {
33
+ diff.push({ type: 'REPLACE', oldNode, newNode })
33
34
  }
34
- else if(oldNode.nodeType === 1 && oldNode.tagName === newNode.tagName){
35
- for(var i = 0; i < oldNode.attributes.length; i++){
36
- if(oldNode.attributes[i].value !== newNode.attributes[i].value){
37
- diff.push({type: 'PROPS', oldNode, newNode})
35
+ else if (oldNode.nodeType === 1 && oldNode.tagName === newNode.tagName) {
36
+ for (var i = 0; i < oldNode.attributes.length; i++) {
37
+ if (oldNode.attributes[i].value !== newNode.attributes[i].value) {
38
+ diff.push({ type: 'PROPS', oldNode, newNode })
38
39
  }
39
40
  }
40
41
  }
41
- }
42
+ }
43
+
42
44
 
43
-
44
45
 
45
46
  return diff
46
47
  }
47
-
48
+
48
49
  /**
49
50
  * @description This function is used to generate functonal components
50
51
  * @param {Function} tag
@@ -52,38 +53,51 @@ function calculateDiff(oldNode, newNode){
52
53
  * @param {...any} children
53
54
  * @returns {Object} - The first child of the functional component
54
55
  */
55
- function generateJSX(tag, props, ...children){
56
- let node = {
57
- state: {},
58
- mainFunction: tag,
59
- _key: tag.name || Math.random().toString(36).substring(7),
60
- $$typeof: 'JSX_CHILD',
61
- firstChild:null,
62
- children: children,
63
- _name: tag.name,
64
- }
65
-
66
- node.firstChild = tag()
67
- node.firstChild.htmlNode._key = node._key
56
+ function generateJSX(tag, props, ...children) {
57
+ let node = {
58
+ state: {},
59
+ mainFunction: tag,
60
+ _key: tag.name || Math.random().toString(36).substring(7),
61
+ $$typeof: 'JSX_CHILD',
62
+ firstChild: null,
63
+ children: children,
64
+ _name: tag.name,
65
+ }
66
+
67
+ let comp = new Component({ $$key: node._key })
68
+ tag = tag.bind(comp)
69
+ comp.render = () => {
70
+ children = children.flat(Infinity)
71
+ let childObj = children.map((child) => {
72
+ if (typeof child === 'function') {
73
+ return generateJSX(child, props, child.props.children)
74
+ }
75
+ return child
76
+ })
77
+
78
+ return tag({...props, children:childObj[0] || childObj})
79
+ }
80
+ node.firstChild = comp.render()
81
+ node.firstChild.htmlNode._key = node._key
68
82
  node.firstChild.htmlRoot = node
69
- node.firstChild.htmlNode._isRoot = true
70
- node.firstChild.props = props || {}
83
+ node.firstChild.htmlNode._isRoot = true
84
+ node.firstChild.props = props || {}
71
85
  node.firstChild._isRoot = true
72
86
  node.firstChild._key = node._key
73
- node.firstChild.props['key'] = node._key
74
- return node.firstChild
75
-
87
+ node.firstChild.props['key'] = node._key
88
+ return node.firstChild
89
+
76
90
 
77
91
  }
78
- function handleStyles(styles, nodeEl) {
92
+ function handleStyles(styles, nodeEl) {
79
93
 
80
94
  for (let key in styles) {
81
- if(typeof styles[key] === 'object'){
95
+ if (typeof styles[key] === 'object') {
82
96
  handleStyles(styles[key], nodeEl)
83
97
  }
84
98
  nodeEl.style[key] = styles[key];
85
99
  }
86
-
100
+
87
101
  }
88
102
 
89
103
 
@@ -95,166 +109,166 @@ let hasBeenCalled = []
95
109
  * @param {...any} children
96
110
  * @returns {Object} - The virtual DOM element
97
111
  */
98
- function Element(tag, props, ...children){
112
+ function Element(tag, props, ...children) {
99
113
  !props ? props = {} : null
100
- if(!props?.['$$key']){
114
+ if (!props?.['$$key']) {
101
115
  props['$$key'] = tag.name || Math.random().toString(36).substring(7)
102
116
  }
103
117
 
104
- if(typeof tag === 'function'){
105
- return generateJSX(tag, props, children)
118
+ if (typeof tag === 'function') {
119
+ return generateJSX(tag, props, children)
106
120
  }
107
121
  let node = {
108
122
  tag: tag,
109
123
  props: props,
110
- children: children,
124
+ children: children,
111
125
  _key: props['$$key'],
112
126
  events: [],
113
127
  staticEl: document.createElement(tag),
114
128
  parentNode: null
115
129
  }
116
- for(var i = 0; i < children.length; i++){
117
- if(typeof children[i] === 'string' || typeof children[i] === 'number'){
118
- children[i] = {
119
- tag: 'TEXT_ELEMENT',
120
- props: {nodeValue: children[i]},
121
- _key: props['$$key'],
122
- parentNode: {tag: tag, props: props, children: children, _key: props['$$key']},
123
- children: []
130
+ for (var i = 0; i < children.length; i++) {
131
+ if (typeof children[i] === 'string' || typeof children[i] === 'number') {
132
+ children[i] = {
133
+ tag: 'TEXT_ELEMENT',
134
+ props: { nodeValue: children[i] },
135
+ _key: props['$$key'],
136
+ parentNode: { tag: tag, props: props, children: children, _key: props['$$key'] },
137
+ children: []
138
+ }
139
+ } else {
140
+ if (children[i]) {
141
+ children[i].parentNode = { tag: tag, props: props, children: children }
142
+ }
124
143
  }
125
- }else{
126
- if(children[i]){
127
- children[i].parentNode = {tag: tag, props: props, children: children}
128
- }
129
- }
130
- }
144
+ }
131
145
  let nodeEl = node.tag === 'TEXT_ELEMENT' ? document.createTextNode('') : document.createElement(node.tag)
132
146
  node.staticEl = nodeEl
133
-
134
- for(var key in props){
135
- if(key.toLowerCase().startsWith('on')){
136
- nodeEl.addEventListener(key.substring(2).toLowerCase(), props[key])
137
- node.events.push({type: key.substring(2).toLowerCase(), listener: props[key]})
138
- continue
139
- }
140
- if(key === '$$key' && !nodeEl._key && nodeEl.nodeType === 1
141
- ){
142
- Object.defineProperty(nodeEl, '_key', {
143
- value: props[key],
144
- writable: true
145
- })
146
- continue
147
- }
148
-
149
- if(nodeEl && nodeEl.nodeType === 1){
147
+
148
+ for (var key in props) {
149
+ if (key.toLowerCase().startsWith('on')) {
150
+ nodeEl.addEventListener(key.substring(2).toLowerCase(), props[key])
151
+ node.events.push({ type: key.substring(2).toLowerCase(), listener: props[key] })
152
+ continue
153
+ }
154
+ if (key === '$$key' && !nodeEl._key && nodeEl.nodeType === 1
155
+ ) {
156
+ Object.defineProperty(nodeEl, '_key', {
157
+ value: props[key],
158
+ writable: true
159
+ })
160
+ continue
161
+ }
162
+
163
+ if (nodeEl && nodeEl.nodeType === 1) {
150
164
  nodeEl.setAttribute(key, props[key])
151
165
  }
152
-
166
+
153
167
  }
154
- if(props.style){
168
+ if (props.style) {
155
169
  handleStyles(props.style, nodeEl)
156
170
  }
157
171
 
158
- if(props.id){
172
+ if (props.id) {
159
173
  nodeEl.id = props.id
160
174
  }
161
- if(props.ref){
162
- switch(true){
163
- case Array.isArray(props.ref.current):
164
- if(!props.ref.current.find((el) => el === nodeEl)){
165
- props.ref.current.push(nodeEl)
166
- }
167
- break;
168
- case props.ref.current === HTMLElement:
169
- props.ref.current = nodeEl
170
- break;
171
- case props.ref.current === null:
172
- props.ref.current = nodeEl
173
- break;
174
- case typeof props.ref === 'function' && !window.hasRan.includes(props.ref):
175
- window.hasRan.push(props.ref)
176
- props.ref(nodeEl)
177
- setTimeout(() => {
178
- window.hasRan.filter((el) => el !== props.ref)
179
- }, 0)
180
- break;
181
- default:
182
- props.ref.current = nodeEl
183
- break;
184
-
185
- }
175
+ if (props.ref) {
176
+ switch (true) {
177
+ case Array.isArray(props.ref.current):
178
+ if (!props.ref.current.find((el) => el === nodeEl)) {
179
+ props.ref.current.push(nodeEl)
180
+ }
181
+ break;
182
+ case props.ref.current === HTMLElement:
183
+ props.ref.current = nodeEl
184
+ break;
185
+ case props.ref.current === null:
186
+ props.ref.current = nodeEl
187
+ break;
188
+ case typeof props.ref === 'function' && !window.hasRan.includes(props.ref):
189
+ window.hasRan.push(props.ref)
190
+ props.ref(nodeEl)
191
+ setTimeout(() => {
192
+ window.hasRan.filter((el) => el !== props.ref)
193
+ }, 0)
194
+ break;
195
+ default:
196
+ props.ref.current = nodeEl
197
+ break;
198
+
199
+ }
186
200
  }
187
201
  node['htmlNode'] = nodeEl
188
-
189
-
190
- if(nodeEl.nodeType === 1){
191
- for(var i = 0; i < children.length; i++){
192
- if(children[i]){
193
- if(children[i].tag === 'TEXT_ELEMENT'){
194
- nodeEl.appendChild(document.createTextNode(children[i].props.nodeValue))
195
- }
196
- nodeEl.appendChild(Element(children[i].tag, children[i].props, ...children[i].children).htmlNode)
197
- }
198
- }
199
-
200
- }
201
-
202
+
203
+
204
+ if (nodeEl.nodeType === 1) {
205
+ for (var i = 0; i < children.length; i++) {
206
+ if (children[i]) {
207
+ if (children[i].tag === 'TEXT_ELEMENT') {
208
+ nodeEl.appendChild(document.createTextNode(children[i].props.nodeValue))
209
+ }
210
+ nodeEl.appendChild(Element(children[i].tag, children[i].props, ...children[i].children).htmlNode)
211
+ }
212
+ }
213
+
214
+ }
215
+
202
216
  return node;
203
217
  }
204
-
205
218
 
206
- function handleDiff(diff){
207
- for(var i = 0; i < diff.length; i++){
208
- switch(true){
209
- case diff[i].type === 'REPLACE' && !diff[i].oldNode._isRoot:
210
- let parent = diff[i].oldNode.parentNode
219
+
220
+ function handleDiff(diff) {
221
+ for (var i = 0; i < diff.length; i++) {
222
+ switch (true) {
223
+ case diff[i].type === 'REPLACE' && !diff[i].oldNode._isRoot:
224
+ let parent = diff[i].oldNode.parentNode
211
225
  diff[i].oldNode.parentNode.replaceChild(diff[i].newNode, diff[i].oldNode)
212
226
  break;
213
- case diff[i].type === 'PROPS':
227
+ case diff[i].type === 'PROPS':
214
228
  break;
215
- }
229
+ }
216
230
  }
217
231
 
218
232
  }
219
233
  let states = {}
220
- export const useState = (name, initialValue) => {}
221
- export function useRef(name, initialValue){
234
+ export const useState = (name, initialValue) => { }
235
+ export function useRef(name, initialValue) {
222
236
  let ref = initialValue
223
- if(!memoizedRefs.find((el) => el.name === name)){
224
- memoizedRefs.push({name, ref})
225
- }
226
- let getRef = () => memoizedRefs.find((el) => el.name === name).ref
227
- let setRef = (newValue) => {
228
- memoizedRefs.find((el) => el.name === name).ref = newValue
229
- }
230
- return {
237
+ if (!memoizedRefs.find((el) => el.name === name)) {
238
+ memoizedRefs.push({ name, ref })
239
+ }
240
+ let getRef = () => memoizedRefs.find((el) => el.name === name).ref
241
+ let setRef = (newValue) => {
242
+ memoizedRefs.find((el) => el.name === name).ref = newValue
243
+ }
244
+ return {
231
245
  current: getRef(),
232
246
  name,
233
247
  }
234
248
  }
235
- export function Mounted(fn, node){
236
- let el = Array.from(document.querySelectorAll('*')).find((el) => el._key === memoizedFunctions.find((el) => el.mainFunction === node)._key)
237
- if(el && !hasBeenCalled.find((el) => el === node)){
249
+ export function Mounted(fn, node) {
250
+ let el = Array.from(document.querySelectorAll('*')).find((el) => el._key === memoizedFunctions.find((el) => el.mainFunction === node)._key)
251
+ if (el && !hasBeenCalled.find((el) => el === node)) {
238
252
  fn()
239
253
  hasBeenCalled.push(node)
240
254
  }
241
- else{
255
+ else {
242
256
  setTimeout(() => {
243
257
  Mounted(fn, node)
244
258
  }, 0)
245
259
  }
246
260
  }
247
-
248
-
249
- let effects = [];
250
261
 
251
- export function useEffect(fn, deps){
252
- if(!effects.find((el) => el.fn.toString() === fn.toString())){
253
- effects.push({fn, deps})
262
+
263
+ let effects = [];
264
+
265
+ export function useEffect(fn, deps) {
266
+ if (!effects.find((el) => el.fn.toString() === fn.toString())) {
267
+ effects.push({ fn, deps })
254
268
  }
255
- else{
269
+ else {
256
270
  let effect = effects.find((el) => el.fn.toString() === fn.toString())
257
- if(effect.deps.toString() !== deps.toString()){
271
+ if (effect.deps.toString() !== deps.toString()) {
258
272
  effect.deps = deps
259
273
  effect.fn()
260
274
  }
@@ -264,169 +278,143 @@ export function useEffect(fn, deps){
264
278
  }
265
279
 
266
280
  }
267
- export function useReducer(name, reducer, vnode, initialState){
281
+ export function useReducer(name, reducer, vnode, initialState) {
268
282
  let [state, setState] = useState(name, vnode, initialState)
269
283
  let dispatch = (action) => {
270
284
  let newState = reducer(state, action)
271
285
  setState(newState)
272
286
  }
273
287
 
274
- return [state, dispatch]
288
+ return [state, dispatch]
275
289
 
276
290
  }
277
291
 
278
292
  class Component {
279
- constructor(props){
293
+ constructor(props) {
280
294
  this.props = props
281
295
  this._key = props['$$key'] || Math.random().toString(36).substring(7)
282
296
  this.state = {}
283
297
  this.htmlNode = null
284
298
  this.firstChild = null
285
299
  this.Element = Element
286
- this.effects = []
300
+ this.passiveProps = {}
287
301
  }
288
302
 
289
303
 
290
- setState(newState){
304
+ setState(newState) {
291
305
  this.state = newState
292
306
  }
293
307
 
294
- handleDiff(diff){
295
- for(var i = 0; i < diff.length; i++){
296
- switch(true){
297
- case diff[i].type === 'REPLACE' && !diff[i].oldNode._isRoot:
298
- let parent = diff[i].oldNode.parentNode
308
+ handleDiff(diff) {
309
+ for (var i = 0; i < diff.length; i++) {
310
+ switch (true) {
311
+ case diff[i].type === 'REPLACE' && !diff[i].oldNode._isRoot:
312
+ let parent = diff[i].oldNode.parentNode
299
313
  diff[i].oldNode.parentNode.replaceChild(diff[i].newNode, diff[i].oldNode)
300
314
  break;
301
- case diff[i].type === 'PROPS':
315
+ case diff[i].type === 'PROPS':
302
316
  break;
303
- }
317
+ }
304
318
  }
305
319
  }
306
- calculateDiff(oldNode, newNode){
307
- if(oldNode === undefined || newNode === undefined){
320
+ calculateDiff(oldNode, newNode) {
321
+ if (oldNode === undefined || newNode === undefined) {
308
322
  return []
309
323
  }
310
- let diff = []
311
- if(oldNode?.children.length > 0){
312
- for(var i = 0; i < oldNode.children.length; i++){
313
- diff.push(...this.calculateDiff(oldNode.children[i], newNode.children[i]))
314
-
315
- }
324
+ let diff = []
325
+ if (oldNode?.children.length > 0) {
326
+ for (var i = 0; i < oldNode.children.length; i++) {
327
+ diff.push(...this.calculateDiff(oldNode.children[i], newNode.children[i]))
328
+
329
+ }
316
330
  return diff
317
- }
318
- if(!oldNode?._isRoot){
319
- if(oldNode.nodeType === 3 && oldNode.nodeValue !== newNode.nodeValue){
320
- diff.push({type: 'REPLACE', oldNode, newNode})
331
+ }
332
+ if (!oldNode?._isRoot) {
333
+ if (oldNode.nodeType === 3 && oldNode.nodeValue !== newNode.nodeValue) {
334
+ diff.push({ type: 'REPLACE', oldNode, newNode })
321
335
  }
322
- else if(oldNode.nodeType === 1 && oldNode.innerHTML !== newNode.innerHTML
323
- ){
324
- diff.push({type: 'REPLACE', oldNode, newNode})
336
+ else if (oldNode.nodeType === 1 && oldNode.innerHTML !== newNode.innerHTML
337
+ ) {
338
+ diff.push({ type: 'REPLACE', oldNode, newNode })
325
339
  }
326
- else if(oldNode.nodeType === 1 && oldNode.tagName === newNode.tagName){
327
- for(var i = 0; i < oldNode.attributes.length; i++){
328
- if(oldNode.attributes[i].value !== newNode.attributes[i].value){
329
- diff.push({type: 'PROPS', oldNode, newNode})
340
+ else if (oldNode.nodeType === 1 && oldNode.tagName === newNode.tagName) {
341
+ for (var i = 0; i < oldNode.attributes.length; i++) {
342
+ if (oldNode.attributes[i].value !== newNode.attributes[i].value) {
343
+ diff.push({ type: 'PROPS', oldNode, newNode })
330
344
  }
331
345
  }
332
346
  }
333
- }
347
+ }
348
+
334
349
 
335
-
336
350
 
337
351
  return diff
338
352
  }
339
- useEffect(fn, deps){
340
- if(!this.effects.find((el) => el.fn.toString() === fn.toString())){
341
- this.effects.push({fn, deps})
342
- }
343
- else{
344
- let effect = this.effects.find((el) => el.fn.toString() === fn.toString())
345
- if(effect.deps.toString() !== deps.toString()){
346
- effect.deps = deps
347
- effect.fn()
348
- }
349
- }
350
- return () => {
351
- this.effects = this.effects.filter((el) => el.fn !== fn)
352
- }
353
- }
354
- useState(name, initialValue){
355
- if(!this.state[name]){
353
+ useState(name, initialValue) {
354
+ if (!this.state[name]) {
356
355
  this.state[name] = initialValue
357
- }
358
-
356
+ }
357
+
359
358
  let getState = () => this.state[name]
360
- let setState = (newValue) => {
361
- let dEl = this.firstChild.htmlNode
362
- if(dEl.tagName === 'HTML'){
363
- let firstChild = dEl.querySelector('body').firstChild
364
- dEl = firstChild
365
- }
366
- this.state[name] = newValue
367
- let el = Array.from(document.querySelectorAll('*')).find((el) =>{
359
+ let setState = (newValue) => {
360
+ let dEl = this.firstChild.htmlNode
361
+ if (dEl.tagName === 'HTML') {
362
+ dEl = dEl.querySelector('body')
363
+ dEl.firstChild._key = this._key
364
+ }
365
+ this.state[name] = newValue
366
+ let el = Array.from(document.querySelectorAll('*')).find((el) => {
368
367
  return el._key === dEl._key
369
- })
370
- let diff = calculateDiff(el, this.render().htmlNode.tagName === 'HTML' ? this.render().htmlNode.querySelector('body').firstChild : this.render().htmlNode)
368
+ })
369
+ let diff = calculateDiff(el, this.render(this.passiveProps).htmlNode.tagName === 'HTML' ? this.render(this.passiveProps).htmlNode.querySelector('body') : this.render(this.passiveProps).htmlNode)
371
370
  handleDiff(diff)
372
-
373
- }
374
- return [getState, setState]
371
+
372
+ }
373
+ return [getState, setState]
375
374
 
376
375
  }
377
- useReducer(name, reducer, initialState){
376
+ useEffect = useEffect
377
+ useReducer(name, reducer, initialState) {
378
378
  let [state, setState] = this.useState(name, initialState)
379
379
  let dispatch = (action) => {
380
- let newState = reducer(state(), action)
380
+ let newState = reducer(state(), action)
381
381
  setState(newState)
382
382
  }
383
383
 
384
- return [state, dispatch]
384
+ return [state, dispatch]
385
385
  }
386
386
 
387
- render(){
387
+ render() {
388
388
  return null
389
389
  }
390
390
 
391
391
  }
392
-
393
- export async function render(vnode, container, ...passProps){
394
-
395
- if(!vnode){
392
+
393
+ export async function render(vnode, container, ...passProps) {
394
+
395
+ if (!vnode) {
396
396
  throw new Error('No vnode was provided')
397
397
  }
398
398
  // create an object for the node then bind to firstChild
399
- let comp = new Component({$$key: vnode.name || Math.random().toString(36).substring(7)})
399
+ let comp = new Component({ $$key: vnode.name || Math.random().toString(36).substring(7) })
400
400
  vnode = vnode.bind(comp)
401
- comp.render = () => {
402
- return vnode(...passProps)
401
+ if(passProps.length > 0){
402
+
403
+ passProps = {
404
+ req: passProps[0],
405
+ res: passProps[1]
406
+ }
407
+ comp.passiveProps = passProps
408
+ }
409
+ comp.render = () => {
410
+ return vnode(comp.passiveProps)
403
411
  }
404
-
412
+
405
413
  comp.firstChild = comp.render()
406
414
 
407
- if(comp.firstChild.htmlNode.tagName === 'HTML'){
408
- let hasHead = comp.firstChild.htmlNode.querySelector('head') ? true : false
409
- let hasBody = comp.firstChild.htmlNode.querySelector('body') ? true : false
410
-
411
- if(hasHead){
412
- document.head.innerHTML = comp.firstChild.htmlNode.querySelector('head').innerHTML
413
- comp.firstChild.children = comp.firstChild.children.filter((el) =>{
414
- return el.htmlNode.tagName !== 'HEAD'
415
- })
416
- }
417
- if(hasBody){
418
- comp.firstChild.children = comp.firstChild.children.filter((el) =>{
419
- if(el.htmlNode.tagName == 'BODY'){
420
- comp.firstChild = el.children[0]
421
- }
422
- })
423
- }
424
- }
425
- container.innerHTML = ''
426
-
427
- container.appendChild(comp.firstChild.htmlNode)
428
-
429
-
415
+ container.innerHTML = ''
416
+ container.replaceWith(comp.firstChild.htmlNode)
417
+
430
418
  }
431
-
419
+
432
420
  export default Element