diff --git a/src/lib/extractAttributes.ts b/src/lib/extractAttributes.ts index bd5208a8..c235eb10 100644 --- a/src/lib/extractAttributes.ts +++ b/src/lib/extractAttributes.ts @@ -2,7 +2,7 @@ import { AttributeNode, TextNode } from '../print/nodes'; export function extractAttributes(html: string): AttributeNode[] { const extractAttributesRegex = /<[a-z]+[\s\n]*([\s\S]*?)>/im; - const attributeRegex = /([^\s=]+)(?:=("|')([\s\S]*?)\2)?/gim; + const attributeRegex = /([^\s=]+)(?:=("|'|)([\s\S]*?)\2)?([ >]|$)/gim; const [, attributesString] = html.match(extractAttributesRegex)!;