Fix HTML attribute parsing for escaped quotes #480
1 changed files with 1 additions and 1 deletions
Fix HTML attribute parsing, discard attributes not strating with a letter
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
commit
b04e4810f8
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue