forked from HenrikJoreteg/html-parse-stringify
-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Parsing a plain text node results in an empty list. Current behavior:
const lib = require("html-parse-stringify2");
const nodes = lib.parse("Hello, world!");
nodes.length === 0;Expected behavior:
const lib = require("html-parse-stringify2");
const nodes = lib.parse("Hello, world!");
nodes.length === 1;
nodes[0].type === "text";
nodes[0].content === "Hello, world!";The simplest workaround is to wrap in a container:
const parse = function(html){
return lib.parse("<top>" + html + "</top>")[0].children;
};Metadata
Metadata
Assignees
Labels
No labels