(html: string, elementId: string)
| 749 | } |
| 750 | |
| 751 | export function removeElementFromHtml(html: string, elementId: string): string { |
| 752 | const parser = new DOMParser(); |
| 753 | const doc = parser.parseFromString(html, "text/html"); |
| 754 | if (!doc.documentElement) { |
| 755 | throw new CompositionHtmlParseError( |
| 756 | "removeElementFromHtml: input HTML is empty or could not be parsed", |
| 757 | ); |
| 758 | } |
| 759 | doc.getElementById(elementId)?.remove(); |
| 760 | cascadeRemoveGsapById(doc, elementId); |
| 761 | return "<!DOCTYPE html>\n" + doc.documentElement.outerHTML; |
| 762 | } |
| 763 | |
| 764 | export interface CompositionMetadata { |
| 765 | compositionId: string | null; |
no test coverage detected