(el: Element)
| 68 | } |
| 69 | |
| 70 | function getElementName(el: Element): string { |
| 71 | const dataName = el.getAttribute("data-name"); |
| 72 | if (dataName) return dataName; |
| 73 | |
| 74 | const type = getElementType(el); |
| 75 | if (type === "text") { |
| 76 | const text = el.textContent?.trim().slice(0, 30) || "Text"; |
| 77 | return text.length === 30 ? text + "..." : text; |
| 78 | } |
| 79 | |
| 80 | const src = el.getAttribute("src"); |
| 81 | if (src) { |
| 82 | const filename = src.split("/").pop() || src; |
| 83 | return filename.split("?")[0] ?? filename; |
| 84 | } |
| 85 | |
| 86 | return el.id || el.className?.toString().split(" ")[0] || "Element"; |
| 87 | } |
| 88 | |
| 89 | function getZIndex(el: Element): number { |
| 90 | const dataLayer = el.getAttribute("data-layer"); |
no test coverage detected