From 8c7b001a39c7536f4340a425dddef7ab18255c27 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Mon, 12 Sep 2022 10:51:34 -0400 Subject: [PATCH] Ignore non-VNode objects during rendering This fixes #245. --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index 9892d218..a38332ac 100644 --- a/src/index.js +++ b/src/index.js @@ -209,6 +209,9 @@ function _renderToString(vnode, context, isSvgMode, selectValue, parent) { } return rendered; } + + // VNodes have {constructor:undefined} to prevent JSON injection: + if (vnode.constructor !== undefined) return ''; vnode[PARENT] = parent; if (options[DIFF]) options[DIFF](vnode);