(el: Element)
| 45 | } |
| 46 | |
| 47 | function 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 | |
| 70 | function getElementName(el: Element): string { |
| 71 | const dataName = el.getAttribute("data-name"); |
no test coverage detected