vue 2.5.6 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -14
- package/dist/vue.common.js +170 -105
- package/dist/vue.esm.browser.js +10733 -0
- package/dist/vue.esm.js +170 -105
- package/dist/vue.js +170 -105
- package/dist/vue.min.js +2 -2
- package/dist/vue.runtime.common.js +139 -90
- package/dist/vue.runtime.esm.js +139 -90
- package/dist/vue.runtime.js +139 -90
- package/dist/vue.runtime.min.js +2 -2
- package/package.json +2 -2
- package/src/compiler/codegen/index.js +4 -6
- package/src/compiler/error-detector.js +12 -6
- package/src/compiler/parser/index.js +16 -6
- package/src/core/components/keep-alive.js +8 -5
- package/src/core/global-api/assets.js +3 -9
- package/src/core/global-api/extend.js +3 -9
- package/src/core/instance/init.js +9 -5
- package/src/core/instance/lifecycle.js +4 -1
- package/src/core/instance/render-helpers/render-static.js +7 -13
- package/src/core/instance/render-helpers/resolve-slots.js +1 -1
- package/src/core/observer/traverse.js +1 -1
- package/src/core/observer/watcher.js +5 -1
- package/src/core/util/options.js +22 -11
- package/src/core/vdom/create-component.js +1 -6
- package/src/core/vdom/create-functional-component.js +4 -4
- package/src/core/vdom/patch.js +27 -9
- package/src/core/vdom/vnode.js +9 -6
- package/src/platforms/web/runtime/modules/attrs.js +19 -2
- package/src/platforms/web/runtime/modules/dom-props.js +15 -9
- package/src/platforms/weex/entry-framework.js +10 -4
- package/src/server/bundle-renderer/create-bundle-runner.js +1 -1
- package/src/server/create-renderer.js +6 -2
- package/src/server/optimizing-compiler/modules.js +1 -1
- package/src/server/render-context.js +1 -1
- package/src/server/render.js +6 -9
- package/types/options.d.ts +5 -6
- package/types/vnode.d.ts +4 -4
- package/types/vue.d.ts +7 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p align="center"><a href="https://vuejs.org" target="_blank"><img width="100"src="https://vuejs.org/images/logo.png"></a></p>
|
|
1
|
+
<p align="center"><a href="https://vuejs.org" target="_blank"><img width="100" src="https://vuejs.org/images/logo.png" alt="Vue logo"></a></p>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<a href="https://circleci.com/gh/vuejs/vue/tree/dev"><img src="https://img.shields.io/circleci/project/vuejs/vue/dev.svg" alt="Build Status"></a>
|
|
@@ -26,19 +26,32 @@ Funds donated via Patreon goes directly to support Evan You's full-time work on
|
|
|
26
26
|
|
|
27
27
|
<h4 align="center">Platinum</h4>
|
|
28
28
|
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</
|
|
29
|
+
<table>
|
|
30
|
+
<tbody>
|
|
31
|
+
<tr>
|
|
32
|
+
<td align="center" valign="middle">
|
|
33
|
+
<a href="https://stdlib.com">
|
|
34
|
+
<img width="220px" src="https://raw.githubusercontent.com/vuejs/vuejs.org/master/themes/vue/source/images/stdlib.png">
|
|
35
|
+
</a>
|
|
36
|
+
</td>
|
|
37
|
+
<td>
|
|
38
|
+
<a href="https://xiaozhuanlan.com">
|
|
39
|
+
<img width="160px" src="https://raw.githubusercontent.com/vuejs/cn.vuejs.org/master/themes/vue/source/images/xiaozhuanlan.png">
|
|
40
|
+
</a>
|
|
41
|
+
</td>
|
|
42
|
+
<td>
|
|
43
|
+
<a href="http://tooltwist.com" target="_blank">
|
|
44
|
+
<img width="200px" src="https://raw.githubusercontent.com/vuejs/vuejs.org/master/themes/vue/source/images/tooltwist.png">
|
|
45
|
+
</a>
|
|
46
|
+
</td>
|
|
47
|
+
<td>
|
|
48
|
+
<a href="https://www.infinitynewtab.com/donate/index.html" target="_blank">
|
|
49
|
+
<img width="200px" src="https://raw.githubusercontent.com/vuejs/vuejs.org/master/themes/vue/source/images/infinitynewtab.png">
|
|
50
|
+
</a>
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
</tbody>
|
|
54
|
+
</table>
|
|
42
55
|
|
|
43
56
|
<h4 align="center">Gold</h4>
|
|
44
57
|
|
package/dist/vue.common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.5.
|
|
2
|
+
* Vue.js v2.5.10
|
|
3
3
|
* (c) 2014-2017 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -717,9 +717,9 @@ var VNode = function VNode (
|
|
|
717
717
|
this.elm = elm;
|
|
718
718
|
this.ns = undefined;
|
|
719
719
|
this.context = context;
|
|
720
|
-
this.
|
|
721
|
-
this.
|
|
722
|
-
this.
|
|
720
|
+
this.fnContext = undefined;
|
|
721
|
+
this.fnOptions = undefined;
|
|
722
|
+
this.fnScopeId = undefined;
|
|
723
723
|
this.key = data && data.key;
|
|
724
724
|
this.componentOptions = componentOptions;
|
|
725
725
|
this.componentInstance = undefined;
|
|
@@ -778,6 +778,9 @@ function cloneVNode (vnode, deep) {
|
|
|
778
778
|
cloned.isStatic = vnode.isStatic;
|
|
779
779
|
cloned.key = vnode.key;
|
|
780
780
|
cloned.isComment = vnode.isComment;
|
|
781
|
+
cloned.fnContext = vnode.fnContext;
|
|
782
|
+
cloned.fnOptions = vnode.fnOptions;
|
|
783
|
+
cloned.fnScopeId = vnode.fnScopeId;
|
|
781
784
|
cloned.isCloned = true;
|
|
782
785
|
if (deep) {
|
|
783
786
|
if (vnode.children) {
|
|
@@ -1146,18 +1149,18 @@ function mergeDataOrFn (
|
|
|
1146
1149
|
// it has to be a function to pass previous merges.
|
|
1147
1150
|
return function mergedDataFn () {
|
|
1148
1151
|
return mergeData(
|
|
1149
|
-
typeof childVal === 'function' ? childVal.call(this) : childVal,
|
|
1150
|
-
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
|
|
1152
|
+
typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
|
1153
|
+
typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
|
1151
1154
|
)
|
|
1152
1155
|
}
|
|
1153
1156
|
} else {
|
|
1154
1157
|
return function mergedInstanceDataFn () {
|
|
1155
1158
|
// instance merge
|
|
1156
1159
|
var instanceData = typeof childVal === 'function'
|
|
1157
|
-
? childVal.call(vm)
|
|
1160
|
+
? childVal.call(vm, vm)
|
|
1158
1161
|
: childVal;
|
|
1159
1162
|
var defaultData = typeof parentVal === 'function'
|
|
1160
|
-
? parentVal.call(vm)
|
|
1163
|
+
? parentVal.call(vm, vm)
|
|
1161
1164
|
: parentVal;
|
|
1162
1165
|
if (instanceData) {
|
|
1163
1166
|
return mergeData(instanceData, defaultData)
|
|
@@ -1309,13 +1312,24 @@ var defaultStrat = function (parentVal, childVal) {
|
|
|
1309
1312
|
*/
|
|
1310
1313
|
function checkComponents (options) {
|
|
1311
1314
|
for (var key in options.components) {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1315
|
+
validateComponentName(key);
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
function validateComponentName (name) {
|
|
1320
|
+
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
|
|
1321
|
+
warn(
|
|
1322
|
+
'Invalid component name: "' + name + '". Component names ' +
|
|
1323
|
+
'can only contain alphanumeric characters and the hyphen, ' +
|
|
1324
|
+
'and must start with a letter.'
|
|
1325
|
+
);
|
|
1326
|
+
}
|
|
1327
|
+
var lower = name.toLowerCase();
|
|
1328
|
+
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
|
|
1329
|
+
warn(
|
|
1330
|
+
'Do not use built-in or reserved HTML elements as component ' +
|
|
1331
|
+
'id: ' + name
|
|
1332
|
+
);
|
|
1319
1333
|
}
|
|
1320
1334
|
}
|
|
1321
1335
|
|
|
@@ -1933,7 +1947,7 @@ function traverse (val) {
|
|
|
1933
1947
|
function _traverse (val, seen) {
|
|
1934
1948
|
var i, keys;
|
|
1935
1949
|
var isA = Array.isArray(val);
|
|
1936
|
-
if ((!isA && !isObject(val)) ||
|
|
1950
|
+
if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
|
|
1937
1951
|
return
|
|
1938
1952
|
}
|
|
1939
1953
|
if (val.__ob__) {
|
|
@@ -2524,7 +2538,7 @@ function resolveSlots (
|
|
|
2524
2538
|
}
|
|
2525
2539
|
// named slots should only be respected if the vnode was rendered in the
|
|
2526
2540
|
// same context.
|
|
2527
|
-
if ((child.context === context || child.
|
|
2541
|
+
if ((child.context === context || child.fnContext === context) &&
|
|
2528
2542
|
data && data.slot != null
|
|
2529
2543
|
) {
|
|
2530
2544
|
var name = child.data.slot;
|
|
@@ -2744,7 +2758,10 @@ function mountComponent (
|
|
|
2744
2758
|
};
|
|
2745
2759
|
}
|
|
2746
2760
|
|
|
2747
|
-
vm._watcher
|
|
2761
|
+
// we set this to vm._watcher inside the watcher's constructor
|
|
2762
|
+
// since the watcher's initial patch may call $forceUpdate (e.g. inside child
|
|
2763
|
+
// component's mounted hook), which relies on vm._watcher being already defined
|
|
2764
|
+
new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
|
|
2748
2765
|
hydrating = false;
|
|
2749
2766
|
|
|
2750
2767
|
// manually mounted instance, call mounted on self
|
|
@@ -3031,9 +3048,13 @@ var Watcher = function Watcher (
|
|
|
3031
3048
|
vm,
|
|
3032
3049
|
expOrFn,
|
|
3033
3050
|
cb,
|
|
3034
|
-
options
|
|
3051
|
+
options,
|
|
3052
|
+
isRenderWatcher
|
|
3035
3053
|
) {
|
|
3036
3054
|
this.vm = vm;
|
|
3055
|
+
if (isRenderWatcher) {
|
|
3056
|
+
vm._watcher = this;
|
|
3057
|
+
}
|
|
3037
3058
|
vm._watchers.push(this);
|
|
3038
3059
|
// options
|
|
3039
3060
|
if (options) {
|
|
@@ -3804,19 +3825,9 @@ function bindObjectProps (
|
|
|
3804
3825
|
*/
|
|
3805
3826
|
function renderStatic (
|
|
3806
3827
|
index,
|
|
3807
|
-
isInFor
|
|
3808
|
-
isOnce
|
|
3828
|
+
isInFor
|
|
3809
3829
|
) {
|
|
3810
|
-
|
|
3811
|
-
// information to runtime so be conservative
|
|
3812
|
-
var isOldVersion = arguments.length < 3;
|
|
3813
|
-
// if a static tree is generated by v-once, it is cached on the instance;
|
|
3814
|
-
// otherwise it is purely static and can be cached on the shared options
|
|
3815
|
-
// across all instances.
|
|
3816
|
-
var renderFns = this.$options.staticRenderFns;
|
|
3817
|
-
var cached = isOldVersion || isOnce
|
|
3818
|
-
? (this._staticTrees || (this._staticTrees = []))
|
|
3819
|
-
: (renderFns.cached || (renderFns.cached = []));
|
|
3830
|
+
var cached = this._staticTrees || (this._staticTrees = []);
|
|
3820
3831
|
var tree = cached[index];
|
|
3821
3832
|
// if has already-rendered static tree and not inside v-for,
|
|
3822
3833
|
// we can reuse the same tree by doing a shallow clone.
|
|
@@ -3826,7 +3837,11 @@ function renderStatic (
|
|
|
3826
3837
|
: cloneVNode(tree)
|
|
3827
3838
|
}
|
|
3828
3839
|
// otherwise, render a fresh tree.
|
|
3829
|
-
tree = cached[index] =
|
|
3840
|
+
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
|
3841
|
+
this._renderProxy,
|
|
3842
|
+
null,
|
|
3843
|
+
this // for render fns generated for functional component templates
|
|
3844
|
+
);
|
|
3830
3845
|
markStatic(tree, ("__static__" + index), false);
|
|
3831
3846
|
return tree
|
|
3832
3847
|
}
|
|
@@ -3944,8 +3959,8 @@ function FunctionalRenderContext (
|
|
|
3944
3959
|
this._c = function (a, b, c, d) {
|
|
3945
3960
|
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
|
3946
3961
|
if (vnode) {
|
|
3947
|
-
vnode.
|
|
3948
|
-
vnode.
|
|
3962
|
+
vnode.fnScopeId = options._scopeId;
|
|
3963
|
+
vnode.fnContext = parent;
|
|
3949
3964
|
}
|
|
3950
3965
|
return vnode
|
|
3951
3966
|
};
|
|
@@ -3986,8 +4001,8 @@ function createFunctionalComponent (
|
|
|
3986
4001
|
var vnode = options.render.call(null, renderContext._c, renderContext);
|
|
3987
4002
|
|
|
3988
4003
|
if (vnode instanceof VNode) {
|
|
3989
|
-
vnode.
|
|
3990
|
-
vnode.
|
|
4004
|
+
vnode.fnContext = contextVm;
|
|
4005
|
+
vnode.fnOptions = options;
|
|
3991
4006
|
if (data.slot) {
|
|
3992
4007
|
(vnode.data || (vnode.data = {})).slot = data.slot;
|
|
3993
4008
|
}
|
|
@@ -4178,15 +4193,10 @@ function createComponentInstanceForVnode (
|
|
|
4178
4193
|
parentElm,
|
|
4179
4194
|
refElm
|
|
4180
4195
|
) {
|
|
4181
|
-
var vnodeComponentOptions = vnode.componentOptions;
|
|
4182
4196
|
var options = {
|
|
4183
4197
|
_isComponent: true,
|
|
4184
4198
|
parent: parent,
|
|
4185
|
-
propsData: vnodeComponentOptions.propsData,
|
|
4186
|
-
_componentTag: vnodeComponentOptions.tag,
|
|
4187
4199
|
_parentVnode: vnode,
|
|
4188
|
-
_parentListeners: vnodeComponentOptions.listeners,
|
|
4189
|
-
_renderChildren: vnodeComponentOptions.children,
|
|
4190
4200
|
_parentElm: parentElm || null,
|
|
4191
4201
|
_refElm: refElm || null
|
|
4192
4202
|
};
|
|
@@ -4196,7 +4206,7 @@ function createComponentInstanceForVnode (
|
|
|
4196
4206
|
options.render = inlineTemplate.render;
|
|
4197
4207
|
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
|
4198
4208
|
}
|
|
4199
|
-
return new
|
|
4209
|
+
return new vnode.componentOptions.Ctor(options)
|
|
4200
4210
|
}
|
|
4201
4211
|
|
|
4202
4212
|
function mergeHooks (data) {
|
|
@@ -4530,14 +4540,18 @@ function initMixin (Vue) {
|
|
|
4530
4540
|
function initInternalComponent (vm, options) {
|
|
4531
4541
|
var opts = vm.$options = Object.create(vm.constructor.options);
|
|
4532
4542
|
// doing this because it's faster than dynamic enumeration.
|
|
4543
|
+
var parentVnode = options._parentVnode;
|
|
4533
4544
|
opts.parent = options.parent;
|
|
4534
|
-
opts.
|
|
4535
|
-
opts._parentVnode = options._parentVnode;
|
|
4536
|
-
opts._parentListeners = options._parentListeners;
|
|
4537
|
-
opts._renderChildren = options._renderChildren;
|
|
4538
|
-
opts._componentTag = options._componentTag;
|
|
4545
|
+
opts._parentVnode = parentVnode;
|
|
4539
4546
|
opts._parentElm = options._parentElm;
|
|
4540
4547
|
opts._refElm = options._refElm;
|
|
4548
|
+
|
|
4549
|
+
var vnodeComponentOptions = parentVnode.componentOptions;
|
|
4550
|
+
opts.propsData = vnodeComponentOptions.propsData;
|
|
4551
|
+
opts._parentListeners = vnodeComponentOptions.listeners;
|
|
4552
|
+
opts._renderChildren = vnodeComponentOptions.children;
|
|
4553
|
+
opts._componentTag = vnodeComponentOptions.tag;
|
|
4554
|
+
|
|
4541
4555
|
if (options.render) {
|
|
4542
4556
|
opts.render = options.render;
|
|
4543
4557
|
opts.staticRenderFns = options.staticRenderFns;
|
|
@@ -4671,14 +4685,8 @@ function initExtend (Vue) {
|
|
|
4671
4685
|
}
|
|
4672
4686
|
|
|
4673
4687
|
var name = extendOptions.name || Super.options.name;
|
|
4674
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4675
|
-
|
|
4676
|
-
warn(
|
|
4677
|
-
'Invalid component name: "' + name + '". Component names ' +
|
|
4678
|
-
'can only contain alphanumeric characters and the hyphen, ' +
|
|
4679
|
-
'and must start with a letter.'
|
|
4680
|
-
);
|
|
4681
|
-
}
|
|
4688
|
+
if (process.env.NODE_ENV !== 'production' && name) {
|
|
4689
|
+
validateComponentName(name);
|
|
4682
4690
|
}
|
|
4683
4691
|
|
|
4684
4692
|
var Sub = function VueComponent (options) {
|
|
@@ -4760,13 +4768,8 @@ function initAssetRegisters (Vue) {
|
|
|
4760
4768
|
return this.options[type + 's'][id]
|
|
4761
4769
|
} else {
|
|
4762
4770
|
/* istanbul ignore if */
|
|
4763
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4764
|
-
|
|
4765
|
-
warn(
|
|
4766
|
-
'Do not use built-in or reserved HTML elements as component ' +
|
|
4767
|
-
'id: ' + id
|
|
4768
|
-
);
|
|
4769
|
-
}
|
|
4771
|
+
if (process.env.NODE_ENV !== 'production' && type === 'component') {
|
|
4772
|
+
validateComponentName(id);
|
|
4770
4773
|
}
|
|
4771
4774
|
if (type === 'component' && isPlainObject(definition)) {
|
|
4772
4775
|
definition.name = definition.name || id;
|
|
@@ -4822,7 +4825,7 @@ function pruneCacheEntry (
|
|
|
4822
4825
|
current
|
|
4823
4826
|
) {
|
|
4824
4827
|
var cached$$1 = cache[key];
|
|
4825
|
-
if (cached$$1 && cached$$1 !== current) {
|
|
4828
|
+
if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
|
4826
4829
|
cached$$1.componentInstance.$destroy();
|
|
4827
4830
|
}
|
|
4828
4831
|
cache[key] = null;
|
|
@@ -4870,16 +4873,21 @@ var KeepAlive = {
|
|
|
4870
4873
|
if (componentOptions) {
|
|
4871
4874
|
// check pattern
|
|
4872
4875
|
var name = getComponentName(componentOptions);
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4876
|
+
var ref = this;
|
|
4877
|
+
var include = ref.include;
|
|
4878
|
+
var exclude = ref.exclude;
|
|
4879
|
+
if (
|
|
4880
|
+
// not included
|
|
4881
|
+
(include && (!name || !matches(include, name))) ||
|
|
4882
|
+
// excluded
|
|
4883
|
+
(exclude && name && matches(exclude, name))
|
|
4884
|
+
) {
|
|
4877
4885
|
return vnode
|
|
4878
4886
|
}
|
|
4879
4887
|
|
|
4880
|
-
var ref = this;
|
|
4881
|
-
var cache = ref.cache;
|
|
4882
|
-
var keys = ref.keys;
|
|
4888
|
+
var ref$1 = this;
|
|
4889
|
+
var cache = ref$1.cache;
|
|
4890
|
+
var keys = ref$1.keys;
|
|
4883
4891
|
var key = vnode.key == null
|
|
4884
4892
|
// same constructor may get registered as different local components
|
|
4885
4893
|
// so cid alone is not enough (#3269)
|
|
@@ -4968,7 +4976,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
|
|
|
4968
4976
|
}
|
|
4969
4977
|
});
|
|
4970
4978
|
|
|
4971
|
-
Vue$3.version = '2.5.
|
|
4979
|
+
Vue$3.version = '2.5.10';
|
|
4972
4980
|
|
|
4973
4981
|
/* */
|
|
4974
4982
|
|
|
@@ -5536,6 +5544,9 @@ function createPatchFunction (backend) {
|
|
|
5536
5544
|
|
|
5537
5545
|
function createChildren (vnode, children, insertedVnodeQueue) {
|
|
5538
5546
|
if (Array.isArray(children)) {
|
|
5547
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5548
|
+
checkDuplicateKeys(children);
|
|
5549
|
+
}
|
|
5539
5550
|
for (var i = 0; i < children.length; ++i) {
|
|
5540
5551
|
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
|
|
5541
5552
|
}
|
|
@@ -5567,7 +5578,7 @@ function createPatchFunction (backend) {
|
|
|
5567
5578
|
// of going through the normal attribute patching process.
|
|
5568
5579
|
function setScope (vnode) {
|
|
5569
5580
|
var i;
|
|
5570
|
-
if (isDef(i = vnode.
|
|
5581
|
+
if (isDef(i = vnode.fnScopeId)) {
|
|
5571
5582
|
nodeOps.setAttribute(vnode.elm, i, '');
|
|
5572
5583
|
} else {
|
|
5573
5584
|
var ancestor = vnode;
|
|
@@ -5581,7 +5592,7 @@ function createPatchFunction (backend) {
|
|
|
5581
5592
|
// for slot content they should also get the scopeId from the host instance.
|
|
5582
5593
|
if (isDef(i = activeInstance) &&
|
|
5583
5594
|
i !== vnode.context &&
|
|
5584
|
-
i !== vnode.
|
|
5595
|
+
i !== vnode.fnContext &&
|
|
5585
5596
|
isDef(i = i.$options._scopeId)
|
|
5586
5597
|
) {
|
|
5587
5598
|
nodeOps.setAttribute(vnode.elm, i, '');
|
|
@@ -5667,6 +5678,10 @@ function createPatchFunction (backend) {
|
|
|
5667
5678
|
// during leaving transitions
|
|
5668
5679
|
var canMove = !removeOnly;
|
|
5669
5680
|
|
|
5681
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5682
|
+
checkDuplicateKeys(newCh);
|
|
5683
|
+
}
|
|
5684
|
+
|
|
5670
5685
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
5671
5686
|
if (isUndef(oldStartVnode)) {
|
|
5672
5687
|
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
|
|
@@ -5699,13 +5714,6 @@ function createPatchFunction (backend) {
|
|
|
5699
5714
|
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
|
|
5700
5715
|
} else {
|
|
5701
5716
|
vnodeToMove = oldCh[idxInOld];
|
|
5702
|
-
/* istanbul ignore if */
|
|
5703
|
-
if (process.env.NODE_ENV !== 'production' && !vnodeToMove) {
|
|
5704
|
-
warn(
|
|
5705
|
-
'It seems there are duplicate keys that is causing an update error. ' +
|
|
5706
|
-
'Make sure each v-for item has a unique key.'
|
|
5707
|
-
);
|
|
5708
|
-
}
|
|
5709
5717
|
if (sameVnode(vnodeToMove, newStartVnode)) {
|
|
5710
5718
|
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
|
|
5711
5719
|
oldCh[idxInOld] = undefined;
|
|
@@ -5726,6 +5734,24 @@ function createPatchFunction (backend) {
|
|
|
5726
5734
|
}
|
|
5727
5735
|
}
|
|
5728
5736
|
|
|
5737
|
+
function checkDuplicateKeys (children) {
|
|
5738
|
+
var seenKeys = {};
|
|
5739
|
+
for (var i = 0; i < children.length; i++) {
|
|
5740
|
+
var vnode = children[i];
|
|
5741
|
+
var key = vnode.key;
|
|
5742
|
+
if (isDef(key)) {
|
|
5743
|
+
if (seenKeys[key]) {
|
|
5744
|
+
warn(
|
|
5745
|
+
("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
|
5746
|
+
vnode.context
|
|
5747
|
+
);
|
|
5748
|
+
} else {
|
|
5749
|
+
seenKeys[key] = true;
|
|
5750
|
+
}
|
|
5751
|
+
}
|
|
5752
|
+
}
|
|
5753
|
+
}
|
|
5754
|
+
|
|
5729
5755
|
function findIdxInOld (node, oldCh, start, end) {
|
|
5730
5756
|
for (var i = start; i < end; i++) {
|
|
5731
5757
|
var c = oldCh[i];
|
|
@@ -6171,7 +6197,7 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6171
6197
|
// #4391: in IE9, setting type can reset value for input[type=radio]
|
|
6172
6198
|
// #6666: IE/Edge forces progress value down to 1 before setting a max
|
|
6173
6199
|
/* istanbul ignore if */
|
|
6174
|
-
if ((
|
|
6200
|
+
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
|
6175
6201
|
setAttr(elm, 'value', attrs.value);
|
|
6176
6202
|
}
|
|
6177
6203
|
for (key in oldAttrs) {
|
|
@@ -6211,6 +6237,23 @@ function setAttr (el, key, value) {
|
|
|
6211
6237
|
if (isFalsyAttrValue(value)) {
|
|
6212
6238
|
el.removeAttribute(key);
|
|
6213
6239
|
} else {
|
|
6240
|
+
// #7138: IE10 & 11 fires input event when setting placeholder on
|
|
6241
|
+
// <textarea>... block the first input event and remove the blocker
|
|
6242
|
+
// immediately.
|
|
6243
|
+
/* istanbul ignore if */
|
|
6244
|
+
if (
|
|
6245
|
+
isIE && !isIE9 &&
|
|
6246
|
+
el.tagName === 'TEXTAREA' &&
|
|
6247
|
+
key === 'placeholder' && !el.__ieph
|
|
6248
|
+
) {
|
|
6249
|
+
var blocker = function (e) {
|
|
6250
|
+
e.stopImmediatePropagation();
|
|
6251
|
+
el.removeEventListener('input', blocker);
|
|
6252
|
+
};
|
|
6253
|
+
el.addEventListener('input', blocker);
|
|
6254
|
+
// $flow-disable-line
|
|
6255
|
+
el.__ieph = true; /* IE placeholder patched */
|
|
6256
|
+
}
|
|
6214
6257
|
el.setAttribute(key, value);
|
|
6215
6258
|
}
|
|
6216
6259
|
}
|
|
@@ -6965,12 +7008,12 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
6965
7008
|
function shouldUpdateValue (elm, checkVal) {
|
|
6966
7009
|
return (!elm.composing && (
|
|
6967
7010
|
elm.tagName === 'OPTION' ||
|
|
6968
|
-
|
|
6969
|
-
|
|
7011
|
+
isNotInFocusAndDirty(elm, checkVal) ||
|
|
7012
|
+
isDirtyWithModifiers(elm, checkVal)
|
|
6970
7013
|
))
|
|
6971
7014
|
}
|
|
6972
7015
|
|
|
6973
|
-
function
|
|
7016
|
+
function isNotInFocusAndDirty (elm, checkVal) {
|
|
6974
7017
|
// return true when textbox (.number and .trim) loses focus and its value is
|
|
6975
7018
|
// not equal to the updated value
|
|
6976
7019
|
var notInFocus = true;
|
|
@@ -6980,14 +7023,20 @@ function isDirty (elm, checkVal) {
|
|
|
6980
7023
|
return notInFocus && elm.value !== checkVal
|
|
6981
7024
|
}
|
|
6982
7025
|
|
|
6983
|
-
function
|
|
7026
|
+
function isDirtyWithModifiers (elm, newVal) {
|
|
6984
7027
|
var value = elm.value;
|
|
6985
7028
|
var modifiers = elm._vModifiers; // injected by v-model runtime
|
|
6986
|
-
if (isDef(modifiers)
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
7029
|
+
if (isDef(modifiers)) {
|
|
7030
|
+
if (modifiers.lazy) {
|
|
7031
|
+
// inputs with lazy should only be updated when not in focus
|
|
7032
|
+
return false
|
|
7033
|
+
}
|
|
7034
|
+
if (modifiers.number) {
|
|
7035
|
+
return toNumber(value) !== toNumber(newVal)
|
|
7036
|
+
}
|
|
7037
|
+
if (modifiers.trim) {
|
|
7038
|
+
return value.trim() !== newVal.trim()
|
|
7039
|
+
}
|
|
6991
7040
|
}
|
|
6992
7041
|
return value !== newVal
|
|
6993
7042
|
}
|
|
@@ -8825,7 +8874,8 @@ function parseHTML (html, options) {
|
|
|
8825
8874
|
var onRE = /^@|^v-on:/;
|
|
8826
8875
|
var dirRE = /^v-|^@|^:/;
|
|
8827
8876
|
var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
|
|
8828
|
-
var forIteratorRE =
|
|
8877
|
+
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
8878
|
+
var stripParensRE = /^\(|\)$/g;
|
|
8829
8879
|
|
|
8830
8880
|
var argRE = /:(.*)$/;
|
|
8831
8881
|
var bindRE = /^:|^v-bind:/;
|
|
@@ -9157,13 +9207,13 @@ function processFor (el) {
|
|
|
9157
9207
|
return
|
|
9158
9208
|
}
|
|
9159
9209
|
el.for = inMatch[2].trim();
|
|
9160
|
-
var alias = inMatch[1].trim();
|
|
9210
|
+
var alias = inMatch[1].trim().replace(stripParensRE, '');
|
|
9161
9211
|
var iteratorMatch = alias.match(forIteratorRE);
|
|
9162
9212
|
if (iteratorMatch) {
|
|
9163
|
-
el.alias =
|
|
9164
|
-
el.iterator1 = iteratorMatch[
|
|
9165
|
-
if (iteratorMatch[
|
|
9166
|
-
el.iterator2 = iteratorMatch[
|
|
9213
|
+
el.alias = alias.replace(forIteratorRE, '');
|
|
9214
|
+
el.iterator1 = iteratorMatch[1].trim();
|
|
9215
|
+
if (iteratorMatch[2]) {
|
|
9216
|
+
el.iterator2 = iteratorMatch[2].trim();
|
|
9167
9217
|
}
|
|
9168
9218
|
} else {
|
|
9169
9219
|
el.alias = alias;
|
|
@@ -9262,6 +9312,15 @@ function processSlot (el) {
|
|
|
9262
9312
|
}
|
|
9263
9313
|
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
|
9264
9314
|
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
|
9315
|
+
/* istanbul ignore if */
|
|
9316
|
+
if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
|
|
9317
|
+
warn$2(
|
|
9318
|
+
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
|
9319
|
+
"(v-for takes higher priority). Use a wrapper <template> for the " +
|
|
9320
|
+
"scoped slot to make it clearer.",
|
|
9321
|
+
true
|
|
9322
|
+
);
|
|
9323
|
+
}
|
|
9265
9324
|
el.slotScope = slotScope;
|
|
9266
9325
|
}
|
|
9267
9326
|
var slotTarget = getBindingAttr(el, 'slot');
|
|
@@ -9906,10 +9965,10 @@ function genElement (el, state) {
|
|
|
9906
9965
|
}
|
|
9907
9966
|
|
|
9908
9967
|
// hoist static sub-trees out
|
|
9909
|
-
function genStatic (el, state
|
|
9968
|
+
function genStatic (el, state) {
|
|
9910
9969
|
el.staticProcessed = true;
|
|
9911
9970
|
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
|
9912
|
-
return ("_m(" + (state.staticRenderFns.length - 1) +
|
|
9971
|
+
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
|
9913
9972
|
}
|
|
9914
9973
|
|
|
9915
9974
|
// v-once
|
|
@@ -9935,7 +9994,7 @@ function genOnce (el, state) {
|
|
|
9935
9994
|
}
|
|
9936
9995
|
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
|
9937
9996
|
} else {
|
|
9938
|
-
return genStatic(el, state
|
|
9997
|
+
return genStatic(el, state)
|
|
9939
9998
|
}
|
|
9940
9999
|
}
|
|
9941
10000
|
|
|
@@ -10302,9 +10361,6 @@ var unaryOperatorsRE = new RegExp('\\b' + (
|
|
|
10302
10361
|
'delete,typeof,void'
|
|
10303
10362
|
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
|
10304
10363
|
|
|
10305
|
-
// check valid identifier for v-for
|
|
10306
|
-
var identRE = /[A-Za-z_$][\w$]*/;
|
|
10307
|
-
|
|
10308
10364
|
// strip strings in expressions
|
|
10309
10365
|
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
|
10310
10366
|
|
|
@@ -10362,9 +10418,18 @@ function checkFor (node, text, errors) {
|
|
|
10362
10418
|
checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
|
|
10363
10419
|
}
|
|
10364
10420
|
|
|
10365
|
-
function checkIdentifier (
|
|
10366
|
-
|
|
10367
|
-
|
|
10421
|
+
function checkIdentifier (
|
|
10422
|
+
ident,
|
|
10423
|
+
type,
|
|
10424
|
+
text,
|
|
10425
|
+
errors
|
|
10426
|
+
) {
|
|
10427
|
+
if (typeof ident === 'string') {
|
|
10428
|
+
try {
|
|
10429
|
+
new Function(("var " + ident + "=_"));
|
|
10430
|
+
} catch (e) {
|
|
10431
|
+
errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
|
|
10432
|
+
}
|
|
10368
10433
|
}
|
|
10369
10434
|
}
|
|
10370
10435
|
|