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

Function createHTMLParser

static/word2md/turndown.js:526–550  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

524}
525
526function createHTMLParser () {
527 var Parser = function () {};
528
529 {
530 if (shouldUseActiveX()) {
531 Parser.prototype.parseFromString = function (string) {
532 var doc = new window.ActiveXObject('htmlfile');
533 doc.designMode = 'on'; // disable on-page scripts
534 doc.open();
535 doc.write(string);
536 doc.close();
537 return doc
538 };
539 } else {
540 Parser.prototype.parseFromString = function (string) {
541 var doc = document.implementation.createHTMLDocument('');
542 doc.open();
543 doc.write(string);
544 doc.close();
545 return doc
546 };
547 }
548 }
549 return Parser
550}
551
552function shouldUseActiveX () {
553 var useActiveX = false;

Callers 1

turndown.jsFile · 0.85

Calls 1

shouldUseActiveXFunction · 0.70

Tested by

no test coverage detected