-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (60 loc) · 1.75 KB
/
index.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.container { background: #CCC; }
.block {
position: relative;
width: 100px;
height: 100px;
background: #888;
border-radius: 33%;
color: white;
font-size: 10px;
}
.container {
padding: 15px;
}
.block-child {
position: absolute;
left: 70px;
top: 20px;
width: 50px;
height: 50px;
background: #333;
border-radius: 33%;
}
</style>
</head>
<body>
Source:
<div class="container">
<div id="source" class="block">
T説🧜pѬѬasѪ"§§)("!编/)$=?!°&%)?§"$(§sw汉字编码§"$(§sw汉字方法orФdpѬѬasѪ"§§)("!/)$=?!°&%)?编码方法orФd
<div class="block-child"></div>
</div>
</div>
Target (Copy without child and overloaded style):
<div class="container">
<img id="target"/>
</div>
<script type="module">
import nodeToDataURL from './src/index.ts'
const visualSource = document.getElementById('source')
const imageTarget = document.getElementById('target')
const excluded = document.querySelectorAll('.block-child')
nodeToDataURL({
targetNode: visualSource,
excludedNodes: excluded,
customStyle: '.block { background: red; }'
})
.then((url) => {
imageTarget.setAttribute('src', url);
})
</script>
</body>
</html>