refactor: remove null comparisons

This commit is contained in:
Evan You
2020-03-18 18:14:51 -04:00
parent 811f28a7d1
commit ba9a91c48c
18 changed files with 104 additions and 119 deletions

View File

@@ -295,20 +295,20 @@ function renderElementVNode(
let { props, children, shapeFlag, scopeId, dirs } = vnode
let openTag = `<${tag}`
if (dirs !== null) {
if (dirs) {
props = applySSRDirectives(vnode, props, dirs)
}
if (props !== null) {
if (props) {
openTag += ssrRenderAttrs(props, tag)
}
if (scopeId !== null) {
if (scopeId) {
openTag += ` ${scopeId}`
const treeOwnerId = parentComponent && parentComponent.type.__scopeId
// vnode's own scopeId and the current rendering component's scopeId is
// different - this is a slot content node.
if (treeOwnerId != null && treeOwnerId !== scopeId) {
if (treeOwnerId && treeOwnerId !== scopeId) {
openTag += ` ${treeOwnerId}-s`
}
}
@@ -316,7 +316,7 @@ function renderElementVNode(
push(openTag + `>`)
if (!isVoidTag(tag)) {
let hasChildrenOverride = false
if (props !== null) {
if (props) {
if (props.innerHTML) {
hasChildrenOverride = true
push(props.innerHTML)