* Apply a style property change to an element's inline style in the HTML source.
( html: string, elementId: string, prop: string, value: string | null, )
| 155 | * Apply a style property change to an element's inline style in the HTML source. |
| 156 | */ |
| 157 | function patchInlineStyle( |
| 158 | html: string, |
| 159 | elementId: string, |
| 160 | prop: string, |
| 161 | value: string | null, |
| 162 | ): string { |
| 163 | // Find the element tag with this id |
| 164 | const idPattern = new RegExp(`(<[^>]*\\bid=(["'])${escapeRegex(elementId)}\\2[^>]*)>`, "i"); |
| 165 | const match = idPattern.exec(html); |
| 166 | if (!match) return html; |
| 167 | |
| 168 | const tag = match[1]; |
| 169 | return patchInlineStyleInTag(html, tag, prop, value); |
| 170 | } |
| 171 | |
| 172 | function patchInlineStyleInTag( |
| 173 | html: string, |
no test coverage detected