Skip to content

Commit 711aaf7

Browse files
committed
build: build 2.5.10
1 parent 8936b8d commit 711aaf7

File tree

14 files changed

+676
-572
lines changed

14 files changed

+676
-572
lines changed

dist/vue.common.js

Lines changed: 95 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v2.5.9
2+
* Vue.js v2.5.10
33
* (c) 2014-2017 Evan You
44
* Released under the MIT License.
55
*/
@@ -1149,18 +1149,18 @@ function mergeDataOrFn (
11491149
// it has to be a function to pass previous merges.
11501150
return function mergedDataFn () {
11511151
return mergeData(
1152-
typeof childVal === 'function' ? childVal.call(this) : childVal,
1153-
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
11541154
)
11551155
}
11561156
} else {
11571157
return function mergedInstanceDataFn () {
11581158
// instance merge
11591159
var instanceData = typeof childVal === 'function'
1160-
? childVal.call(vm)
1160+
? childVal.call(vm, vm)
11611161
: childVal;
11621162
var defaultData = typeof parentVal === 'function'
1163-
? parentVal.call(vm)
1163+
? parentVal.call(vm, vm)
11641164
: parentVal;
11651165
if (instanceData) {
11661166
return mergeData(instanceData, defaultData)
@@ -1312,13 +1312,24 @@ var defaultStrat = function (parentVal, childVal) {
13121312
*/
13131313
function checkComponents (options) {
13141314
for (var key in options.components) {
1315-
var lower = key.toLowerCase();
1316-
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
1317-
warn(
1318-
'Do not use built-in or reserved HTML elements as component ' +
1319-
'id: ' + key
1320-
);
1321-
}
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+
);
13221333
}
13231334
}
13241335

@@ -3814,19 +3825,9 @@ function bindObjectProps (
38143825
*/
38153826
function renderStatic (
38163827
index,
3817-
isInFor,
3818-
isOnce
3828+
isInFor
38193829
) {
3820-
// render fns generated by compiler < 2.5.4 does not provide v-once
3821-
// information to runtime so be conservative
3822-
var isOldVersion = arguments.length < 3;
3823-
// if a static tree is generated by v-once, it is cached on the instance;
3824-
// otherwise it is purely static and can be cached on the shared options
3825-
// across all instances.
3826-
var renderFns = this.$options.staticRenderFns;
3827-
var cached = isOldVersion || isOnce
3828-
? (this._staticTrees || (this._staticTrees = []))
3829-
: (renderFns.cached || (renderFns.cached = []));
3830+
var cached = this._staticTrees || (this._staticTrees = []);
38303831
var tree = cached[index];
38313832
// if has already-rendered static tree and not inside v-for,
38323833
// we can reuse the same tree by doing a shallow clone.
@@ -3836,7 +3837,11 @@ function renderStatic (
38363837
: cloneVNode(tree)
38373838
}
38383839
// otherwise, render a fresh tree.
3839-
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
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+
);
38403845
markStatic(tree, ("__static__" + index), false);
38413846
return tree
38423847
}
@@ -4188,15 +4193,10 @@ function createComponentInstanceForVnode (
41884193
parentElm,
41894194
refElm
41904195
) {
4191-
var vnodeComponentOptions = vnode.componentOptions;
41924196
var options = {
41934197
_isComponent: true,
41944198
parent: parent,
4195-
propsData: vnodeComponentOptions.propsData,
4196-
_componentTag: vnodeComponentOptions.tag,
41974199
_parentVnode: vnode,
4198-
_parentListeners: vnodeComponentOptions.listeners,
4199-
_renderChildren: vnodeComponentOptions.children,
42004200
_parentElm: parentElm || null,
42014201
_refElm: refElm || null
42024202
};
@@ -4206,7 +4206,7 @@ function createComponentInstanceForVnode (
42064206
options.render = inlineTemplate.render;
42074207
options.staticRenderFns = inlineTemplate.staticRenderFns;
42084208
}
4209-
return new vnodeComponentOptions.Ctor(options)
4209+
return new vnode.componentOptions.Ctor(options)
42104210
}
42114211

42124212
function mergeHooks (data) {
@@ -4540,14 +4540,18 @@ function initMixin (Vue) {
45404540
function initInternalComponent (vm, options) {
45414541
var opts = vm.$options = Object.create(vm.constructor.options);
45424542
// doing this because it's faster than dynamic enumeration.
4543+
var parentVnode = options._parentVnode;
45434544
opts.parent = options.parent;
4544-
opts.propsData = options.propsData;
4545-
opts._parentVnode = options._parentVnode;
4546-
opts._parentListeners = options._parentListeners;
4547-
opts._renderChildren = options._renderChildren;
4548-
opts._componentTag = options._componentTag;
4545+
opts._parentVnode = parentVnode;
45494546
opts._parentElm = options._parentElm;
45504547
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+
45514555
if (options.render) {
45524556
opts.render = options.render;
45534557
opts.staticRenderFns = options.staticRenderFns;
@@ -4681,14 +4685,8 @@ function initExtend (Vue) {
46814685
}
46824686

46834687
var name = extendOptions.name || Super.options.name;
4684-
if (process.env.NODE_ENV !== 'production') {
4685-
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
4686-
warn(
4687-
'Invalid component name: "' + name + '". Component names ' +
4688-
'can only contain alphanumeric characters and the hyphen, ' +
4689-
'and must start with a letter.'
4690-
);
4691-
}
4688+
if (process.env.NODE_ENV !== 'production' && name) {
4689+
validateComponentName(name);
46924690
}
46934691

46944692
var Sub = function VueComponent (options) {
@@ -4770,13 +4768,8 @@ function initAssetRegisters (Vue) {
47704768
return this.options[type + 's'][id]
47714769
} else {
47724770
/* istanbul ignore if */
4773-
if (process.env.NODE_ENV !== 'production') {
4774-
if (type === 'component' && config.isReservedTag(id)) {
4775-
warn(
4776-
'Do not use built-in or reserved HTML elements as component ' +
4777-
'id: ' + id
4778-
);
4779-
}
4771+
if (process.env.NODE_ENV !== 'production' && type === 'component') {
4772+
validateComponentName(id);
47804773
}
47814774
if (type === 'component' && isPlainObject(definition)) {
47824775
definition.name = definition.name || id;
@@ -4983,7 +4976,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
49834976
}
49844977
});
49854978

4986-
Vue$3.version = '2.5.9';
4979+
Vue$3.version = '2.5.10';
49874980

49884981
/* */
49894982

@@ -5551,6 +5544,9 @@ function createPatchFunction (backend) {
55515544

55525545
function createChildren (vnode, children, insertedVnodeQueue) {
55535546
if (Array.isArray(children)) {
5547+
if (process.env.NODE_ENV !== 'production') {
5548+
checkDuplicateKeys(children);
5549+
}
55545550
for (var i = 0; i < children.length; ++i) {
55555551
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
55565552
}
@@ -5682,6 +5678,10 @@ function createPatchFunction (backend) {
56825678
// during leaving transitions
56835679
var canMove = !removeOnly;
56845680

5681+
if (process.env.NODE_ENV !== 'production') {
5682+
checkDuplicateKeys(newCh);
5683+
}
5684+
56855685
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
56865686
if (isUndef(oldStartVnode)) {
56875687
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
@@ -5714,13 +5714,6 @@ function createPatchFunction (backend) {
57145714
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
57155715
} else {
57165716
vnodeToMove = oldCh[idxInOld];
5717-
/* istanbul ignore if */
5718-
if (process.env.NODE_ENV !== 'production' && !vnodeToMove) {
5719-
warn(
5720-
'It seems there are duplicate keys that is causing an update error. ' +
5721-
'Make sure each v-for item has a unique key.'
5722-
);
5723-
}
57245717
if (sameVnode(vnodeToMove, newStartVnode)) {
57255718
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
57265719
oldCh[idxInOld] = undefined;
@@ -5741,6 +5734,24 @@ function createPatchFunction (backend) {
57415734
}
57425735
}
57435736

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+
57445755
function findIdxInOld (node, oldCh, start, end) {
57455756
for (var i = start; i < end; i++) {
57465757
var c = oldCh[i];
@@ -6997,12 +7008,12 @@ function updateDOMProps (oldVnode, vnode) {
69977008
function shouldUpdateValue (elm, checkVal) {
69987009
return (!elm.composing && (
69997010
elm.tagName === 'OPTION' ||
7000-
isDirty(elm, checkVal) ||
7001-
isInputChanged(elm, checkVal)
7011+
isNotInFocusAndDirty(elm, checkVal) ||
7012+
isDirtyWithModifiers(elm, checkVal)
70027013
))
70037014
}
70047015

7005-
function isDirty (elm, checkVal) {
7016+
function isNotInFocusAndDirty (elm, checkVal) {
70067017
// return true when textbox (.number and .trim) loses focus and its value is
70077018
// not equal to the updated value
70087019
var notInFocus = true;
@@ -7012,14 +7023,20 @@ function isDirty (elm, checkVal) {
70127023
return notInFocus && elm.value !== checkVal
70137024
}
70147025

7015-
function isInputChanged (elm, newVal) {
7026+
function isDirtyWithModifiers (elm, newVal) {
70167027
var value = elm.value;
70177028
var modifiers = elm._vModifiers; // injected by v-model runtime
7018-
if (isDef(modifiers) && modifiers.number) {
7019-
return toNumber(value) !== toNumber(newVal)
7020-
}
7021-
if (isDef(modifiers) && modifiers.trim) {
7022-
return value.trim() !== newVal.trim()
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+
}
70237040
}
70247041
return value !== newVal
70257042
}
@@ -8857,7 +8874,7 @@ function parseHTML (html, options) {
88578874
var onRE = /^@|^v-on:/;
88588875
var dirRE = /^v-|^@|^:/;
88598876
var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
8860-
var forIteratorRE = /\((\{[^}]*\}|[^,{]*),([^,]*)(?:,([^,]*))?\)/;
8877+
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
88618878
var stripParensRE = /^\(|\)$/g;
88628879

88638880
var argRE = /:(.*)$/;
@@ -9190,16 +9207,16 @@ function processFor (el) {
91909207
return
91919208
}
91929209
el.for = inMatch[2].trim();
9193-
var alias = inMatch[1].trim();
9210+
var alias = inMatch[1].trim().replace(stripParensRE, '');
91949211
var iteratorMatch = alias.match(forIteratorRE);
91959212
if (iteratorMatch) {
9196-
el.alias = iteratorMatch[1].trim();
9197-
el.iterator1 = iteratorMatch[2].trim();
9198-
if (iteratorMatch[3]) {
9199-
el.iterator2 = iteratorMatch[3].trim();
9213+
el.alias = alias.replace(forIteratorRE, '');
9214+
el.iterator1 = iteratorMatch[1].trim();
9215+
if (iteratorMatch[2]) {
9216+
el.iterator2 = iteratorMatch[2].trim();
92009217
}
92019218
} else {
9202-
el.alias = alias.replace(stripParensRE, '');
9219+
el.alias = alias;
92039220
}
92049221
}
92059222
}
@@ -9948,10 +9965,10 @@ function genElement (el, state) {
99489965
}
99499966

99509967
// hoist static sub-trees out
9951-
function genStatic (el, state, once$$1) {
9968+
function genStatic (el, state) {
99529969
el.staticProcessed = true;
99539970
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
9954-
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
9971+
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
99559972
}
99569973

99579974
// v-once
@@ -9977,7 +9994,7 @@ function genOnce (el, state) {
99779994
}
99789995
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
99799996
} else {
9980-
return genStatic(el, state, true)
9997+
return genStatic(el, state)
99819998
}
99829999
}
998310000

0 commit comments

Comments
 (0)