]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: comments
authorEvan You <yyx990803@gmail.com>
Sat, 1 Jun 2019 09:47:19 +0000 (17:47 +0800)
committerEvan You <yyx990803@gmail.com>
Sat, 1 Jun 2019 09:47:19 +0000 (17:47 +0800)
packages/runtime-core/src/patchFlags.ts
packages/runtime-core/src/vnode.ts

index 53881ad9784e4301e46dddd944bfa2512d2dc572..bbaafcd88d1c5c0feaf31928066da08ba0d152c9 100644 (file)
 // Indicates an element with dynamic textContent (children fast path)
 export const TEXT = 1
 
-// Indicates an element with dynamic class
+// Indicates an element with dynamic class.
+// The compiler also pre-normalizes the :class binding:
+// - b -> normalize(b)
+// - ['foo', b] -> 'foo' + normalize(b)
+// - { a, b: c } -> (a ? a : '') + (b ? c : '')
+// - ['a', b, { c }] -> 'a' + normalize(b) + (c ? c : '')
 export const CLASS = 1 << 1
 
 // Indicates an element with dynamic style
index 5f78aa5959f31c25ef0c1c0b2dcf784150169771..728e995eaaefbb386c7970b5ddd85fc39547e6ca 100644 (file)
@@ -192,7 +192,7 @@ function normalizeStyle(
   }
 }
 
-function normalizeClass(value: unknown): string {
+export function normalizeClass(value: unknown): string {
   let res = ''
   if (isString(value)) {
     res = value