Parsing context element. If specified, given fragment will be parsed as if it was set to the context element's innerHTML
property.
Input HTML fragment string.
Parsing options.
DocumentFragment
const parse5 = require('parse5');
const documentFragment = parse5.parseFragment('<table></table>');
console.log(documentFragment.childNodes[0].tagName); //> 'table'
// Parses the html fragment in the context of the parsed <table> element.
const trFragment = parse5.parseFragment(documentFragment.childNodes[0], '<tr><td>Shake it, baby</td></tr>');
console.log(trFragment.childNodes[0].childNodes[0].tagName); //> 'td'
Optional
options: ParserOptions<T>
Parses an HTML fragment.