Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81153 views
1
{
2
"name": "DOM level 1",
3
"options": { "withDomLvl1": true },
4
"html": "<div>some stray text<h1>Hello, world.</h1><!-- comment node -->more stray text</div>",
5
"expected": [
6
{
7
"type": "tag",
8
"nodeType": 1,
9
"name": "div",
10
"tagName": "div",
11
"attribs": {},
12
"nodeValue": null,
13
"children": [
14
{
15
"type": "text",
16
"nodeType": 3,
17
"tagName": null,
18
"data": "some stray text",
19
"nodeValue": "some stray text",
20
"childNodes": null,
21
"firstChild": null,
22
"lastChild": null
23
},
24
{
25
"type": "tag",
26
"nodeType": 1,
27
"name": "h1",
28
"tagName": "h1",
29
"nodeValue": null,
30
"attribs": {},
31
"children": [
32
{
33
"type": "text",
34
"nodeType": 3,
35
"tagName": null,
36
"data": "Hello, world.",
37
"nodeValue": "Hello, world.",
38
"childNodes": null,
39
"firstChild": null,
40
"lastChild": null
41
}
42
],
43
"firstChild": {
44
"type": "text",
45
"nodeType": 3,
46
"tagName": null,
47
"data": "Hello, world.",
48
"nodeValue": "Hello, world.",
49
"childNodes": null,
50
"firstChild": null,
51
"lastChild": null
52
},
53
"lastChild": {
54
"type": "text",
55
"nodeType": 3,
56
"tagName": null,
57
"data": "Hello, world.",
58
"nodeValue": "Hello, world.",
59
"childNodes": null,
60
"firstChild": null,
61
"lastChild": null
62
}
63
},
64
{
65
"type": "comment",
66
"nodeType": 8,
67
"tagName": null,
68
"data": " comment node ",
69
"nodeValue": " comment node ",
70
"childNodes": null,
71
"firstChild": null,
72
"lastChild": null,
73
"prev": {
74
"type": "tag",
75
"name": "h1",
76
"nodeValue": null,
77
"attribs": {}
78
},
79
"previousSibling": {
80
"type": "tag",
81
"name": "h1",
82
"nodeValue": null,
83
"attribs": {}
84
},
85
"next": {
86
"type": "text",
87
"tagName": null,
88
"data": "more stray text"
89
},
90
"nextSibling": {
91
"type": "text",
92
"tagName": null,
93
"data": "more stray text"
94
}
95
},
96
{
97
"type": "text",
98
"nodeType": 3,
99
"tagName": null,
100
"data": "more stray text",
101
"nodeValue": "more stray text",
102
"childNodes": null,
103
"firstChild": null,
104
"lastChild": null,
105
"next": null,
106
"nextSibling": null
107
}
108
],
109
"firstChild": {
110
"type": "text",
111
"nodeType": 3,
112
"tagName": null,
113
"data": "some stray text",
114
"nodeValue": "some stray text",
115
"childNodes": null,
116
"firstChild": null,
117
"lastChild": null
118
},
119
"lastChild": {
120
"type": "text",
121
"nodeType": 3,
122
"tagName": null,
123
"data": "more stray text",
124
"nodeValue": "more stray text",
125
"childNodes": null,
126
"firstChild": null,
127
"lastChild": null
128
}
129
}
130
]
131
}
132
133