From 26f2e7695a9e7e0d2ca2807d217e9278876de9b1 Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Sat, 25 Mar 2023 19:26:29 +0000 Subject: [PATCH 1/2] Update vhtml.js Specifically check that child nodes are not strictly equal to `false` so that the value zero (0) gets rendered correctly. --- src/vhtml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vhtml.js b/src/vhtml.js index 0e03f69..2e670ba 100644 --- a/src/vhtml.js +++ b/src/vhtml.js @@ -42,7 +42,7 @@ export default function h(name, attrs) { } else while (stack.length) { let child = stack.pop(); - if (child) { + if (child !== false) { if (child.pop) { for (let i=child.length; i--; ) stack.push(child[i]); } From 0eb32c84216fa088ceb0d0a039d8d6606d9bbe88 Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Mon, 27 Mar 2023 11:00:20 +0100 Subject: [PATCH 2/2] Update vhtml.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add explicit checks for `undefined` and `null` (I’ve encountered `undefined` in my testing with [Kitten](https://codeberg.org/kitten/app). Haven’t hit `null` but it would also make it panic, so better safe than sorry). We could use a lax equality comparison (`==`) here but I prefer being explicit about it (but happy either way). --- src/vhtml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vhtml.js b/src/vhtml.js index 2e670ba..3b62329 100644 --- a/src/vhtml.js +++ b/src/vhtml.js @@ -42,7 +42,7 @@ export default function h(name, attrs) { } else while (stack.length) { let child = stack.pop(); - if (child !== false) { + if (child !== false && child !== undefined && child !== null) { if (child.pop) { for (let i=child.length; i--; ) stack.push(child[i]); }