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

Function getElementType

packages/parsers/src/htmlParser.ts:47–68  ·  view source on GitHub ↗
(el: Element)

Source from the content-addressed store, hash-verified

45}
46
47function getElementType(el: Element): TimelineElementType | null {
48 const tag = el.tagName.toLowerCase();
49 if (tag === "video") return "video";
50 if (tag === "img") return "image";
51 if (tag === "audio") return "audio";
52 // Check for explicit data-type attribute first
53 const dataType = el.getAttribute("data-type");
54 if (dataType === "composition") return "composition";
55 if (dataType === "text") return "text";
56 // Fall back to tag-based detection for backwards compatibility
57 if (
58 tag === "div" ||
59 tag === "p" ||
60 tag === "h1" ||
61 tag === "h2" ||
62 tag === "h3" ||
63 tag === "span"
64 ) {
65 return "text";
66 }
67 return null;
68}
69
70function getElementName(el: Element): string {
71 const dataName = el.getAttribute("data-name");

Callers 2

getElementNameFunction · 0.85
parseHtmlFunction · 0.85

Calls 1

getAttributeMethod · 0.65

Tested by

no test coverage detected