MCPcopy Create free account
hub / github.com/SplootCode/splootcode / parseHtml

Function parseHtml

packages/language-web/code_io/import_html.ts:83–96  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

81}
82
83export function parseHtml(source: string): SplootNode {
84 const parser = new DOMParser()
85 const splootNode = new SplootHtmlDocument(null)
86 const htmlDoc = parser.parseFromString(source, 'text/html')
87
88 htmlDoc.childNodes.forEach((childNode: ChildNode) => {
89 const newNode = createNodeFromDomNode(childNode)
90 if (newNode !== null) {
91 splootNode.getBody().addChild(newNode)
92 }
93 })
94
95 return splootNode
96}

Callers

nothing calls this directly

Calls 3

getBodyMethod · 0.95
createNodeFromDomNodeFunction · 0.85
addChildMethod · 0.80

Tested by

no test coverage detected