Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions losos/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function onUnmount(container, fn) {
}).observe(parent, { childList: true })
}

var HOLE = '\u200B\u200C\u200B' // zero-width chars — survives innerHTML
var HOLE = '<!--losos-->' // comment marker — survives inside <table>
var cache = new WeakMap()

export function html(strings) {
Expand Down Expand Up @@ -79,21 +79,13 @@ export function render(container, template) {
}

function findParts(node, parts) {
if (node.nodeType === 3) {
// Text node — split on HOLE markers
var text = node.textContent
if (text.indexOf(HOLE) === -1) return
var pieces = text.split(HOLE)
if (node.nodeType === 8 && node.textContent === 'losos') {
// Comment marker — replace with empty text node for content insertion
var parent = node.parentNode
for (var i = 0; i < pieces.length; i++) {
if (pieces[i]) parent.insertBefore(document.createTextNode(pieces[i]), node)
if (i < pieces.length - 1) {
var marker = document.createTextNode('')
parent.insertBefore(marker, node)
parts.push({ type: 'text', node: marker })
}
}
var marker = document.createTextNode('')
Comment on lines 81 to +85
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findParts now only recognizes HOLE markers when they parse as comment nodes. In HTML RCDATA/RAWTEXT elements like <textarea> (and also <script>/<style>), the literal string <!--losos--> is parsed as plain text, so no parts are collected and interpolations inside these elements stop rendering (e.g. panes/schema-pane.js uses ${value || ''} inside a <textarea>). Consider keeping the previous text-node split logic as a fallback when a text node contains HOLE, in addition to the new comment-node handling.

Copilot uses AI. Check for mistakes.
parent.insertBefore(marker, node)
parent.removeChild(node)
parts.push({ type: 'text', node: marker })
return
}

Expand Down