-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy patharticle.html
More file actions
38 lines (36 loc) · 899 Bytes
/
article.html
File metadata and controls
38 lines (36 loc) · 899 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
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>body { font-family: sans-serif; }</style>
<script src="../min.js"></script>
</head>
<body><article></article></body>
<script>
function update(render, state) {
render`
<article data-magic="${state.magic}">
<h3>${state.title}</h3>
List of ${state.paragraphs.length} paragraphs:
<ul>
${state.paragraphs.map(
p => hyperHTML.wire(p)`
<li> ${p.title} </li>`)}
</ul>
</article>
`;
}
const articleElement = document.querySelector('article');
const state = {
title: 'True story',
magic: true,
paragraphs: [
{title: 'touching'},
{title: 'incredible'},
{title: 'doge'}
]
};
const render = hyperHTML.bind(articleElement);
update(render, state);
</script>
</html>