(html: string, attr: string, value: string)
| 236 | } |
| 237 | |
| 238 | function execDataAttrPattern(html: string, attr: string, value: string): TagMatch | null { |
| 239 | const pattern = new RegExp(`(<[^>]*\\b${attr}=(["'])${escapeRegex(value)}\\2[^>]*)>`, "i"); |
| 240 | const match = pattern.exec(html); |
| 241 | if (match?.index == null) return null; |
| 242 | return { tag: match[1], start: match.index, end: match.index + match[1].length }; |
| 243 | } |
| 244 | |
| 245 | function findTagByClass(html: string, target: PatchTarget): TagMatch | null { |
| 246 | const classMatch = target.selector?.match(/^\.([a-zA-Z0-9_-]+)$/); |
no test coverage detected