-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.html
More file actions
45 lines (27 loc) · 775 Bytes
/
test.html
File metadata and controls
45 lines (27 loc) · 775 Bytes
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
<script type="text/javascript" src="./htmldom.umd.js"></script>
<script type="text/template" id="temp">
<div>
demo
</div>
</script>
<script type="text/javascript">
/**
* npm run umd
* global var: createHtmlDom
*/
let htmlCode = document.getElementById('temp').innerHTML.trim()
let $ = createHtmlDom(htmlCode)
$('*').each((index, item) => {
console.log(item.name)
})
/*console.log($.nodes)
$('li').each((index, item) => {
let $item = $(item)
$item.replaceWith(`<view>${$item.html()}</view>`)
})*/
// $('li')..replaceWith(`<view>1</view>`)
/*$('div > div').addClass('child').attr('id', 'demo').html('<div>p</div><button>按钮</button>')*/
console.log($.beautify())
console.log($.html())
console.log($.uglify())
</script>