(html: string)
| 27 | * fragment content under document.body. |
| 28 | */ |
| 29 | export function parseHTMLContent(html: string): Document { |
| 30 | const trimmed = html.trimStart().toLowerCase(); |
| 31 | if (trimmed.startsWith("<!doctype") || trimmed.startsWith("<html")) { |
| 32 | return parseHTML(html).document; |
| 33 | } |
| 34 | return parseHTML(`<!DOCTYPE html><html><head></head><body>${html}</body></html>`).document; |
| 35 | } |
| 36 | |
| 37 | export function stripEmbeddedRuntimeScripts(html: string): string { |
| 38 | if (!html) return html; |
no outgoing calls
no test coverage detected