Commit b8d0b96b authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #1267 from azamat-sharapov/vue-0.11.8

Updated vue.js to v0.11.8
parents 36917db6 73dba554
/**
* Vue.js v0.11.6
* Vue.js v0.11.8
* (c) 2015 Evan You
* Released under the MIT License.
*/
......@@ -364,6 +364,10 @@ return /******/ (function(modules) { // webpackBootstrap
// attached/detached hooks on them.
this._transCpnts = null
// props used in v-repeat diffing
this._new = true
this._reused = false
// merge options.
options = this.$options = mergeOptions(
this.constructor.options,
......@@ -538,7 +542,7 @@ return /******/ (function(modules) { // webpackBootstrap
var _ = __webpack_require__(11)
var Observer = __webpack_require__(49)
var Dep = __webpack_require__(24)
var Dep = __webpack_require__(23)
/**
* Setup the scope of an instance, which contains:
......@@ -756,7 +760,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) {
var _ = __webpack_require__(11)
var Directive = __webpack_require__(23)
var Directive = __webpack_require__(24)
var compile = __webpack_require__(16)
var transclude = __webpack_require__(17)
......@@ -4093,6 +4097,64 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
var uid = 0
var _ = __webpack_require__(11)
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*
* @constructor
*/
function Dep () {
this.id = ++uid
this.subs = []
}
var p = Dep.prototype
/**
* Add a directive subscriber.
*
* @param {Directive} sub
*/
p.addSub = function (sub) {
this.subs.push(sub)
}
/**
* Remove a directive subscriber.
*
* @param {Directive} sub
*/
p.removeSub = function (sub) {
if (this.subs.length) {
var i = this.subs.indexOf(sub)
if (i > -1) this.subs.splice(i, 1)
}
}
/**
* Notify all subscribers of a new value.
*/
p.notify = function () {
// stablize the subscriber list first
var subs = _.toArray(this.subs)
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update()
}
}
module.exports = Dep
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
var _ = __webpack_require__(11)
......@@ -4318,64 +4380,6 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = Directive
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
var uid = 0
var _ = __webpack_require__(11)
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*
* @constructor
*/
function Dep () {
this.id = ++uid
this.subs = []
}
var p = Dep.prototype
/**
* Add a directive subscriber.
*
* @param {Directive} sub
*/
p.addSub = function (sub) {
this.subs.push(sub)
}
/**
* Remove a directive subscriber.
*
* @param {Directive} sub
*/
p.removeSub = function (sub) {
if (this.subs.length) {
var i = this.subs.indexOf(sub)
if (i > -1) this.subs.splice(i, 1)
}
}
/**
* Notify all subscribers of a new value.
*/
p.notify = function () {
// stablize the subscriber list first
var subs = _.toArray(this.subs)
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update()
}
}
module.exports = Dep
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
......@@ -6011,7 +6015,6 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) {
var _ = __webpack_require__(11)
var config = __webpack_require__(15)
var isObject = _.isObject
var isPlainObject = _.isPlainObject
var textParser = __webpack_require__(19)
......@@ -6061,7 +6064,6 @@ return /******/ (function(modules) { // webpackBootstrap
this._checkParam('track-by') ||
this._checkParam('trackby') // 0.11.0 compat
this.cache = Object.create(null)
this.checkUpdateStrategy()
},
/**
......@@ -6102,8 +6104,10 @@ return /******/ (function(modules) { // webpackBootstrap
var id = _.attr(this.el, 'component')
var options = this.vm.$options
if (!id) {
this.Ctor = _.Vue // default constructor
this.inherit = true // inline repeats should inherit
// default constructor
this.Ctor = _.Vue
// inline repeats should inherit
this.inherit = true
// important: transclude with no options, just
// to ensure block start and block end
this.template = transclude(this.template)
......@@ -6142,30 +6146,6 @@ return /******/ (function(modules) { // webpackBootstrap
}
},
/**
* Check what strategy to use for updates.
*
* If the repeat is simple enough we can use in-place
* updates which simply overwrites existing instances'
* data. This strategy reuses DOM nodes and instances
* as much as possible.
*
* There are two situations where we have to use the
* more complex but more accurate diff algorithm:
* 1. We are using components with or inside v-repeat.
* The components could have private state that needs
* to be preserved across updates.
* 2. We have transitions on the list, which requires
* precise DOM re-positioning.
*/
checkUpdateStrategy: function () {
this.needDiff =
this.asComponent ||
this.el.hasAttribute(config.prefix + 'transition') ||
this.template.querySelector('[' + config.prefix + 'component]')
},
/**
* Update.
* This is called whenever the Array mutates.
......@@ -6181,9 +6161,7 @@ return /******/ (function(modules) { // webpackBootstrap
} else if (type === 'string') {
data = _.toArray(data)
}
this.vms = this.needDiff
? this.diff(data, this.vms)
: this.inplaceUpdate(data, this.vms)
this.vms = this.diff(data, this.vms)
// update v-ref
if (this.refID) {
this.vm.$[this.refID] = this.vms
......@@ -6195,43 +6173,6 @@ return /******/ (function(modules) { // webpackBootstrap
}
},
/**
* Inplace update that maximally reuses existing vm
* instances and DOM nodes by simply swapping data into
* existing vms.
*
* @param {Array} data
* @param {Array} oldVms
* @return {Array}
*/
inplaceUpdate: function (data, oldVms) {
oldVms = oldVms || []
var vms
var dir = this
var alias = dir.arg
var converted = dir.converted
if (data.length < oldVms.length) {
oldVms.slice(data.length).forEach(function (vm) {
vm.$destroy(true)
})
vms = oldVms.slice(0, data.length)
overwrite(data, vms, alias, converted)
} else if (data.length > oldVms.length) {
var newVms = data.slice(oldVms.length).map(function (data, i) {
var vm = dir.build(data, i + oldVms.length)
vm.$before(dir.ref)
return vm
})
overwrite(data.slice(0, oldVms.length), oldVms, alias, converted)
vms = oldVms.concat(newVms)
} else {
overwrite(data, oldVms, alias, converted)
vms = oldVms
}
return vms
},
/**
* Diff, based on new data and old data, determine the
* minimum amount of DOM manipulations needed to make the
......@@ -6321,17 +6262,20 @@ return /******/ (function(modules) { // webpackBootstrap
vm.$before(ref)
}
} else {
// make sure to insert before the comment node if
// the vms are block instances
var nextEl = targetNext._blockStart || targetNext.$el
if (vm._reused) {
// this is the vm we are actually in front of
currentNext = findNextVm(vm, ref)
// we only need to move if we are not in the right
// place already.
if (currentNext !== targetNext) {
vm.$before(targetNext.$el, null, false)
vm.$before(nextEl, null, false)
}
} else {
// new instance, insert to existing next
vm.$before(targetNext.$el)
vm.$before(nextEl)
}
}
vm._new = false
......@@ -6437,9 +6381,7 @@ return /******/ (function(modules) { // webpackBootstrap
var vm
while (i--) {
vm = this.vms[i]
if (this.needDiff) {
this.uncacheVm(vm)
}
this.uncacheVm(vm)
vm.$destroy()
}
}
......@@ -6612,35 +6554,6 @@ return /******/ (function(modules) { // webpackBootstrap
return ret
}
/**
* Helper function to overwrite new data Array on to
* existing vms. Used in `inplaceUpdate`.
*
* @param {Array} arr
* @param {Array} vms
* @param {String|undefined} alias
* @param {Boolean} converted
*/
function overwrite (arr, vms, alias, converted) {
var vm, data, raw
for (var i = 0, l = arr.length; i < l; i++) {
vm = vms[i]
data = raw = arr[i]
if (converted) {
vm.$key = data.$key
raw = data.$value
}
if (alias) {
vm[alias] = raw
} else if (!isObject(raw)) {
vm.$value = raw
} else {
vm._setData(raw)
}
}
}
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
......@@ -6982,7 +6895,7 @@ return /******/ (function(modules) { // webpackBootstrap
var _ = __webpack_require__(11)
var config = __webpack_require__(15)
var Dep = __webpack_require__(24)
var Dep = __webpack_require__(23)
var arrayMethods = __webpack_require__(54)
var arrayKeys = Object.getOwnPropertyNames(arrayMethods)
__webpack_require__(55)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment