MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / removeElementFromHtml

Function removeElementFromHtml

packages/parsers/src/htmlParser.ts:751–762  ·  view source on GitHub ↗
(html: string, elementId: string)

Source from the content-addressed store, hash-verified

749}
750
751export 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
764export interface CompositionMetadata {
765 compositionId: string | null;

Callers 2

htmlParser.test.tsFile · 0.70

Calls 1

cascadeRemoveGsapByIdFunction · 0.85

Tested by

no test coverage detected