Skip to content

Commit

Permalink
build: build 2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 21, 2017
1 parent f104b84 commit fd68195
Show file tree
Hide file tree
Showing 13 changed files with 464 additions and 325 deletions.
123 changes: 72 additions & 51 deletions dist/vue.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Vue.js v2.4.1
* Vue.js v2.4.2
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
Expand Down Expand Up @@ -29,7 +29,11 @@ function isFalse (v) {
* Check if value is primitive
*/
function isPrimitive (value) {
return typeof value === 'string' || typeof value === 'number'
return (
typeof value === 'string' ||
typeof value === 'number' ||
typeof value === 'boolean'
)
}

/**
Expand Down Expand Up @@ -252,14 +256,30 @@ function genStaticKeys (modules) {
* if they are plain objects, do they have the same shape?
*/
function looseEqual (a, b) {
if (a === b) { return true }
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
return JSON.stringify(a) === JSON.stringify(b)
var isArrayA = Array.isArray(a);
var isArrayB = Array.isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.every(function (e, i) {
return looseEqual(e, b[i])
})
} else if (!isArrayA && !isArrayB) {
var keysA = Object.keys(a);
var keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every(function (key) {
return looseEqual(a[key], b[key])
})
} else {
/* istanbul ignore next */
return false
}
} catch (e) {
// possible circular reference
return a === b
/* istanbul ignore next */
return false
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b)
Expand Down Expand Up @@ -1124,7 +1144,7 @@ function mergeDataOrFn (
return function mergedDataFn () {
return mergeData(
typeof childVal === 'function' ? childVal.call(this) : childVal,
parentVal.call(this)
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
)
}
} else if (parentVal || childVal) {
Expand Down Expand Up @@ -1240,11 +1260,10 @@ strats.props =
strats.methods =
strats.inject =
strats.computed = function (parentVal, childVal) {
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = Object.create(null);
extend(ret, parentVal);
extend(ret, childVal);
if (childVal) { extend(ret, childVal); }
return ret
};
strats.provide = mergeDataOrFn;
Expand Down Expand Up @@ -3190,17 +3209,14 @@ function initComputed (vm, computed) {
for (var key in computed) {
var userDef = computed[key];
var getter = typeof userDef === 'function' ? userDef : userDef.get;
if (process.env.NODE_ENV !== 'production') {
if (getter === undefined) {
warn(
("No getter function has been defined for computed property \"" + key + "\"."),
vm
);
getter = noop;
}
if (process.env.NODE_ENV !== 'production' && getter == null) {
warn(
("Getter is missing for computed property \"" + key + "\"."),
vm
);
}
// create internal watcher for the computed property.
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);

// component-defined computed properties are already defined on the
// component prototype. We only need to define computed properties defined
Expand Down Expand Up @@ -3231,6 +3247,15 @@ function defineComputed (target, key, userDef) {
? userDef.set
: noop;
}
if (process.env.NODE_ENV !== 'production' &&
sharedPropertyDefinition.set === noop) {
sharedPropertyDefinition.set = function () {
warn(
("Computed property \"" + key + "\" was assigned to but it has no setter."),
this
);
};
}
Object.defineProperty(target, key, sharedPropertyDefinition);
}

Expand Down Expand Up @@ -3402,7 +3427,7 @@ function resolveInject (inject, vm) {
}
source = source.$parent;
}
if (process.env.NODE_ENV !== 'production' && !hasOwn(result, key)) {
if (process.env.NODE_ENV !== 'production' && !source) {
warn(("Injection \"" + key + "\" not found"), vm);
}
}
Expand Down Expand Up @@ -3595,8 +3620,12 @@ function createComponent (
return createFunctionalComponent(Ctor, propsData, data, context, children)
}

// keep listeners
// extract listeners, since these needs to be treated as
// child component listeners instead of DOM listeners
var listeners = data.on;
// replace with listeners with .native modifier
// so it gets processed during parent component patch.
data.on = data.nativeOn;

if (isTrue(Ctor.options.abstract)) {
// abstract components do not keep anything
Expand Down Expand Up @@ -4059,12 +4088,12 @@ function initRender (vm) {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
}, true);
defineReactive$$1(vm, '$listeners', parentData && parentData.on, function () {
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
}, true);
} else {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
defineReactive$$1(vm, '$listeners', parentData && parentData.on, null, true);
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
}
}

