create-node
Converts an HTML string to a DOM node.
Install
npm install --save create-node
or
jspm install create-node
Usage
Passing in markup with one top level element will return an HTMLElement
(or something that inherits from it e.g HTMLDivElement
)
; const markup = `<div> <span>hello</span> <span>world</span></div>`; const node = ;// HTMLDivElement nodetextContent;// 'hello' documentbody;
Passing in markup with multiple top level elements will return an HTMLCollection
of HTMLElement
s.
; const markup = `<span>hello</span><span>world</span>`; const collection = ;// HTMLCollection collection1textContent;// 'world'
License
MIT © Luke Childs