MCPcopy Create free account
hub / github.com/TruthHun/BookStack / RootNode

Function RootNode

static/word2md/turndown.js:564–585  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

562var HTMLParser = canParseHTMLNatively() ? root.DOMParser : createHTMLParser();
563
564function RootNode (input) {
565 var root;
566 if (typeof input === 'string') {
567 var doc = htmlParser().parseFromString(
568 // DOM parsers arrange elements in the <head> and <body>.
569 // Wrapping in a custom element ensures elements are reliably arranged in
570 // a single element.
571 '<x-turndown id="turndown-root">' + input + '</x-turndown>',
572 'text/html'
573 );
574 root = doc.getElementById('turndown-root');
575 } else {
576 root = input.cloneNode(true);
577 }
578 collapseWhitespace({
579 element: root,
580 isBlock: isBlock,
581 isVoid: isVoid
582 });
583
584 return root
585}
586
587var _htmlParser;
588function htmlParser () {

Callers

nothing calls this directly

Calls 2

htmlParserFunction · 0.85
collapseWhitespaceFunction · 0.85

Tested by

no test coverage detected