Browse Source

dryBuild is no longer necessary in v-repeat

Evan You 12 years ago
parent
commit
f127ccb81f
2 changed files with 1 additions and 27 deletions
  1. 1 1
      src/compiler.js
  2. 0 26
      src/directives/repeat.js

+ 1 - 1
src/compiler.js

@@ -836,7 +836,7 @@ CompilerProto.getOption = function (type, id, silent) {
                 ? parent.getOption(type, id, silent)
                 : globalAssets[type] && globalAssets[type][id]
         )
-    if (!res && !silent) {
+    if (!res && !silent && typeof id === 'string') {
         utils.warn('Unknown ' + type.slice(0, -1) + ': ' + id)
     }
     return res

+ 0 - 26
src/directives/repeat.js

@@ -25,7 +25,6 @@ module.exports = {
         ctn.insertBefore(this.ref, el)
         ctn.removeChild(el)
 
-        this.initiated = false
         this.collection = null
         this.vms = null
 
@@ -41,13 +40,6 @@ module.exports = {
             }
         }
 
-        // if initiating with an empty collection, we need to
-        // force a compile so that we get all the bindings for
-        // dependency extraction.
-        if (!this.initiated && (!collection || !collection.length)) {
-            this.dryBuild()
-        }
-
         // keep reference of old data and VMs
         // so we can reuse them if possible
         this.oldVMs = this.vms
@@ -65,24 +57,6 @@ module.exports = {
 
     },
 
-    /**
-     *  Run a dry build just to collect bindings
-     */
-    dryBuild: function () {
-        var el = this.el.cloneNode(true),
-            Ctor = this.compiler.resolveComponent(el)
-        new Ctor({
-            el     : el,
-            parent : this.vm,
-            data   : { $index: 0 },
-            compilerOptions: {
-                repeat: true,
-                expCache: this.expCache
-            }
-        }).$destroy()
-        this.initiated = true
-    },
-
     init: function (collection, isObject) {
         var vm, vms = []
         for (var i = 0, l = collection.length; i < l; i++) {