File size: 627 Bytes
83fe4f9
d28fc5d
 
 
83fe4f9
 
d28fc5d
83fe4f9
d28fc5d
83fe4f9
 
 
 
d28fc5d
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export function TaskCategoryGroup(title, items) {
  const safeItems = items.length
    ? items.map((item) => `<li><label><input type="checkbox" checked /> ${escapeHtml(item)}</label></li>`).join("")
    : `<li class="muted">No tasks in this category yet.</li>`;
  return `
    <div class="category-group">
      <p class="group-title">${escapeHtml(title)}</p>
      <ul>
        ${safeItems}
      </ul>
    </div>
  `;
}

function escapeHtml(value) {
  return String(value)
    .replaceAll("&", "&amp;")
    .replaceAll("<", "&lt;")
    .replaceAll(">", "&gt;")
    .replaceAll('"', "&quot;")
    .replaceAll("'", "&#39;");
}