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

Function findTagByTarget

packages/studio/src/utils/sourcePatcher.ts:269–289  ·  view source on GitHub ↗
(html: string, target: PatchTarget)

Source from the content-addressed store, hash-verified

267}
268
269export function findTagByTarget(html: string, target: PatchTarget): TagMatch | null {
270 if (target.hfId) {
271 const result = execDataAttrPattern(html, "data-hf-id", target.hfId);
272 if (result) return result;
273 }
274
275 if (target.id) {
276 const result = execDataAttrPattern(html, "id", target.id);
277 if (result) return result;
278 }
279
280 if (!target.selector) return null;
281
282 const compositionIdMatch = target.selector.match(/^\[data-composition-id="([^"]+)"\]$/);
283 if (compositionIdMatch) {
284 const result = execDataAttrPattern(html, "data-composition-id", compositionIdMatch[1]);
285 if (result) return result;
286 }
287
288 return findTagByClass(html, target);
289}
290
291export function readAttributeByTarget(
292 html: string,

Callers 7

useFileManagerFunction · 0.90
patchInlineStyleByTargetFunction · 0.85
readAttributeByTargetFunction · 0.85
readTagSnippetByTargetFunction · 0.85
patchAttributeByTargetFunction · 0.85
patchTextContentByTargetFunction · 0.85

Calls 2

execDataAttrPatternFunction · 0.85
findTagByClassFunction · 0.85

Tested by

no test coverage detected