]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: avoid empty class
authordaiwei <daiwei521@126.com>
Thu, 12 Jun 2025 14:12:11 +0000 (22:12 +0800)
committerdaiwei <daiwei521@126.com>
Thu, 12 Jun 2025 14:12:11 +0000 (22:12 +0800)
packages/runtime-vapor/src/dom/prop.ts

index f464a2f6299e56e87593aea0ba867dddd9dd2a49..8c42ad766a51d46d942831a5d81d112db21295e6 100644 (file)
@@ -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)