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

Function patchHtmlAttribute

packages/studio/src/utils/sourcePatcher.ts:476–486  ·  view source on GitHub ↗
(
  html: string,
  elementId: string,
  attr: string,
  value: string | null,
)

Source from the content-addressed store, hash-verified

474}
475
476function patchHtmlAttribute(
477 html: string,
478 elementId: string,
479 attr: string,
480 value: string | null,
481): string {
482 const idPattern = new RegExp(`(<[^>]*\\bid=(["'])${escapeRegex(elementId)}\\2[^>]*)>`, "i");
483 const match = idPattern.exec(html);
484 if (!match) return html;
485 return patchHtmlAttributeInTag(html, match[1], attr, value);
486}
487
488function patchHtmlAttributeByTarget(
489 html: string,

Callers 1

applyPatchFunction · 0.85

Calls 2

patchHtmlAttributeInTagFunction · 0.85
escapeRegexFunction · 0.70

Tested by

no test coverage detected