diff --git a/registry/blocks/claude-exchange/claude-exchange.html b/registry/blocks/claude-exchange/claude-exchange.html
index f4d5142049..94bea49c05 100644
--- a/registry/blocks/claude-exchange/claude-exchange.html
+++ b/registry/blocks/claude-exchange/claude-exchange.html
@@ -920,13 +920,19 @@
/* ============================================================== build */
const screen = document.getElementById("cle-screen");
+ // `html` is this file's own markup (icons, layout), never a variable: editable
+ // strings go through `text`, which sets textContent and so cannot become markup.
const el = (cls, html, tag) => {
const n = document.createElement(tag || "div");
if (cls) n.className = cls;
- // Editable strings reach innerHTML; the template delivery gate rejects angle brackets.
if (html != null) n.innerHTML = html;
return n;
};
+ const text = (cls, value, tag) => {
+ const n = el(cls, null, tag);
+ n.textContent = value;
+ return n;
+ };
// --- status bar
const sb = el("statusbar");
@@ -968,12 +974,11 @@
// tool rows: thinking -> lead sentence -> search -> collapsed "2 steps"
const toolWrap = el("tools");
toolWrap.style.paddingTop = "0px";
- const mkTool = (ico, label) =>
- el(
- "tool-row",
- `
${ico}
${label}
` +
- `${ICO.chevR}
`,
- );
+ const mkTool = (ico, label) => {
+ const row = el("tool-row");
+ row.append(el("tool-ico", ico), text(null, label), el("chev", ICO.chevR));
+ return row;
+ };
// wrap: the shell animates, the child carries the gap
const wrap = (inner, pad) => {
const o = el("abox");
@@ -993,7 +998,7 @@
leadInner.style.paddingTop = "27.1px";
const leadWords = [];
CONFIG.lead.split(" ").forEach((w, i, arr) => {
- const s = el("w", w + (i < arr.length - 1 ? " " : ""), "span");
+ const s = text("w", w + (i < arr.length - 1 ? " " : ""), "span");
leadInner.appendChild(s);
leadWords.push(s);
});
@@ -1041,14 +1046,13 @@
word = word.replace("**", "");
}
if (word.indexOf("{") === 0) {
- const chip = el("cite w", word.replace(/[{}]/g, ""), "span");
+ const chip = text("cite w", word.replace(/[{}]/g, ""), "span");
inner.appendChild(chip);
words.push(chip);
return;
}
- const s = el("w", word, "span");
+ const s = text("w", word, "span");
if (bold) s.style.fontWeight = "700";
- s.textContent = word;
if (close) bold = false;
inner.appendChild(s);
words.push(s);
@@ -1135,7 +1139,7 @@
};
mkCursor();
CONFIG.prompt.split("").forEach((c) => {
- const sp = el("ch", c === " " ? " " : c, "span");
+ const sp = text("ch", c === " " ? "\u00a0" : c, "span");
typedEl.appendChild(sp);
chEls.push(sp);
mkCursor();
diff --git a/registry/blocks/slack-notification-ad/slack-notification-ad.html b/registry/blocks/slack-notification-ad/slack-notification-ad.html
index 27b927a39d..d705c32e48 100644
--- a/registry/blocks/slack-notification-ad/slack-notification-ad.html
+++ b/registry/blocks/slack-notification-ad/slack-notification-ad.html
@@ -510,7 +510,8 @@
{
title: content("payoffTitle", "HeyGen"),
text: content("payoffText", "Heard you needed some videos?"),
- icon: content("payoffIcon", "assets/img/heygen-mark.svg"),
+ icon: "assets/img/heygen-mark.svg",
+ iconVariable: "payoffIcon",
},
],
};
@@ -535,20 +536,29 @@
/* ---------------- build cards ---------------- */
var stackEl = document.getElementById("sna-stack");
+ function node(tag, cls, text) {
+ var n = document.createElement(tag);
+ n.className = cls;
+ if (text != null) n.textContent = text;
+ return n;
+ }
CONFIG.notifs.forEach(function (n, i) {
var card = document.createElement("div");
card.className = "ncard";
card.id = "sna-n" + i;
card.setAttribute("data-layout-allow-overlap", ""); // iOS stack: front card occludes the cards tucked behind it
card.setAttribute("data-layout-allow-occlusion", "");
- card.innerHTML =
- '' +
- '';
- card.querySelector(".ntitle").textContent = n.title;
- card.querySelector(".ntext").textContent = n.text;
+ var img = document.createElement("img");
+ img.alt = "";
+ img.setAttribute("src", n.icon || CONFIG.icon);
+ if (n.iconVariable) img.setAttribute("data-var-src", n.iconVariable);
+ var row = node("div", "nrow");
+ row.append(node("span", "ntitle", n.title), node("span", "ntime", "now"));
+ var body = node("div", "nbody");
+ body.append(row, node("div", "ntext", n.text));
+ var icon = node("div", "nicon");
+ icon.appendChild(img);
+ card.append(icon, body);
stackEl.appendChild(card);
});
var cards = CONFIG.notifs.map(function (_, i) {
diff --git a/scripts/check-registry-innerhtml.mjs b/scripts/check-registry-innerhtml.mjs
index b3dbad24ae..c7470eec6b 100644
--- a/scripts/check-registry-innerhtml.mjs
+++ b/scripts/check-registry-innerhtml.mjs
@@ -10,8 +10,8 @@ import { fileURLToPath } from "node:url";
* variables must set text with `textContent` or build nodes instead, and the files below may only lose writes.
* Lower a count, or delete the entry, when a file is converted.
*
- * chatgpt-exchange's remaining writes are its own icons and layout; its variable text already goes through
- * `textContent`.
+ * The remaining writes in chatgpt-exchange and claude-exchange are their own icons and layout; their variable
+ * text already goes through `textContent`.
*/
export const MARKUP_WRITE_BASELINE = new Map([
["registry/blocks/ai-chat-reveal/ai-chat-reveal.html", 2],
@@ -20,7 +20,6 @@ export const MARKUP_WRITE_BASELINE = new Map([
["registry/blocks/exploded-stack/exploded-stack.html", 1],
["registry/blocks/message-thread-reveal/message-thread-reveal.html", 1],
["registry/blocks/share-sheet-carousel/share-sheet-carousel.html", 1],
- ["registry/blocks/slack-notification-ad/slack-notification-ad.html", 1],
["registry/blocks/wireframe-portal-title/wireframe-portal-title.html", 1],
["registry/components/beat-timeline/beat-timeline.html", 1],
["registry/components/chat-message/chat-message.html", 2],