From 689a6a4670d2fb88c4393dfb0109481a264b8d24 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 16 Jun 2020 21:27:30 -0500 Subject: [PATCH] Fix provided allows for the user to remove all HTML without the crash - Error is thrown if rootNode isnt in scope and markup is not a typeof string --- src/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.js b/src/parser.js index e23d4cef..e4bcecdd 100644 --- a/src/parser.js +++ b/src/parser.js @@ -243,7 +243,7 @@ function runUnsafe({ rootNode, query }) { } function parse({ rootNode, markup, query, cacheId, prevResult }) { - if (!markup && !rootNode) { + if (typeof markup !== 'string' && !rootNode) { throw new Error('either markup or rootNode should be provided'); }