-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
39 lines (37 loc) · 899 Bytes
/
index.ts
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
import { fromHtml } from 'hast-util-from-html'
import util from 'util'
const tree = fromHtml('<button type="login">Hello</button>', { fragment: true })
console.log(util.inspect(tree, { depth: null }))
/**
* Gives:
{
type: 'root',
children: [
{
type: 'element',
tagName: 'button',
properties: {},
children: [
{ type: 'login' }, <=== Should not be here?
{
type: 'text',
value: 'Hello',
position: {
start: { line: 1, column: 22, offset: 21 },
end: { line: 1, column: 27, offset: 26 }
}
}
],
position: {
start: { line: 1, column: 1, offset: 0 },
end: { line: 1, column: 36, offset: 35 }
}
}
],
data: { quirksMode: false },
position: {
start: { line: 1, column: 1, offset: 0 },
end: { line: 1, column: 36, offset: 35 }
}
}
*/