Expand Down Expand Up @@ -4628,7 +4657,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});

Vue$3.version = '2.4.1';
Vue$3.version = '2.4.2';

/* */

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

function updateDOMListeners (oldVnode, vnode) {
var isComponentRoot = isDef(vnode.componentOptions);
var oldOn = isComponentRoot ? oldVnode.data.nativeOn : oldVnode.data.on;
var on = isComponentRoot ? vnode.data.nativeOn : vnode.data.on;
if (isUndef(oldOn) && isUndef(on)) {
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
return
}
on = on || {};
oldOn = oldOn || {};
var on = vnode.data.on || {};
var oldOn = oldVnode.data.on || {};
target$1 = vnode.elm;
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
Expand Down Expand Up @@ -6505,7 +6531,11 @@ function shouldUpdateValue (
function isDirty (elm, checkVal) {
// return true when textbox (.number and .trim) loses focus and its value is
// not equal to the updated value
return document.activeElement !== elm && elm.value !== checkVal
var notInFocus = true;
// #6157
// work around IE bug when accessing document.activeElement in an iframe
try { notInFocus = document.activeElement !== elm; } catch (e) {}
return notInFocus && elm.value !== checkVal
}

function isInputChanged (elm, newVal) {
Expand Down Expand Up @@ -7285,6 +7315,7 @@ var model$1 = {
if (isIE || isEdge) {
setTimeout(cb, 0);
}
el._vOptions = [].map.call(el.options, getValue);
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
el._vModifiers = binding.modifiers;
if (!binding.modifiers.lazy) {
Expand All @@ -7311,10 +7342,9 @@ var model$1 = {
// it's possible that the value is out-of-sync with the rendered options.
// detect such cases and filter out values that no longer has a matching
// option in the DOM.
var needReset = el.multiple
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
if (needReset) {
var prevOptions = el._vOptions;
var curOptions = el._vOptions = [].map.call(el.options, getValue);
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
trigger(el, 'change');
}
}
Expand Down Expand Up @@ -7354,15 +7384,6 @@ function setSelected (el, binding, vm) {
}
}

function hasNoMatchingOption (value, options) {
for (var i = 0, l = options.length; i < l; i++) {
if (looseEqual(getValue(options[i]), value)) {
return false
}
}
return true
}

function getValue (option) {
return '_value' in option
? option._value
Expand Down Expand Up @@ -7403,7 +7424,7 @@ var show = {
var transition$$1 = vnode.data && vnode.data.transition;
var originalDisplay = el.__vOriginalDisplay =
el.style.display === 'none' ? '' : el.style.display;
if (value && transition$$1 && !isIE9) {
if (value && transition$$1) {
vnode.data.show = true;
enter(vnode, function () {
el.style.display = originalDisplay;
Expand All @@ -7421,7 +7442,7 @@ var show = {
if (value === oldValue) { return }
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
if (transition$$1 && !isIE9) {
if (transition$$1) {
vnode.data.show = true;
if (value) {
enter(vnode, function () {
Expand Down Expand Up @@ -8162,9 +8183,6 @@ function parseHTML (html, options) {
last = html;
// Make sure we're not in a plaintext content element like script/style
if (!lastTag || !isPlainTextElement(lastTag)) {
if (shouldIgnoreFirstNewline(lastTag, html)) {
advance(1);
}
var textEnd = html.indexOf('<');
if (textEnd === 0) {
// Comment:
Expand Down Expand Up @@ -8210,6 +8228,9 @@ function parseHTML (html, options) {
var startTagMatch = parseStartTag();
if (startTagMatch) {
handleStartTag(startTagMatch);
if (shouldIgnoreFirstNewline(lastTag, html)) {
advance(1);
}
continue
}
}
Expand Down Expand Up @@ -8870,8 +8891,8 @@ function processAttrs (el) {
);
}
}
if (!el.component && (
isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)
if (isProp || (
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
)) {
addProp(el, name, value);
} else {
Expand Down Expand Up @@ -9657,7 +9678,7 @@ function genText (text) {
}

function genComment (comment) {
return ("_e('" + (comment.text) + "')")
return ("_e(" + (JSON.stringify(comment.text)) + ")")
}

function genSlot (el, state) {
Expand Down
Loading

0 comments on commit fd68195

Please sign in to comment.