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

@@ -14,7 +14,7 @@ export function patchDOMProp(
parentSuspense: any,
unmountChildren: any
) {
if ((key === 'innerHTML' || key === 'textContent') && prevChildren != null) {
if ((key === 'innerHTML' || key === 'textContent') && prevChildren) {
unmountChildren(prevChildren, parentComponent, parentSuspense)
el[key] = value == null ? '' : value
return

View File

@@ -8,7 +8,7 @@ let tempSVGContainer: SVGElement
export const nodeOps: Omit<RendererOptions<Node, Element>, 'patchProp'> = {
insert: (child, parent, anchor) => {
if (anchor != null) {
if (anchor) {
parent.insertBefore(child, anchor)
} else {
parent.appendChild(child)
@@ -17,7 +17,7 @@ export const nodeOps: Omit<RendererOptions<Node, Element>, 'patchProp'> = {
remove: child => {
const parent = child.parentNode
if (parent != null) {
if (parent) {
parent.removeChild(child)
}
},