minor tweaks

This commit is contained in:
Evan You 2016-12-07 16:44:10 -05:00
parent d2f7f1913e
commit 28ec3c7709
3 changed files with 7 additions and 6 deletions

View File

@ -132,10 +132,10 @@ if (typeof Set !== 'undefined' && isNative(Set)) {
this.set = Object.create(null)
}
has (key: string | number) {
return this.set[key] !== undefined
return this.set[key] === true
}
add (key: string | number) {
this.set[key] = 1
this.set[key] = true
}
clear () {
this.set = Object.create(null)

View File

@ -202,7 +202,11 @@ export function createPatchFunction (backend) {
function insert (parent, elm, ref) {
if (parent) {
nodeOps.insertBefore(parent, elm, ref)
if (ref) {
nodeOps.insertBefore(parent, elm, ref)
} else {
nodeOps.appendChild(parent, elm)
}
}
}

View File

@ -19,9 +19,6 @@ export function createComment (text) {
}
export function insertBefore (node, target, before) {
if (!before) {
return appendChild(node, target)
}
if (target.nodeType === 3) {
if (node.type === 'text') {
node.setAttr('value', target.text)