Skip to content

Commit 40e5bae

Browse files
committed
[release] 0.12.13
1 parent 39d978d commit 40e5bae

File tree

3 files changed

+134
-52
lines changed

3 files changed

+134
-52
lines changed

dist/vue.js

+129-47
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v0.12.12
2+
* Vue.js v0.12.13
33
* (c) 2015 Evan You
44
* Released under the MIT License.
55
*/
@@ -362,8 +362,9 @@ return /******/ (function(modules) { // webpackBootstrap
362362
*/
363363

364364
var toString = Object.prototype.toString
365+
var OBJECT_STRING = '[object Object]'
365366
exports.isPlainObject = function (obj) {
366-
return toString.call(obj) === '[object Object]'
367+
return toString.call(obj) === OBJECT_STRING
367368
}
368369

369370
/**
@@ -434,7 +435,8 @@ return /******/ (function(modules) { // webpackBootstrap
434435
*/
435436

436437
exports.indexOf = function (arr, obj) {
437-
for (var i = 0, l = arr.length; i < l; i++) {
438+
var i = arr.length
439+
while (i--) {
438440
if (arr[i] === obj) return i
439441
}
440442
return -1
@@ -3153,8 +3155,8 @@ return /******/ (function(modules) { // webpackBootstrap
31533155
'Error when evaluating expression "' +
31543156
this.expression + '". ' +
31553157
(config.debug
3156-
? '' :
3157-
'Turn on debug mode to see stack trace.'
3158+
? ''
3159+
: 'Turn on debug mode to see stack trace.'
31583160
), e
31593161
)
31603162
}
@@ -5589,6 +5591,7 @@ return /******/ (function(modules) { // webpackBootstrap
55895591
this.op =
55905592
this.cb = null
55915593
this.justEntered = false
5594+
this.entered = this.left = false
55925595
this.typeCache = {}
55935596
// bind
55945597
var self = this
@@ -5631,7 +5634,11 @@ return /******/ (function(modules) { // webpackBootstrap
56315634
this.cb = cb
56325635
addClass(this.el, this.enterClass)
56335636
op()
5637+
this.entered = false
56345638
this.callHookWithCb('enter')
5639+
if (this.entered) {
5640+
return // user called done synchronously.
5641+
}
56355642
this.cancel = this.hooks && this.hooks.enterCancelled
56365643
queue.push(this.enterNextTick)
56375644
}
@@ -5647,16 +5654,20 @@ return /******/ (function(modules) { // webpackBootstrap
56475654
_.nextTick(function () {
56485655
this.justEntered = false
56495656
}, this)
5650-
var type = this.getCssTransitionType(this.enterClass)
56515657
var enterDone = this.enterDone
5652-
if (type === TYPE_TRANSITION) {
5653-
// trigger transition by removing enter class now
5658+
var type = this.getCssTransitionType(this.enterClass)
5659+
if (!this.pendingJsCb) {
5660+
if (type === TYPE_TRANSITION) {
5661+
// trigger transition by removing enter class now
5662+
removeClass(this.el, this.enterClass)
5663+
this.setupCssCb(transitionEndEvent, enterDone)
5664+
} else if (type === TYPE_ANIMATION) {
5665+
this.setupCssCb(animationEndEvent, enterDone)
5666+
} else {
5667+
enterDone()
5668+
}
5669+
} else if (type === TYPE_TRANSITION) {
56545670
removeClass(this.el, this.enterClass)
5655-
this.setupCssCb(transitionEndEvent, enterDone)
5656-
} else if (type === TYPE_ANIMATION) {
5657-
this.setupCssCb(animationEndEvent, enterDone)
5658-
} else if (!this.pendingJsCb) {
5659-
enterDone()
56605671
}
56615672
}
56625673

@@ -5665,6 +5676,7 @@ return /******/ (function(modules) { // webpackBootstrap
56655676
*/
56665677

56675678
p.enterDone = function () {
5679+
this.entered = true
56685680
this.cancel = this.pendingJsCb = null
56695681
removeClass(this.el, this.enterClass)
56705682
this.callHook('afterEnter')
@@ -5698,7 +5710,11 @@ return /******/ (function(modules) { // webpackBootstrap
56985710
this.op = op
56995711
this.cb = cb
57005712
addClass(this.el, this.leaveClass)
5713+
this.left = false
57015714
this.callHookWithCb('leave')
5715+
if (this.left) {
5716+
return // user called done synchronously.
5717+
}
57025718
this.cancel = this.hooks && this.hooks.leaveCancelled
57035719
// only need to handle leaveDone if
57045720
// 1. the transition is already done (synchronously called
@@ -5737,6 +5753,7 @@ return /******/ (function(modules) { // webpackBootstrap
57375753
*/
57385754

57395755
p.leaveDone = function () {
5756+
this.left = true
57405757
this.cancel = this.pendingJsCb = null
57415758
this.op()
57425759
removeClass(this.el, this.leaveClass)
@@ -6040,9 +6057,10 @@ return /******/ (function(modules) { // webpackBootstrap
60406057
)
60416058
return
60426059
}
6060+
el.__v_model = this
60436061
handler.bind.call(this)
60446062
this.update = handler.update
6045-
this.unbind = handler.unbind
6063+
this._unbind = handler.unbind
60466064
},
60476065

60486066
/**
@@ -6062,6 +6080,11 @@ return /******/ (function(modules) { // webpackBootstrap
60626080
this.hasWrite = true
60636081
}
60646082
}
6083+
},
6084+
6085+
unbind: function () {
6086+
this.el.__v_model = null
6087+
this._unbind && this._unbind()
60656088
}
60666089
}
60676090

@@ -6550,6 +6573,21 @@ return /******/ (function(modules) { // webpackBootstrap
65506573
*/
65516574

65526575
bind: function () {
6576+
6577+
// some helpful tips...
6578+
/* istanbul ignore if */
6579+
if (
6580+
("development") !== 'production' &&
6581+
this.el.tagName === 'OPTION' &&
6582+
this.el.parentNode && this.el.parentNode.__v_model
6583+
) {
6584+
_.warn(
6585+
'Don\'t use v-repeat for v-model options; ' +
6586+
'use the `options` param instead: ' +
6587+
'http://vuejs.org/guide/forms.html#Dynamic_Select_Options'
6588+
)
6589+
}
6590+
65536591
// support for item in array syntax
65546592
var inMatch = this.expression.match(/(.*) in (.*)/)
65556593
if (inMatch) {
@@ -6588,19 +6626,6 @@ return /******/ (function(modules) { // webpackBootstrap
65886626

65896627
// create cache object
65906628
this.cache = Object.create(null)
6591-
6592-
// some helpful tips...
6593-
/* istanbul ignore if */
6594-
if (
6595-
("development") !== 'production' &&
6596-
this.el.tagName === 'OPTION'
6597-
) {
6598-
_.warn(
6599-
'Don\'t use v-repeat for v-model options; ' +
6600-
'use the `options` param instead: ' +
6601-
'http://vuejs.org/guide/forms.html#Dynamic_Select_Options'
6602-
)
6603-
}
66046629
},
66056630

66066631
/**
@@ -6719,6 +6744,12 @@ return /******/ (function(modules) { // webpackBootstrap
67196744
*/
67206745

67216746
update: function (data) {
6747+
if (("development") !== 'production' && !_.isArray(data)) {
6748+
_.warn(
6749+
'v-repeat pre-converts Objects into Arrays, and ' +
6750+
'v-repeat filters should always return Arrays.'
6751+
)
6752+
}
67226753
if (this.componentId) {
67236754
var state = this.componentState
67246755
if (state === UNRESOLVED) {
@@ -6792,6 +6823,14 @@ return /******/ (function(modules) { // webpackBootstrap
67926823
primitive = !isObject(raw)
67936824
vm = !init && this.getVm(raw, i, converted ? obj.$key : null)
67946825
if (vm) { // reusable instance
6826+
6827+
if (("development") !== 'production' && vm._reused) {
6828+
_.warn(
6829+
'Duplicate objects found in v-repeat="' + this.expression + '": ' +
6830+
JSON.stringify(raw)
6831+
)
6832+
}
6833+
67956834
vm._reused = true
67966835
vm.$index = i // update $index
67976836
// update data for track-by or object repeat,
@@ -6989,7 +7028,7 @@ return /******/ (function(modules) { // webpackBootstrap
69897028
cache[id] = vm
69907029
} else if (!primitive && idKey !== '$index') {
69917030
("development") !== 'production' && _.warn(
6992-
'Duplicate track-by key in v-repeat: ' + id
7031+
'Duplicate objects with the same track-by key in v-repeat: ' + id
69937032
)
69947033
}
69957034
} else {
@@ -6999,8 +7038,8 @@ return /******/ (function(modules) { // webpackBootstrap
69997038
data[id] = vm
70007039
} else {
70017040
("development") !== 'production' && _.warn(
7002-
'Duplicate objects are not supported in v-repeat ' +
7003-
'when using components or transitions.'
7041+
'Duplicate objects found in v-repeat="' + this.expression + '": ' +
7042+
JSON.stringify(data)
70047043
)
70057044
}
70067045
} else {
@@ -7731,6 +7770,7 @@ return /******/ (function(modules) { // webpackBootstrap
77317770
esc: 27,
77327771
tab: 9,
77337772
enter: 13,
7773+
space: 32,
77347774
'delete': 46,
77357775
up: 38,
77367776
left: 37,
@@ -8453,11 +8493,18 @@ return /******/ (function(modules) { // webpackBootstrap
84538493
) {
84548494
ob = value.__ob__
84558495
} else if (
8456-
_.isObject(value) &&
8496+
(_.isArray(value) || _.isPlainObject(value)) &&
84578497
!Object.isFrozen(value) &&
84588498
!value._isVue
84598499
) {
84608500
ob = new Observer(value)
8501+
} else if (true) {
8502+
if (_.isObject(value) && !_.isArray(value) && !_.isPlainObject(value)) {
8503+
_.warn(
8504+
'Unobservable object found in data: ' +
8505+
Object.prototype.toString.call(value)
8506+
)
8507+
}
84618508
}
84628509
if (ob && vm) {
84638510
ob.addVm(vm)
@@ -8505,7 +8552,42 @@ return /******/ (function(modules) { // webpackBootstrap
85058552
Observer.prototype.observeArray = function (items) {
85068553
var i = items.length
85078554
while (i--) {
8508-
this.observe(items[i])
8555+
var ob = this.observe(items[i])
8556+
if (ob) {
8557+
(ob.parents || (ob.parents = [])).push(this)
8558+
}
8559+
}
8560+
}
8561+
8562+
/**
8563+
* Remove self from the parent list of removed objects.
8564+
*
8565+
* @param {Array} items
8566+
*/
8567+
8568+
Observer.prototype.unobserveArray = function (items) {
8569+
var i = items.length
8570+
while (i--) {
8571+
var ob = items[i] && items[i].__ob__
8572+
if (ob) {
8573+
ob.parents.$remove(this)
8574+
}
8575+
}
8576+
}
8577+
8578+
/**
8579+
* Notify self dependency, and also parent Array dependency
8580+
* if any.
8581+
*/
8582+
8583+
Observer.prototype.notify = function () {
8584+
this.dep.notify()
8585+
var parents = this.parents
8586+
if (parents) {
8587+
var i = parents.length
8588+
while (i--) {
8589+
parents[i].notify()
8590+
}
85098591
}
85108592
}
85118593

@@ -8530,12 +8612,6 @@ return /******/ (function(modules) { // webpackBootstrap
85308612
if (childOb) {
85318613
childOb.dep.depend()
85328614
}
8533-
if (_.isArray(val)) {
8534-
for (var e, i = 0, l = val.length; i < l; i++) {
8535-
e = val[i]
8536-
e && e.__ob__ && e.__ob__.dep.depend()
8537-
}
8538-
}
85398615
}
85408616
return val
85418617
},
@@ -8640,7 +8716,7 @@ return /******/ (function(modules) { // webpackBootstrap
86408716
}
86418717
var result = original.apply(this, args)
86428718
var ob = this.__ob__
8643-
var inserted
8719+
var inserted, removed
86448720
switch (method) {
86458721
case 'push':
86468722
inserted = args
@@ -8650,11 +8726,17 @@ return /******/ (function(modules) { // webpackBootstrap
86508726
break
86518727
case 'splice':
86528728
inserted = args.slice(2)
8729+
removed = result
8730+
break
8731+
case 'pop':
8732+
case 'shift':
8733+
removed = [result]
86538734
break
86548735
}
86558736
if (inserted) ob.observeArray(inserted)
8737+
if (removed) ob.unobserveArray(removed)
86568738
// notify change
8657-
ob.dep.notify()
8739+
ob.notify()
86588740
return result
86598741
})
86608742
})
@@ -8731,7 +8813,7 @@ return /******/ (function(modules) { // webpackBootstrap
87318813
return
87328814
}
87338815
ob.convert(key, val)
8734-
ob.dep.notify()
8816+
ob.notify()
87358817
if (ob.vms) {
87368818
var i = ob.vms.length
87378819
while (i--) {
@@ -8779,7 +8861,7 @@ return /******/ (function(modules) { // webpackBootstrap
87798861
if (!ob || _.isReserved(key)) {
87808862
return
87818863
}
8782-
ob.dep.notify()
8864+
ob.notify()
87838865
if (ob.vms) {
87848866
var i = ob.vms.length
87858867
while (i--) {
@@ -9943,13 +10025,15 @@ return /******/ (function(modules) { // webpackBootstrap
994310025
exports.$addChild = function (opts, BaseCtor) {
994410026
BaseCtor = BaseCtor || _.Vue
994510027
opts = opts || {}
9946-
var parent = this
994710028
var ChildVue
10029+
var parent = this
10030+
// transclusion context
10031+
var context = opts._context || parent
994810032
var inherit = opts.inherit !== undefined
994910033
? opts.inherit
995010034
: BaseCtor.options.inherit
995110035
if (inherit) {
9952-
var ctors = parent._childCtors
10036+
var ctors = context._childCtors
995310037
ChildVue = ctors[BaseCtor.cid]
995410038
if (!ChildVue) {
995510039
var optionName = BaseCtor.options.name
@@ -9963,9 +10047,7 @@ return /******/ (function(modules) { // webpackBootstrap
996310047
)()
996410048
ChildVue.options = BaseCtor.options
996510049
ChildVue.linker = BaseCtor.linker
9966-
// important: transcluded inline repeaters should
9967-
// inherit from outer scope rather than host
9968-
ChildVue.prototype = opts._context || this
10050+
ChildVue.prototype = context
996910051
ctors[BaseCtor.cid] = ChildVue
997010052
}
997110053
} else {

0 commit comments

Comments
 (0)