Fix HTML attribute parsing for escaped quotes #480

Merged
Oneric merged 2 commits from mkljczk/akkoma-fe:get-attrs-fix into develop 2026-02-19 12:32:01 +00:00

View file

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