( html: string, elementId: string, attr: string, value: string | null, )
| 474 | } |
| 475 | |
| 476 | function 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 | |
| 488 | function patchHtmlAttributeByTarget( |
| 489 | html: string, |
no test coverage detected