refactor: remove null comparisons
This commit is contained in:
@@ -196,7 +196,7 @@ export function createBlock(
|
||||
currentBlock = blockStack[blockStack.length - 1] || null
|
||||
// a block is always going to be patched, so track it as a child of its
|
||||
// parent block
|
||||
if (currentBlock !== null) {
|
||||
if (currentBlock) {
|
||||
currentBlock.push(vnode)
|
||||
}
|
||||
return vnode
|
||||
@@ -239,13 +239,13 @@ export function createVNode(
|
||||
}
|
||||
|
||||
// class & style normalization.
|
||||
if (props !== null) {
|
||||
if (props) {
|
||||
// for reactive or proxy objects, we need to clone it to enable mutation.
|
||||
if (isReactive(props) || SetupProxySymbol in props) {
|
||||
props = extend({}, props)
|
||||
}
|
||||
let { class: klass, style } = props
|
||||
if (klass != null && !isString(klass)) {
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass)
|
||||
}
|
||||
if (isObject(style)) {
|
||||
@@ -275,9 +275,9 @@ export function createVNode(
|
||||
_isVNode: true,
|
||||
type,
|
||||
props,
|
||||
key: props !== null && props.key !== undefined ? props.key : null,
|
||||
key: props && props.key !== undefined ? props.key : null,
|
||||
ref:
|
||||
props !== null && props.ref !== undefined
|
||||
props && props.ref !== undefined
|
||||
? [currentRenderingInstance!, props.ref]
|
||||
: null,
|
||||
scopeId: currentScopeId,
|
||||
@@ -304,7 +304,7 @@ export function createVNode(
|
||||
// the next vnode so that it can be properly unmounted later.
|
||||
if (
|
||||
shouldTrack > 0 &&
|
||||
currentBlock !== null &&
|
||||
currentBlock &&
|
||||
// the EVENTS flag is only for hydration and if it is the only flag, the
|
||||
// vnode should not be considered dynamic due to handler caching.
|
||||
patchFlag !== PatchFlags.HYDRATE_EVENTS &&
|
||||
|
||||
Reference in New Issue
Block a user