build: build 2.5.4

This commit is contained in:
Evan You 2017-11-16 14:53:22 -05:00
parent 5db86b4e94
commit 9edcc6b6c7
14 changed files with 1086 additions and 799 deletions

265
dist/vue.common.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.3
* Vue.js v2.5.4
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -7,6 +7,8 @@
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -424,8 +426,6 @@ var config = ({
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -466,17 +466,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1691,7 +1694,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -1915,6 +1918,43 @@ if (process.env.NODE_ENV !== 'production') {
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
@ -2508,7 +2548,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -3187,40 +3227,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
@ -3798,12 +3804,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -3813,7 +3826,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}
@ -4396,7 +4409,9 @@ function renderMixin (Vue) {
// last render. They need to be cloned to ensure "freshness" for this render.
for (var key in vm.$slots) {
var slot = vm.$slots[key];
if (slot._rendered) {
// _rendered is a flag added by renderSlot, but may not be present
// if the slot is passed from manually written render functions
if (slot._rendered || (slot[0] && slot[0].elm)) {
vm.$slots[key] = cloneVNodes(slot, true /* deep */);
}
}
@ -4951,7 +4966,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.3';
Vue$3.version = '2.5.4';
/* */
@ -5378,7 +5393,23 @@ function createPatchFunction (backend) {
}
}
var inPre = 0;
function isUnknownElement$$1 (vnode, inVPre) {
return (
!inVPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(vnode.tag)
: ignore === vnode.tag
})
) &&
config.isUnknownElement(vnode.tag)
)
}
var creatingElmInVPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
@ -5391,21 +5422,9 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
creatingElmInVPre++;
}
if (
!inPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(tag)
: ignore === tag
})
) &&
config.isUnknownElement(tag)
) {
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
@ -5429,7 +5448,7 @@ function createPatchFunction (backend) {
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
creatingElmInVPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
@ -5784,27 +5803,32 @@ function createPatchFunction (backend) {
}
}
var bailed = false;
var hydrationBailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: style is excluded because it relies on initial clone for future
// deep updates (#7063).
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
var i;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
inVPre = inVPre || (data && data.pre);
vnode.elm = elm;
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.isAsyncPlaceholder = true;
return true
}
// assert node match
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode, inVPre)) {
return false
}
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
@ -5825,9 +5849,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('server innerHTML: ', i);
console.warn('client innerHTML: ', elm.innerHTML);
@ -5839,7 +5863,7 @@ function createPatchFunction (backend) {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
childrenMatch = false;
break
}
@ -5851,9 +5875,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
@ -5863,12 +5887,18 @@ function createPatchFunction (backend) {
}
}
if (isDef(data)) {
var fullInvoke = false;
for (var key in data) {
if (!isRenderedModule(key)) {
fullInvoke = true;
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
if (!fullInvoke && data['class']) {
// ensure collecting deps for deep class bindings for future updates
traverse(data['class']);
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
@ -5876,10 +5906,10 @@ function createPatchFunction (backend) {
return true
}
function assertNodeMatch (node, vnode) {
function assertNodeMatch (node, vnode, inVPre) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
return vnode.tag.indexOf('vue-component') === 0 || (
!isUnknownElement$$1(vnode, inVPre) &&
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
@ -6367,39 +6397,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
process.env.NODE_ENV !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -7493,12 +7543,12 @@ function leave (vnode, rm) {
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
if (isUndef(data) || el.nodeType !== 1) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
if (isDef(el._leaveCb)) {
return
}
@ -7953,7 +8003,7 @@ var Transition = {
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
var children = this.$slots.default;
if (!children) {
return
}
@ -8032,7 +8082,9 @@ var Transition = {
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
!isAsyncPlaceholder(oldChild) &&
// #6687 component root is a comment node
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!
@ -9672,18 +9724,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if (process.env.NODE_ENV !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -9850,10 +9891,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -9879,7 +9920,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}

265
dist/vue.esm.js vendored
View File

@ -1,10 +1,12 @@
/*!
* Vue.js v2.5.3
* Vue.js v2.5.4
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -422,8 +424,6 @@ var config = ({
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -464,17 +464,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1689,7 +1692,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -1913,6 +1916,43 @@ if (process.env.NODE_ENV !== 'production') {
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
@ -2506,7 +2546,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -3185,40 +3225,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
@ -3796,12 +3802,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -3811,7 +3824,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}
@ -4394,7 +4407,9 @@ function renderMixin (Vue) {
// last render. They need to be cloned to ensure "freshness" for this render.
for (var key in vm.$slots) {
var slot = vm.$slots[key];
if (slot._rendered) {
// _rendered is a flag added by renderSlot, but may not be present
// if the slot is passed from manually written render functions
if (slot._rendered || (slot[0] && slot[0].elm)) {
vm.$slots[key] = cloneVNodes(slot, true /* deep */);
}
}
@ -4949,7 +4964,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.3';
Vue$3.version = '2.5.4';
/* */
@ -5376,7 +5391,23 @@ function createPatchFunction (backend) {
}
}
var inPre = 0;
function isUnknownElement$$1 (vnode, inVPre) {
return (
!inVPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(vnode.tag)
: ignore === vnode.tag
})
) &&
config.isUnknownElement(vnode.tag)
)
}
var creatingElmInVPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
@ -5389,21 +5420,9 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
creatingElmInVPre++;
}
if (
!inPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(tag)
: ignore === tag
})
) &&
config.isUnknownElement(tag)
) {
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
@ -5427,7 +5446,7 @@ function createPatchFunction (backend) {
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
creatingElmInVPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
@ -5782,27 +5801,32 @@ function createPatchFunction (backend) {
}
}
var bailed = false;
var hydrationBailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: style is excluded because it relies on initial clone for future
// deep updates (#7063).
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
var i;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
inVPre = inVPre || (data && data.pre);
vnode.elm = elm;
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.isAsyncPlaceholder = true;
return true
}
// assert node match
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode, inVPre)) {
return false
}
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
@ -5823,9 +5847,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('server innerHTML: ', i);
console.warn('client innerHTML: ', elm.innerHTML);
@ -5837,7 +5861,7 @@ function createPatchFunction (backend) {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
childrenMatch = false;
break
}
@ -5849,9 +5873,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
@ -5861,12 +5885,18 @@ function createPatchFunction (backend) {
}
}
if (isDef(data)) {
var fullInvoke = false;
for (var key in data) {
if (!isRenderedModule(key)) {
fullInvoke = true;
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
if (!fullInvoke && data['class']) {
// ensure collecting deps for deep class bindings for future updates
traverse(data['class']);
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
@ -5874,10 +5904,10 @@ function createPatchFunction (backend) {
return true
}
function assertNodeMatch (node, vnode) {
function assertNodeMatch (node, vnode, inVPre) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
return vnode.tag.indexOf('vue-component') === 0 || (
!isUnknownElement$$1(vnode, inVPre) &&
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
@ -6365,39 +6395,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
process.env.NODE_ENV !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -7491,12 +7541,12 @@ function leave (vnode, rm) {
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
if (isUndef(data) || el.nodeType !== 1) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
if (isDef(el._leaveCb)) {
return
}
@ -7951,7 +8001,7 @@ var Transition = {
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
var children = this.$slots.default;
if (!children) {
return
}
@ -8030,7 +8080,9 @@ var Transition = {
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
!isAsyncPlaceholder(oldChild) &&
// #6687 component root is a comment node
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!
@ -9670,18 +9722,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if (process.env.NODE_ENV !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -9848,10 +9889,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -9877,7 +9918,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}

265
dist/vue.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.3
* Vue.js v2.5.4
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -11,6 +11,8 @@
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -428,8 +430,6 @@ var config = ({
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -470,17 +470,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1695,7 +1698,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -1919,6 +1922,43 @@ var initProxy;
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
@ -2510,7 +2550,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -3187,40 +3227,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
@ -3794,12 +3800,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -3809,7 +3822,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}
@ -4389,7 +4402,9 @@ function renderMixin (Vue) {
// last render. They need to be cloned to ensure "freshness" for this render.
for (var key in vm.$slots) {
var slot = vm.$slots[key];
if (slot._rendered) {
// _rendered is a flag added by renderSlot, but may not be present
// if the slot is passed from manually written render functions
if (slot._rendered || (slot[0] && slot[0].elm)) {
vm.$slots[key] = cloneVNodes(slot, true /* deep */);
}
}
@ -4940,7 +4955,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.3';
Vue$3.version = '2.5.4';
/* */
@ -5367,7 +5382,23 @@ function createPatchFunction (backend) {
}
}
var inPre = 0;
function isUnknownElement$$1 (vnode, inVPre) {
return (
!inVPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(vnode.tag)
: ignore === vnode.tag
})
) &&
config.isUnknownElement(vnode.tag)
)
}
var creatingElmInVPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
@ -5380,21 +5411,9 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
{
if (data && data.pre) {
inPre++;
creatingElmInVPre++;
}
if (
!inPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(tag)
: ignore === tag
})
) &&
config.isUnknownElement(tag)
) {
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
@ -5418,7 +5437,7 @@ function createPatchFunction (backend) {
}
if ("development" !== 'production' && data && data.pre) {
inPre--;
creatingElmInVPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
@ -5773,27 +5792,32 @@ function createPatchFunction (backend) {
}
}
var bailed = false;
var hydrationBailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: style is excluded because it relies on initial clone for future
// deep updates (#7063).
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
{
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
var i;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
inVPre = inVPre || (data && data.pre);
vnode.elm = elm;
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.isAsyncPlaceholder = true;
return true
}
// assert node match
{
if (!assertNodeMatch(elm, vnode, inVPre)) {
return false
}
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
@ -5814,9 +5838,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if ("development" !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('server innerHTML: ', i);
console.warn('client innerHTML: ', elm.innerHTML);
@ -5828,7 +5852,7 @@ function createPatchFunction (backend) {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
childrenMatch = false;
break
}
@ -5840,9 +5864,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if ("development" !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
@ -5852,12 +5876,18 @@ function createPatchFunction (backend) {
}
}
if (isDef(data)) {
var fullInvoke = false;
for (var key in data) {
if (!isRenderedModule(key)) {
fullInvoke = true;
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
if (!fullInvoke && data['class']) {
// ensure collecting deps for deep class bindings for future updates
traverse(data['class']);
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
@ -5865,10 +5895,10 @@ function createPatchFunction (backend) {
return true
}
function assertNodeMatch (node, vnode) {
function assertNodeMatch (node, vnode, inVPre) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
return vnode.tag.indexOf('vue-component') === 0 || (
!isUnknownElement$$1(vnode, inVPre) &&
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
@ -6356,39 +6386,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
"development" !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -7482,12 +7532,12 @@ function leave (vnode, rm) {
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
if (isUndef(data) || el.nodeType !== 1) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
if (isDef(el._leaveCb)) {
return
}
@ -7942,7 +7992,7 @@ var Transition = {
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
var children = this.$slots.default;
if (!children) {
return
}
@ -8021,7 +8071,9 @@ var Transition = {
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
!isAsyncPlaceholder(oldChild) &&
// #6687 component root is a comment node
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!
@ -9661,18 +9713,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if ("development" !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -9839,10 +9880,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -9868,7 +9909,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}

4
dist/vue.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.3
* Vue.js v2.5.4
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -7,6 +7,8 @@
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -420,8 +422,6 @@ var config = ({
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -462,17 +462,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1687,7 +1690,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -1886,6 +1889,43 @@ if (process.env.NODE_ENV !== 'production') {
};
}
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
var mark;
var measure;
@ -2504,7 +2544,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -3183,40 +3223,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
@ -3794,12 +3800,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -3809,7 +3822,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}
@ -4392,7 +4405,9 @@ function renderMixin (Vue) {
// last render. They need to be cloned to ensure "freshness" for this render.
for (var key in vm.$slots) {
var slot = vm.$slots[key];
if (slot._rendered) {
// _rendered is a flag added by renderSlot, but may not be present
// if the slot is passed from manually written render functions
if (slot._rendered || (slot[0] && slot[0].elm)) {
vm.$slots[key] = cloneVNodes(slot, true /* deep */);
}
}
@ -4947,7 +4962,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.3';
Vue$3.version = '2.5.4';
/* */
@ -5374,7 +5389,23 @@ function createPatchFunction (backend) {
}
}
var inPre = 0;
function isUnknownElement$$1 (vnode, inVPre) {
return (
!inVPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(vnode.tag)
: ignore === vnode.tag
})
) &&
config.isUnknownElement(vnode.tag)
)
}
var creatingElmInVPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
@ -5387,21 +5418,9 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
creatingElmInVPre++;
}
if (
!inPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(tag)
: ignore === tag
})
) &&
config.isUnknownElement(tag)
) {
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
@ -5425,7 +5444,7 @@ function createPatchFunction (backend) {
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
creatingElmInVPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
@ -5780,27 +5799,32 @@ function createPatchFunction (backend) {
}
}
var bailed = false;
var hydrationBailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: style is excluded because it relies on initial clone for future
// deep updates (#7063).
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
var i;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
inVPre = inVPre || (data && data.pre);
vnode.elm = elm;
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.isAsyncPlaceholder = true;
return true
}
// assert node match
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode, inVPre)) {
return false
}
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
@ -5821,9 +5845,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('server innerHTML: ', i);
console.warn('client innerHTML: ', elm.innerHTML);
@ -5835,7 +5859,7 @@ function createPatchFunction (backend) {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
childrenMatch = false;
break
}
@ -5847,9 +5871,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
@ -5859,12 +5883,18 @@ function createPatchFunction (backend) {
}
}
if (isDef(data)) {
var fullInvoke = false;
for (var key in data) {
if (!isRenderedModule(key)) {
fullInvoke = true;
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
if (!fullInvoke && data['class']) {
// ensure collecting deps for deep class bindings for future updates
traverse(data['class']);
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
@ -5872,10 +5902,10 @@ function createPatchFunction (backend) {
return true
}
function assertNodeMatch (node, vnode) {
function assertNodeMatch (node, vnode, inVPre) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
return vnode.tag.indexOf('vue-component') === 0 || (
!isUnknownElement$$1(vnode, inVPre) &&
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
@ -6996,12 +7026,12 @@ function leave (vnode, rm) {
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
if (isUndef(data) || el.nodeType !== 1) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
if (isDef(el._leaveCb)) {
return
}
@ -7456,7 +7486,7 @@ var Transition = {
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
var children = this.$slots.default;
if (!children) {
return
}
@ -7535,7 +7565,9 @@ var Transition = {
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
!isAsyncPlaceholder(oldChild) &&
// #6687 component root is a comment node
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!

View File

@ -1,10 +1,12 @@
/*!
* Vue.js v2.5.3
* Vue.js v2.5.4
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -418,8 +420,6 @@ var config = ({
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -460,17 +460,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1685,7 +1688,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -1884,6 +1887,43 @@ if (process.env.NODE_ENV !== 'production') {
};
}
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
var mark;
var measure;
@ -2502,7 +2542,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -3181,40 +3221,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
@ -3792,12 +3798,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -3807,7 +3820,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}
@ -4390,7 +4403,9 @@ function renderMixin (Vue) {
// last render. They need to be cloned to ensure "freshness" for this render.
for (var key in vm.$slots) {
var slot = vm.$slots[key];
if (slot._rendered) {
// _rendered is a flag added by renderSlot, but may not be present
// if the slot is passed from manually written render functions
if (slot._rendered || (slot[0] && slot[0].elm)) {
vm.$slots[key] = cloneVNodes(slot, true /* deep */);
}
}
@ -4945,7 +4960,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.3';
Vue$3.version = '2.5.4';
/* */
@ -5372,7 +5387,23 @@ function createPatchFunction (backend) {
}
}
var inPre = 0;
function isUnknownElement$$1 (vnode, inVPre) {
return (
!inVPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(vnode.tag)
: ignore === vnode.tag
})
) &&
config.isUnknownElement(vnode.tag)
)
}
var creatingElmInVPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
@ -5385,21 +5416,9 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
creatingElmInVPre++;
}
if (
!inPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(tag)
: ignore === tag
})
) &&
config.isUnknownElement(tag)
) {
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
@ -5423,7 +5442,7 @@ function createPatchFunction (backend) {
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
creatingElmInVPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
@ -5778,27 +5797,32 @@ function createPatchFunction (backend) {
}
}
var bailed = false;
var hydrationBailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: style is excluded because it relies on initial clone for future
// deep updates (#7063).
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
var i;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
inVPre = inVPre || (data && data.pre);
vnode.elm = elm;
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.isAsyncPlaceholder = true;
return true
}
// assert node match
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode, inVPre)) {
return false
}
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
@ -5819,9 +5843,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('server innerHTML: ', i);
console.warn('client innerHTML: ', elm.innerHTML);
@ -5833,7 +5857,7 @@ function createPatchFunction (backend) {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
childrenMatch = false;
break
}
@ -5845,9 +5869,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
@ -5857,12 +5881,18 @@ function createPatchFunction (backend) {
}
}
if (isDef(data)) {
var fullInvoke = false;
for (var key in data) {
if (!isRenderedModule(key)) {
fullInvoke = true;
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
if (!fullInvoke && data['class']) {
// ensure collecting deps for deep class bindings for future updates
traverse(data['class']);
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
@ -5870,10 +5900,10 @@ function createPatchFunction (backend) {
return true
}
function assertNodeMatch (node, vnode) {
function assertNodeMatch (node, vnode, inVPre) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
return vnode.tag.indexOf('vue-component') === 0 || (
!isUnknownElement$$1(vnode, inVPre) &&
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
@ -6994,12 +7024,12 @@ function leave (vnode, rm) {
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
if (isUndef(data) || el.nodeType !== 1) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
if (isDef(el._leaveCb)) {
return
}
@ -7454,7 +7484,7 @@ var Transition = {
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
var children = this.$slots.default;
if (!children) {
return
}
@ -7533,7 +7563,9 @@ var Transition = {
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
!isAsyncPlaceholder(oldChild) &&
// #6687 component root is a comment node
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!

214
dist/vue.runtime.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.5.3
* Vue.js v2.5.4
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
@ -11,6 +11,8 @@
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -424,8 +426,6 @@ var config = ({
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -466,17 +466,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1691,7 +1694,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -1890,6 +1893,43 @@ var initProxy;
};
}
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
var mark;
var measure;
@ -2506,7 +2546,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -3183,40 +3223,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
@ -3790,12 +3796,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -3805,7 +3818,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}
@ -4385,7 +4398,9 @@ function renderMixin (Vue) {
// last render. They need to be cloned to ensure "freshness" for this render.
for (var key in vm.$slots) {
var slot = vm.$slots[key];
if (slot._rendered) {
// _rendered is a flag added by renderSlot, but may not be present
// if the slot is passed from manually written render functions
if (slot._rendered || (slot[0] && slot[0].elm)) {
vm.$slots[key] = cloneVNodes(slot, true /* deep */);
}
}
@ -4936,7 +4951,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
}
});
Vue$3.version = '2.5.3';
Vue$3.version = '2.5.4';
/* */
@ -5363,7 +5378,23 @@ function createPatchFunction (backend) {
}
}
var inPre = 0;
function isUnknownElement$$1 (vnode, inVPre) {
return (
!inVPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(vnode.tag)
: ignore === vnode.tag
})
) &&
config.isUnknownElement(vnode.tag)
)
}
var creatingElmInVPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
@ -5376,21 +5407,9 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
{
if (data && data.pre) {
inPre++;
creatingElmInVPre++;
}
if (
!inPre &&
!vnode.ns &&
!(
config.ignoredElements.length &&
config.ignoredElements.some(function (ignore) {
return isRegExp(ignore)
? ignore.test(tag)
: ignore === tag
})
) &&
config.isUnknownElement(tag)
) {
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
@ -5414,7 +5433,7 @@ function createPatchFunction (backend) {
}
if ("development" !== 'production' && data && data.pre) {
inPre--;
creatingElmInVPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
@ -5769,27 +5788,32 @@ function createPatchFunction (backend) {
}
}
var bailed = false;
var hydrationBailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: style is excluded because it relies on initial clone for future
// deep updates (#7063).
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
{
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
var i;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
inVPre = inVPre || (data && data.pre);
vnode.elm = elm;
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.isAsyncPlaceholder = true;
return true
}
// assert node match
{
if (!assertNodeMatch(elm, vnode, inVPre)) {
return false
}
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
@ -5810,9 +5834,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if ("development" !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('server innerHTML: ', i);
console.warn('client innerHTML: ', elm.innerHTML);
@ -5824,7 +5848,7 @@ function createPatchFunction (backend) {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
childrenMatch = false;
break
}
@ -5836,9 +5860,9 @@ function createPatchFunction (backend) {
/* istanbul ignore if */
if ("development" !== 'production' &&
typeof console !== 'undefined' &&
!bailed
!hydrationBailed
) {
bailed = true;
hydrationBailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
@ -5848,12 +5872,18 @@ function createPatchFunction (backend) {
}
}
if (isDef(data)) {
var fullInvoke = false;
for (var key in data) {
if (!isRenderedModule(key)) {
fullInvoke = true;
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
if (!fullInvoke && data['class']) {
// ensure collecting deps for deep class bindings for future updates
traverse(data['class']);
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
@ -5861,10 +5891,10 @@ function createPatchFunction (backend) {
return true
}
function assertNodeMatch (node, vnode) {
function assertNodeMatch (node, vnode, inVPre) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
return vnode.tag.indexOf('vue-component') === 0 || (
!isUnknownElement$$1(vnode, inVPre) &&
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
@ -6985,12 +7015,12 @@ function leave (vnode, rm) {
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
if (isUndef(data) || el.nodeType !== 1) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
if (isDef(el._leaveCb)) {
return
}
@ -7445,7 +7475,7 @@ var Transition = {
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
var children = this.$slots.default;
if (!children) {
return
}
@ -7524,7 +7554,9 @@ var Transition = {
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
!isAsyncPlaceholder(oldChild) &&
// #6687 component root is a comment node
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -568,8 +570,6 @@ function setText (node, text, raw) {
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -607,17 +607,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1820,7 +1823,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -2577,39 +2580,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
"development" !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -4511,18 +4534,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if ("development" !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -4689,10 +4701,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -4718,7 +4730,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}
@ -6047,6 +6059,43 @@ function renderSSRStyle (
}
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
{
}
@ -6399,7 +6448,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -6897,40 +6946,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
/* */
@ -7234,12 +7249,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -7249,7 +7271,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}

View File

@ -8,6 +8,8 @@ var he = _interopDefault(require('he'));
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
@ -570,8 +572,6 @@ function setText (node, text, raw) {
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -609,17 +609,20 @@ function parsePath (path) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1822,7 +1825,7 @@ function logError (err, vm, info) {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
@ -2671,39 +2674,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
process.env.NODE_ENV !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -4250,18 +4273,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if (process.env.NODE_ENV !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -4428,10 +4440,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -4457,7 +4469,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}
@ -5788,6 +5800,43 @@ if (process.env.NODE_ENV !== 'production') {
/* */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
function traverse (val) {
_traverse(val, seenObjects);
seenObjects.clear();
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
@ -6136,7 +6185,7 @@ function resolveSlots (
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
return (node.isComment && !node.asyncFactory) || node.text === ' '
}
function resolveScopedSlots (
@ -6628,40 +6677,6 @@ Watcher.prototype.teardown = function teardown () {
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
/* */
@ -6965,12 +6980,19 @@ function bindObjectProps (
*/
function renderStatic (
index,
isInFor
isInFor,
isOnce
) {
// static trees can be rendered once and cached on the contructor options
// so every instance shares the same cached trees
var options = this.$options;
var cached = options.cached || (options.cached = []);
// render fns generated by compiler < 2.5.4 does not provide v-once
// information to runtime so be conservative
var isOldVersion = arguments.length < 3;
// if a static tree is generated by v-once, it is cached on the instance;
// otherwise it is purely static and can be cached on the shared options
// across all instances.
var renderFns = this.$options.staticRenderFns;
var cached = isOldVersion || isOnce
? (this._staticTrees || (this._staticTrees = []))
: (renderFns.cached || (renderFns.cached = []));
var tree = cached[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
@ -6980,7 +7002,7 @@ function renderStatic (
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = cached[index] = options.staticRenderFns[index].call(this._renderProxy, null, this);
tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
markStatic(tree, ("__static__" + index), false);
return tree
}

View File

@ -1,6 +1,6 @@
{
"name": "vue-server-renderer",
"version": "2.5.3",
"version": "2.5.4",
"description": "server renderer for Vue 2.0",
"main": "index.js",
"types": "types/index.d.ts",

View File

@ -52,6 +52,8 @@ function count (line, type) {
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
@ -706,8 +708,6 @@ function parseComponent (
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -727,17 +727,20 @@ function def (obj, key, val, enumerable) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1931,39 +1934,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
"development" !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -3708,18 +3731,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if ("development" !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -3886,10 +3898,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -3915,7 +3927,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}

View File

@ -9,6 +9,8 @@ var he = _interopDefault(require('he'));
/* */
var emptyObject = Object.freeze({});
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
@ -663,8 +665,6 @@ function parseComponent (
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
@ -684,17 +684,20 @@ function def (obj, key, val, enumerable) {
/* */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefox has a "watch" function on Object.prototype...
@ -1888,39 +1891,59 @@ function addHandler (
important,
warn
) {
modifiers = modifiers || emptyObject;
// warn prevent and passive modifier
/* istanbul ignore if */
if (
process.env.NODE_ENV !== 'production' && warn &&
modifiers && modifiers.prevent && modifiers.passive
modifiers.prevent && modifiers.passive
) {
warn(
'passive and prevent can\'t be used together. ' +
'Passive handler can\'t prevent default event.'
);
}
// check capture modifier
if (modifiers && modifiers.capture) {
if (modifiers.capture) {
delete modifiers.capture;
name = '!' + name; // mark the event as captured
}
if (modifiers && modifiers.once) {
if (modifiers.once) {
delete modifiers.once;
name = '~' + name; // mark the event as once
}
/* istanbul ignore if */
if (modifiers && modifiers.passive) {
if (modifiers.passive) {
delete modifiers.passive;
name = '&' + name; // mark the event as passive
}
// normalize click.right and click.middle since they don't actually fire
// this is technically browser-specific, but at least for now browsers are
// the only target envs that have right/middle clicks.
if (name === 'click') {
if (modifiers.right) {
name = 'contextmenu';
delete modifiers.right;
} else if (modifiers.middle) {
name = 'mouseup';
}
}
var events;
if (modifiers && modifiers.native) {
if (modifiers.native) {
delete modifiers.native;
events = el.nativeEvents || (el.nativeEvents = {});
} else {
events = el.events || (el.events = {});
}
var newHandler = { value: value, modifiers: modifiers };
var newHandler = { value: value };
if (modifiers !== emptyObject) {
newHandler.modifiers = modifiers;
}
var handlers = events[name];
/* istanbul ignore if */
if (Array.isArray(handlers)) {
@ -3310,18 +3333,7 @@ function genHandlers (
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if (process.env.NODE_ENV !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
}
return res.slice(0, -1) + '}'
}
@ -3488,10 +3500,10 @@ function genElement (el, state) {
}
// hoist static sub-trees out
function genStatic (el, state) {
function genStatic (el, state, once$$1) {
el.staticProcessed = true;
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
return ("_m(" + (state.staticRenderFns.length - 1) + "," + (el.staticInFor ? 'true' : 'false') + "," + (once$$1 ? 'true' : 'false') + ")")
}
// v-once
@ -3517,7 +3529,7 @@ function genOnce (el, state) {
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state)
return genStatic(el, state, true)
}
}

View File

@ -1,6 +1,6 @@
{
"name": "vue-template-compiler",
"version": "2.5.3",
"version": "2.5.4",
"description": "template compiler for Vue 2.0",
"main": "index.js",
"unpkg": "browser.js",