Jelajahi Sumber

minor tweaks

Evan You 9 tahun lalu
induk
melakukan
28ec3c7709
3 mengubah file dengan 7 tambahan dan 6 penghapusan
  1. 2 2
      src/core/util/env.js
  2. 5 1
      src/core/vdom/patch.js
  3. 0 3
      src/platforms/weex/runtime/node-ops.js

+ 2 - 2
src/core/util/env.js

@@ -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)

+ 5 - 1
src/core/vdom/patch.js

@@ -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)
+      }
     }
   }
 

+ 0 - 3
src/platforms/weex/runtime/node-ops.js

@@ -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)