Skip to content

Commit fd68195

Browse files
committed
build: build 2.4.2
1 parent f104b84 commit fd68195

File tree

13 files changed

+464
-325
lines changed

13 files changed

+464
-325
lines changed

Diff for: dist/vue.common.js

+72-51
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v2.4.1
2+
* Vue.js v2.4.2
33
* (c) 2014-2017 Evan You
44
* Released under the MIT License.
55
*/
@@ -29,7 +29,11 @@ function isFalse (v) {
2929
* Check if value is primitive
3030
*/
3131
function isPrimitive (value) {
32-
return typeof value === 'string' || typeof value === 'number'
32+
return (
33+
typeof value === 'string' ||
34+
typeof value === 'number' ||
35+
typeof value === 'boolean'
36+
)
3337
}
3438

3539
/**
@@ -252,14 +256,30 @@ function genStaticKeys (modules) {
252256
* if they are plain objects, do they have the same shape?
253257
*/
254258
function looseEqual (a, b) {
259+
if (a === b) { return true }
255260
var isObjectA = isObject(a);
256261
var isObjectB = isObject(b);
257262
if (isObjectA && isObjectB) {
258263
try {
259-
return JSON.stringify(a) === JSON.stringify(b)
264+
var isArrayA = Array.isArray(a);
265+
var isArrayB = Array.isArray(b);
266+
if (isArrayA && isArrayB) {
267+
return a.length === b.length && a.every(function (e, i) {
268+
return looseEqual(e, b[i])
269+
})
270+
} else if (!isArrayA && !isArrayB) {
271+
var keysA = Object.keys(a);
272+
var keysB = Object.keys(b);
273+
return keysA.length === keysB.length && keysA.every(function (key) {
274+
return looseEqual(a[key], b[key])
275+
})
276+
} else {
277+
/* istanbul ignore next */
278+
return false
279+
}
260280
} catch (e) {
261-
// possible circular reference
262-
return a === b
281+
/* istanbul ignore next */
282+
return false
263283
}
264284
} else if (!isObjectA && !isObjectB) {
265285
return String(a) === String(b)
@@ -1124,7 +1144,7 @@ function mergeDataOrFn (
11241144
return function mergedDataFn () {
11251145
return mergeData(
11261146
typeof childVal === 'function' ? childVal.call(this) : childVal,
1127-
parentVal.call(this)
1147+
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
11281148
)
11291149
}
11301150
} else if (parentVal || childVal) {
@@ -1240,11 +1260,10 @@ strats.props =
12401260
strats.methods =
12411261
strats.inject =
12421262
strats.computed = function (parentVal, childVal) {
1243-
if (!childVal) { return Object.create(parentVal || null) }
12441263
if (!parentVal) { return childVal }
12451264
var ret = Object.create(null);
12461265
extend(ret, parentVal);
1247-
extend(ret, childVal);
1266+
if (childVal) { extend(ret, childVal); }
12481267
return ret
12491268
};
12501269
strats.provide = mergeDataOrFn;
@@ -3190,17 +3209,14 @@ function initComputed (vm, computed) {
31903209
for (var key in computed) {
31913210
var userDef = computed[key];
31923211
var getter = typeof userDef === 'function' ? userDef : userDef.get;
3193-
if (process.env.NODE_ENV !== 'production') {
3194-
if (getter === undefined) {
3195-
warn(
3196-
("No getter function has been defined for computed property \"" + key + "\"."),
3197-
vm
3198-
);
3199-
getter = noop;
3200-
}
3212+
if (process.env.NODE_ENV !== 'production' && getter == null) {
3213+
warn(
3214+
("Getter is missing for computed property \"" + key + "\"."),
3215+
vm
3216+
);
32013217
}
32023218
// create internal watcher for the computed property.
3203-
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
3219+
watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
32043220

32053221
// component-defined computed properties are already defined on the
32063222
// component prototype. We only need to define computed properties defined
@@ -3231,6 +3247,15 @@ function defineComputed (target, key, userDef) {
32313247
? userDef.set
32323248
: noop;
32333249
}
3250+
if (process.env.NODE_ENV !== 'production' &&
3251+
sharedPropertyDefinition.set === noop) {
3252+
sharedPropertyDefinition.set = function () {
3253+
warn(
3254+
("Computed property \"" + key + "\" was assigned to but it has no setter."),
3255+
this
3256+
);
3257+
};
3258+
}
32343259
Object.defineProperty(target, key, sharedPropertyDefinition);
32353260
}
32363261

@@ -3402,7 +3427,7 @@ function resolveInject (inject, vm) {
34023427
}
34033428
source = source.$parent;
34043429
}
3405-
if (process.env.NODE_ENV !== 'production' && !hasOwn(result, key)) {
3430+
if (process.env.NODE_ENV !== 'production' && !source) {
34063431
warn(("Injection \"" + key + "\" not found"), vm);
34073432
}
34083433
}
@@ -3595,8 +3620,12 @@ function createComponent (
35953620
return createFunctionalComponent(Ctor, propsData, data, context, children)
35963621
}
35973622

3598-
// keep listeners
3623+
// extract listeners, since these needs to be treated as
3624+
// child component listeners instead of DOM listeners
35993625
var listeners = data.on;
3626+
// replace with listeners with .native modifier
3627+
// so it gets processed during parent component patch.
3628+
data.on = data.nativeOn;
36003629

36013630
if (isTrue(Ctor.options.abstract)) {
36023631
// abstract components do not keep anything
@@ -4059,12 +4088,12 @@ function initRender (vm) {
40594088
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
40604089
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
40614090
}, true);
4062-
defineReactive$$1(vm, '$listeners', parentData && parentData.on, function () {
4091+
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
40634092
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
40644093
}, true);
40654094
} else {
40664095
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
4067-
defineReactive$$1(vm, '$listeners', parentData && parentData.on, null, true);
4096+
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
40684097
}
40694098
}
40704099

@@ -4628,7 +4657,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
46284657
}
46294658
});
46304659

