-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecursivehtml.js
51 lines (44 loc) · 917 Bytes
/
recursivehtml.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
const hmtlout = ''
const testJSONTAG = () => {
const createChild = elm => {
let _elm = elm
if (_elm.child) {
//ELM
if (_elm.type === 'text') {
console.log(`${_elm.child}`);
} else {
console.log(`<${_elm.type}></${_elm.type}>`);
}
for (var i = 0; i < _elm.child.length; i++) {
createChild(_elm.child[i])
}
}
}
const _html = {
target: 'htmltest',
elm: {
type: 'div',
child: [{
type: 'div',
child: [{
type: 'text',
child: 'hola',
},{
type: 'div',
child: [{
type: 'p',
child: [{
type: 'text',
child: 'text',
}],
}]
}]
}]
}
}
// let out = fn._(_html.target)
let html = _html.elm
// let htmlOut = fn.create(html.type)
createChild(html)
}
testJSONTAG()