From: Evan You Date: Sat, 1 Jun 2019 09:47:19 +0000 (+0800) Subject: chore: comments X-Git-Tag: v3.0.0-alpha.0~960 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b77709286f987ec5988f117260319684fde4f342;p=thirdparty%2Fvuejs%2Fcore.git chore: comments --- diff --git a/packages/runtime-core/src/patchFlags.ts b/packages/runtime-core/src/patchFlags.ts index 53881ad978..bbaafcd88d 100644 --- a/packages/runtime-core/src/patchFlags.ts +++ b/packages/runtime-core/src/patchFlags.ts @@ -16,7 +16,12 @@ // 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 diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 5f78aa5959..728e995eaa 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -192,7 +192,7 @@ function normalizeStyle( } } -function normalizeClass(value: unknown): string { +export function normalizeClass(value: unknown): string { let res = '' if (isString(value)) { res = value