-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathsvgclass.html
More file actions
26 lines (26 loc) · 635 Bytes
/
svgclass.html
File metadata and controls
26 lines (26 loc) · 635 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="../index.js"></script>
<script>
const {bind, wire} = hyperHTML;
todo(document.body);
function todo(node, items = []) {
let texts = ['a', 'b'];
bind(node)`
<svg width="200" height="200">
<g class="foo">
${texts.map((t, i) => wire(null, `svg:${i}`)`
<rect x=${20 * i} y="35" width=10 height=10 class=${t}></rect>
</g>`)}
</svg>`;
}
</script>
</body>
</html>