-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathie.js
54 lines (48 loc) · 1.18 KB
/
ie.js
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
window.onload = () => {
const articleElement = document.querySelector('article');
const update = (render, state) => render`
<article
onclick="alert([this.id,this.className])"
data-magic="${state.magic}"
id="${state.id}"
class="${state.class}"
>
<h3>${state.title}</h3>
List of ${state.paragraphs.length} paragraphs:
<ul onclick="${e => alert(e.target.innerHTML)}">${
state.paragraphs
.map(p => hyperHTML.wire(p)`<li>${p.title}</li>`)
}</ul>
</article>
`;
update(
hyperHTML.bind(articleElement),
{
id: 'completely-random',
class: 'it-does-not-matter',
title: 'True story',
magic: true,
paragraphs: [
{title: 'touching'},
{title: 'incredible'},
{title: 'doge'}
]
}
);
const tbody = hyperHTML.bind(document.body.appendChild(
document.createElement('table')
).appendChild(
document.createElement('tbody')
));
tbody`
<tr>
<td>even</td>
<td style="text-align:right;font-weight:bold">IE</td>
</tr>
<tr>
<td colspan="2">
can do partial ${'<tr>'}
</td>
</tr>
`;
};