4631-
Vue$3.version = '2.4.1';
4660+
Vue$3.version = '2.4.2';
46324661

46334662
/* */
46344663

@@ -6288,7 +6317,7 @@ function genCheckboxModel (
62886317
'if(Array.isArray($$a)){' +
62896318
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
62906319
'$$i=_i($$a,$$v);' +
6291-
"if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
6320+
"if($$el.checked){$$i<0&&(" + value + "=$$a.concat($$v))}" +
62926321
"else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
62936322
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
62946323
null, true
@@ -6424,14 +6453,11 @@ function remove$2 (
64246453
}
64256454

64266455
function updateDOMListeners (oldVnode, vnode) {
6427-
var isComponentRoot = isDef(vnode.componentOptions);
6428-
var oldOn = isComponentRoot ? oldVnode.data.nativeOn : oldVnode.data.on;
6429-
var on = isComponentRoot ? vnode.data.nativeOn : vnode.data.on;
6430-
if (isUndef(oldOn) && isUndef(on)) {
6456+
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
64316457
return
64326458
}
6433-
on = on || {};
6434-
oldOn = oldOn || {};
6459+
var on = vnode.data.on || {};
6460+
var oldOn = oldVnode.data.on || {};
64356461
target$1 = vnode.elm;
64366462
normalizeEvents(on);
64376463
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
@@ -6505,7 +6531,11 @@ function shouldUpdateValue (
65056531
function isDirty (elm, checkVal) {
65066532
// return true when textbox (.number and .trim) loses focus and its value is
65076533
// not equal to the updated value
6508-
return document.activeElement !== elm && elm.value !== checkVal
6534+
var notInFocus = true;
6535+
// #6157
6536+
// work around IE bug when accessing document.activeElement in an iframe
6537+
try { notInFocus = document.activeElement !== elm; } catch (e) {}
6538+
return notInFocus && elm.value !== checkVal
65096539
}
65106540

65116541
function isInputChanged (elm, newVal) {
@@ -7285,6 +7315,7 @@ var model$1 = {
72857315
if (isIE || isEdge) {
72867316
setTimeout(cb, 0);
72877317
}
7318+
el._vOptions = [].map.call(el.options, getValue);
72887319
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
72897320
el._vModifiers = binding.modifiers;
72907321
if (!binding.modifiers.lazy) {
@@ -7311,10 +7342,9 @@ var model$1 = {
73117342
// it's possible that the value is out-of-sync with the rendered options.
73127343
// detect such cases and filter out values that no longer has a matching
73137344
// option in the DOM.
7314-
var needReset = el.multiple
7315-
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
7316-
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
7317-
if (needReset) {
7345+
var prevOptions = el._vOptions;
7346+
var curOptions = el._vOptions = [].map.call(el.options, getValue);
7347+
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
73187348
trigger(el, 'change');
73197349
}
73207350
}
@@ -7354,15 +7384,6 @@ function setSelected (el, binding, vm) {
73547384
}
73557385
}
73567386

7357-
function hasNoMatchingOption (value, options) {
7358-
for (var i = 0, l = options.length; i < l; i++) {
7359-
if (looseEqual(getValue(options[i]), value)) {
7360-
return false
7361-
}
7362-
}
7363-
return true
7364-
}
7365-
73667387
function getValue (option) {
73677388
return '_value' in option
73687389
? option._value
@@ -7403,7 +7424,7 @@ var show = {
74037424
var transition$$1 = vnode.data && vnode.data.transition;
74047425
var originalDisplay = el.__vOriginalDisplay =
74057426
el.style.display === 'none' ? '' : el.style.display;
7406-
if (value && transition$$1 && !isIE9) {
7427+
if (value && transition$$1) {
74077428
vnode.data.show = true;
74087429
enter(vnode, function () {
74097430
el.style.display = originalDisplay;
@@ -7421,7 +7442,7 @@ var show = {
74217442
if (value === oldValue) { return }
74227443
vnode = locateNode(vnode);
74237444
var transition$$1 = vnode.data && vnode.data.transition;
7424-
if (transition$$1 && !isIE9) {
7445+
if (transition$$1) {
74257446
vnode.data.show = true;
74267447
if (value) {
74277448
enter(vnode, function () {
@@ -8162,9 +8183,6 @@ function parseHTML (html, options) {
81628183
last = html;
81638184
// Make sure we're not in a plaintext content element like script/style
81648185
if (!lastTag || !isPlainTextElement(lastTag)) {
8165-
if (shouldIgnoreFirstNewline(lastTag, html)) {
8166-
advance(1);
8167-
}
81688186
var textEnd = html.indexOf('<');
81698187
if (textEnd === 0) {
81708188
// Comment:
@@ -8210,6 +8228,9 @@ function parseHTML (html, options) {
82108228
var startTagMatch = parseStartTag();
82118229
if (startTagMatch) {
82128230
handleStartTag(startTagMatch);
8231+
if (shouldIgnoreFirstNewline(lastTag, html)) {
8232+
advance(1);
8233+
}
82138234
continue
82148235
}
82158236
}
@@ -8870,8 +8891,8 @@ function processAttrs (el) {
88708891
);
88718892
}
88728893
}
8873-
if (!el.component && (
8874-
isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)
8894+
if (isProp || (
8895+
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
88758896
)) {
88768897
addProp(el, name, value);
88778898
} else {
@@ -9657,7 +9678,7 @@ function genText (text) {
96579678
}
96589679

96599680
function genComment (comment) {
9660-
return ("_e('" + (comment.text) + "')")
9681+
return ("_e(" + (JSON.stringify(comment.text)) + ")")
96619682
}
96629683

96639684
function genSlot (el, state) {

0 commit comments

Comments
 (0)