Prechádzať zdrojové kódy

avoid no parent detach

Evan You 12 rokov pred
rodič
commit
61e897ea88
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      src/directives/each.js

+ 2 - 3
src/directives/each.js

@@ -186,15 +186,14 @@ module.exports = {
         var c = this.container,
             p = this.parent = c.parentNode,
             n = this.next = c.nextSibling
-        if (p) {
-            p.removeChild(c)
-        }
+        if (p) p.removeChild(c)
     },
 
     retach: function () {
         var n = this.next,
             p = this.parent,
             c = this.container
+        if (!p) return
         if (n) {
             p.insertBefore(c, n)
         } else {