How to use the htmlparser2.DomUtils.getOuterHTML function in htmlparser2

To help you get started, we’ve selected a few htmlparser2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plasma-umass / BLeak / src / lib / transformations.ts View on Github external
if (!injectionTarget.children) {
      injectionTarget.children = [];
    }
    injectionTarget.children = injection.concat(injectionTarget.children);
  } else {
    // AngularJS??
    return source;
  }
  inlineScripts.forEach((n, i) => {
    if (!n.children || n.children.length !== 1) {
      console.log(`Weird! Found JS node with the following children: ${JSON.stringify(n.children)}`);
      return;
    }
    n.children[0].data = jsTransform(`${filename}-inline${i}.js`, n.children[0].data);
  });
  return DomUtils.getOuterHTML(parsedHTML);
}
github isleofcode / corber / lib / tasks / add-cordova-js.js View on Github external
return fsUtils.read(source).then((fileContents) => {
    let dom = getDom(fileContents);

    if (scriptElementExists(dom)) { return Promise.resolve(); }

    setupIndex(dom);

    return fsUtils.write(source, DomUtils.getOuterHTML(dom));
  });
};