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

Function getOwnText

packages/sdk/src/engine/model.ts:244–252  ·  view source on GitHub ↗
(el: Element)

Source from the content-addressed store, hash-verified

242
243/** Read the text target used by SDK setText. */
244export 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. */
255export function setOwnText(el: Element, text: string): void {

Callers 2

snapshotTextFunction · 0.85
handleSetTextFunction · 0.85

Calls 1

Tested by

no test coverage detected