From: daiwei Date: Thu, 12 Jun 2025 14:12:11 +0000 (+0800) Subject: chore: avoid empty class X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f89d6ea09f35374ac86e05a6bc6ad25187228a2;p=thirdparty%2Fvuejs%2Fcore.git chore: avoid empty class --- diff --git a/packages/runtime-vapor/src/dom/prop.ts b/packages/runtime-vapor/src/dom/prop.ts index f464a2f629..8c42ad766a 100644 --- a/packages/runtime-vapor/src/dom/prop.ts +++ b/packages/runtime-vapor/src/dom/prop.ts @@ -122,7 +122,9 @@ function setClassIncremental(el: any, value: any): void { const prev = el[cacheKey] if ((value = el[cacheKey] = normalizeClass(value)) !== prev) { const nextList = value.split(/\s+/) - el.classList.add(...nextList) + if (value) { + el.classList.add(...nextList) + } if (prev) { for (const cls of prev.split(/\s+/)) { if (!nextList.includes(cls)) el.classList.remove(cls)