Fix HTML attribute parsing for escaped quotes

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk 2026-02-16 13:56:27 +01:00
commit 208600bd16
2 changed files with 2 additions and 1 deletions

View file

@ -0,0 +1 @@
Fix HTML attribute parsing for escaped quotes

View file

@ -23,7 +23,7 @@ export const getAttrs = (tag, filter) => {
.replace(/\/?$/, '') .replace(/\/?$/, '')
.trim() .trim()
const attrs = Array.from( const attrs = Array.from(
innertag.matchAll(/([a-z]+[a-z0-9-]*)(?:=("[^"]+?"|'[^']+?'))?/gi), innertag.matchAll(/([a-z]+[a-z0-9-]*)(?:=((?:"(?:\\.|[^"\\])*")|(?:'(?:\\.|[^'\\])*')))?/gi),
) )
.map(([, key, value]) => [key, value]) .map(([, key, value]) => [key, value])
.map(([k, v]) => { .map(([k, v]) => {