-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
125 lines (105 loc) · 2.51 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TemplateTemplate: Examples</title>
<style>
body {
color: #333;
font-family: sans-serif;
line-height: 1.5;
padding: 3rem;
}
a {
color: #c00;
text-decoration: underline;
}
a:focus,
a:hover {
color: #a00;
}
table {
border-collapse: collapse;
width: 100%;
}
caption {
font-size: 1.25rem;
font-weight: bold;
margin-bottom: 0.5rem;
text-align: left;
}
thead {
background-color: #eee;
border-bottom: 0.25rem solid #ccc;
}
tbody tr {
border-bottom: 0.0625rem solid #ccc;
}
tr:hover {
background-color: #fafafa;
}
th,
td {
padding: 0.75rem 0.5rem 0.5rem;
}
th {
font-weight: bold;
text-align: left;
}
</style>
</head>
<body>
<h1>TemplateTemplate: Example</h1>
<table id="projects">
<caption>A table of open source projects.</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Author</th>
<th scope="col">URL</th>
<th scope="col">Languages</th>
</tr>
</thead>
<tbody></tbody>
</table>
<template id="row-template">
<tr>
<th class="name" scope="row"></th>
<td class="author"></td>
<td class="url"></td>
<td class="languages"></td>
</tr>
</template>
<template id="anchor-template">
<a></a>
</template>
<script type="module">
import TemplateTemplate from "../index.js";
const anchor = document.createElement("a");
anchor.href = "https://sixtwothree.org";
anchor.textContent = "Jason Garber";
document.querySelector("#projects tbody").append(
TemplateTemplate(document.querySelector("#row-template"), {
".name": "TemplateTemplate",
".author": "Jason Garber",
".url": "https://github.com/jgarber623/TemplateTemplate",
".languages": "JavaScript",
}),
TemplateTemplate("#row-template", {
"th": "CashCash",
"th + td": anchor,
".url": ["https://github.com/jgarber623/CashCash", {
"style": "font-style: italic;",
}],
"td:last-child": TemplateTemplate("#anchor-template", {
"a": ["JavaScript", {
"href": "https://github.com/search?q=language%3AJavaScript",
"target": "_blank",
}],
}),
})
);
</script>
</body>
</html>