extensions/emmet/src/util.ts/setupScriptNodeSubtree
export function setupScriptNodeSubtree(documentText: string, scriptNode: HtmlFlatNode): string {
	const isTemplateScript = scriptNode.name === 'script' &&
		(scriptNode.attributes &&
			scriptNode.attributes.some(x => x.name.toString() === 'type'
				&& allowedMimeTypesInScriptTag.includes(x.value.toString())));
	if (isTemplateScript
		&& scriptNode.open) {
		// blank out the rest of the document and generate the subtree.
		const beforePadding = ' '.repeat(scriptNode.open.end);
		const endToUse = scriptNode.close ? scriptNode.close.start : scriptNode.end;
		const scriptBodyText = beforePadding + documentText.substring(scriptNode.open.end, endToUse);
		const innerRoot: HtmlFlatNode = parse(scriptBodyText);
		innerRoot.children.forEach(child => {
			scriptNode.children.push(child);
			child.parent = scriptNode;
		});
		return scriptBodyText;
	}
	return '';
}