(el: Element)
| 242 | |
| 243 | /** Read the text target used by SDK setText. */ |
| 244 | export function getOwnText(el: Element): string { |
| 245 | const singleChild = resolveSingleChildTextTarget(el); |
| 246 | if (singleChild) return singleChild.textContent ?? ""; |
| 247 | let text = ""; |
| 248 | el.childNodes.forEach((n) => { |
| 249 | if (n.nodeType === 3) text += (n as Text).nodeValue ?? ""; |
| 250 | }); |
| 251 | return text; |
| 252 | } |
| 253 | |
| 254 | /** Replace the SDK text target without destroying multi-child element structure. */ |
| 255 | export function setOwnText(el: Element, text: string): void { |
no test coverage detected