Skip to content
Merged
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
4 changes: 2 additions & 2 deletions losos/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export function render(container, template) {

var prev = cache.get(container)

// Same template shape — patch only the holes
if (prev && prev.strings === template.strings) {
// Same template — patch holes. Skip if cached DOM was wiped (#15).
if (prev && prev.strings === template.strings && container.firstChild) {
Comment on lines +46 to +47
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Declining the anchor approach. The foreign-DOM case requires a consumer to interleave render() with direct container.appendChild(foreign) between renders on the same container — an unusual pattern; either you manage that container with render() or you do direct DOM ops, not both. The actual #15 consumer (the LOSOS shell) does content.innerHTML = '' immediately before each pane.render(...), so when our render() runs, firstChild is null and the check correctly falls through. Keeping container.firstChild for the lean ethic — +0 cache fields, +0 lines on the build path.

patch(prev.parts, prev.values, template.values)
prev.values = template.values
return
Expand Down