Skip to content

Commit

Permalink
dryBuild is no longer necessary in v-repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 25, 2014
1 parent 0faf0e6 commit f127ccb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 0 additions & 26 deletions src/directives/repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module.exports = {
ctn.insertBefore(this.ref, el)
ctn.removeChild(el)

this.initiated = false
this.collection = null
this.vms = null

Expand All @@ -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
Expand All @@ -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++) {
Expand Down

0 comments on commit f127ccb

Please sign in to comment.