From 0d1bae1ac2378945b943b1957c36fc5ca91db7e1 Mon Sep 17 00:00:00 2001 From: Jonas Thelemann Date: Thu, 18 Apr 2024 03:07:19 +0200 Subject: [PATCH] fix(validator): account for empty Vue scoped style attributes In an `svg` tag I have many `data-v-...` attributes with an empty value `=""`. These are currently incorrectly replaced by this module's regex. --- src/runtime/validator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/validator.ts b/src/runtime/validator.ts index e877d254..de9becf5 100644 --- a/src/runtime/validator.ts +++ b/src/runtime/validator.ts @@ -29,7 +29,7 @@ export const useChecker = ( } // Clean up Vue scoped style attributes - html = typeof html === 'string' ? html.replace(/ ?data-v-[-A-Za-z0-9]+(=["'][^"']+["'])?/g, '') : html + html = typeof html === 'string' ? html.replace(/ ?data-v-[-A-Za-z0-9]+(=["'][^"']*["'])?/g, '') : html const { valid, results } = await validator.validateString(html) if (valid && !results.length) {