Skip to content

Commit 729d9ff

Browse files
committed
[build] 2.0.0-beta.5
1 parent 998ea85 commit 729d9ff

File tree

8 files changed

+265
-85
lines changed

8 files changed

+265
-85
lines changed

dist/vue.common.js

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,7 @@ var VNode = function VNode(tag, data, children, text, elm, ns, context, host, co
12601260
this.child = undefined;
12611261
this.parent = undefined;
12621262
this.raw = false;
1263+
this.isStatic = false;
12631264
// apply construct hook.
12641265
// this is applied during render, before patch happens.
12651266
// unlike other hooks, this is applied on both client and server.
@@ -1655,15 +1656,21 @@ function createComponent(Ctor, data, parent, context, host, _children, tag) {
16551656
if (typeof _ret === "object") return _ret.v;
16561657
}
16571658

1658-
// merge component management hooks onto the placeholder node
1659-
mergeHooks(data);
1660-
16611659
// extract listeners, since these needs to be treated as
16621660
// child component listeners instead of DOM listeners
16631661
var listeners = data.on;
16641662
// replace with listeners with .native modifier
16651663
data.on = data.nativeOn;
16661664

1665+
if (Ctor.options.abstract) {
1666+
// abstract components do not keep anything
1667+
// other than props & listeners
1668+
data = {};
1669+
}
1670+
1671+
// merge component management hooks onto the placeholder node
1672+
mergeHooks(data);
1673+
16671674
// return a placeholder vnode
16681675
var name = Ctor.options.name || tag;
16691676
var vnode = new VNode('vue-component-' + Ctor.cid + (name ? '-' + name : ''), data, undefined, undefined, undefined, undefined, context, host, { Ctor: Ctor, propsData: propsData, listeners: listeners, parent: parent, tag: tag, children: _children });
@@ -1973,9 +1980,14 @@ function renderMixin(Vue) {
19731980
// number conversion
19741981
Vue.prototype._n = toNumber;
19751982

1976-
//
1983+
// render static tree by index
19771984
Vue.prototype._m = function renderStatic(index) {
1978-
return this._staticTrees[index] || (this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy));
1985+
var tree = this._staticTrees[index];
1986+
if (!tree) {
1987+
tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
1988+
tree.isStatic = true;
1989+
}
1990+
return tree;
19791991
};
19801992

19811993
// filter resolution helper
@@ -2878,7 +2890,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
28782890
}
28792891
});
28802892

2881-
Vue.version = '2.0.0-beta.4';
2893+
Vue.version = '2.0.0-beta.5';
28822894

28832895
// attributes that should be using props for binding
28842896
var mustUseProp = makeMap('value,selected,checked,muted');
@@ -3031,9 +3043,10 @@ var isIE = UA$1 && /msie|trident/.test(UA$1);
30313043
var isIE9 = UA$1 && UA$1.indexOf('msie 9.0') > 0;
30323044
var isAndroid = UA$1 && UA$1.indexOf('android') > 0;
30333045

3034-
// some browsers, e.g. PhantomJS, encodes attribute values for innerHTML
3046+
// some browsers, e.g. PhantomJS, encodes angular brackets
3047+
// inside attribute values when retrieving innerHTML.
30353048
// this causes problems with the in-browser parser.
3036-
var shouldDecodeAttr = inBrowser ? function () {
3049+
var shouldDecodeTags = inBrowser ? function () {
30373050
var div = document.createElement('div');
30383051
div.innerHTML = '<div a=">">';
30393052
return div.innerHTML.indexOf('&gt;') > 0;
@@ -3130,6 +3143,9 @@ function isDef(s) {
31303143
}
31313144

31323145
function sameVnode(vnode1, vnode2) {
3146+
if (vnode1.isStatic || vnode2.isStatic) {
3147+
return vnode1 === vnode2;
3148+
}
31333149
return vnode1.key === vnode2.key && vnode1.tag === vnode2.tag && !vnode1.data === !vnode2.data;
31343150
}
31353151

@@ -3364,8 +3380,8 @@ function createPatchFunction(backend) {
33643380
newStartVnode = newCh[++newStartIdx];
33653381
} else {
33663382
if (isUndef(oldKeyToIdx)) oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
3367-
idxInOld = oldKeyToIdx[newStartVnode.key];
3368-
if (isUndef(idxInOld)) {
3383+
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : newStartVnode.isStatic ? oldCh.indexOf(newStartVnode) : null;
3384+
if (isUndef(idxInOld) || idxInOld === -1) {
33693385
// New element
33703386
nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
33713387
newStartVnode = newCh[++newStartIdx];
@@ -3935,8 +3951,8 @@ function removeTransitionClass(el, cls) {
39353951
removeClass(el, cls);
39363952
}
39373953

3938-
function whenTransitionEnds(el, cb) {
3939-
var _getTransitionInfo = getTransitionInfo(el);
3954+
function whenTransitionEnds(el, expectedType, cb) {
3955+
var _getTransitionInfo = getTransitionInfo(el, expectedType);
39403956

39413957
var type = _getTransitionInfo.type;
39423958
var timeout = _getTransitionInfo.timeout;
@@ -3964,22 +3980,42 @@ function whenTransitionEnds(el, cb) {
39643980

39653981
var transformRE = /\b(transform|all)(,|$)/;
39663982

3967-
function getTransitionInfo(el) {
3983+
function getTransitionInfo(el, expectedType) {
39683984
var styles = window.getComputedStyle(el);
3969-
var transitionProps = styles[transitionProp + 'Property'];
39703985
var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
39713986
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
3987+
var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
39723988
var animationDelays = styles[animationProp + 'Delay'].split(', ');
39733989
var animationDurations = styles[animationProp + 'Duration'].split(', ');
3974-
var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
39753990
var animationTimeout = getTimeout(animationDelays, animationDurations);
3976-
var timeout = Math.max(transitionTimeout, animationTimeout);
3977-
var type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
3991+
3992+
var type = void 0;
3993+
var timeout = 0;
3994+
var propCount = 0;
3995+
/* istanbul ignore if */
3996+
if (expectedType === TRANSITION) {
3997+
if (transitionTimeout > 0) {
3998+
type = TRANSITION;
3999+
timeout = transitionTimeout;
4000+
propCount = transitionDurations.length;
4001+
}
4002+
} else if (expectedType === ANIMATION) {
4003+
if (animationTimeout > 0) {
4004+
type = ANIMATION;
4005+
timeout = animationTimeout;
4006+
propCount = animationDurations.length;
4007+
}
4008+
} else {
4009+
timeout = Math.max(transitionTimeout, animationTimeout);
4010+
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
4011+
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
4012+
}
4013+
var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
39784014
return {
39794015
type: type,
39804016
timeout: timeout,
3981-
propCount: type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0,
3982-
hasTransform: type === TRANSITION && transformRE.test(transitionProps)
4017+
propCount: propCount,
4018+
hasTransform: hasTransform
39834019
};
39844020
}
39854021

@@ -4013,6 +4049,7 @@ function enter(vnode) {
40134049
}
40144050

40154051
var css = data.css;
4052+
var type = data.type;
40164053
var enterClass = data.enterClass;
40174054
var enterActiveClass = data.enterActiveClass;
40184055
var appearClass = data.appearClass;
@@ -4079,7 +4116,7 @@ function enter(vnode) {
40794116
nextFrame(function () {
40804117
removeTransitionClass(el, startClass);
40814118
if (!cb.cancelled && !userWantsControl) {
4082-
whenTransitionEnds(el, cb);
4119+
whenTransitionEnds(el, type, cb);
40834120
}
40844121
});
40854122
}
@@ -4109,6 +4146,7 @@ function leave(vnode, rm) {
41094146
}
41104147

41114148
var css = data.css;
4149+
var type = data.type;
41124150
var leaveClass = data.leaveClass;
41134151
var leaveActiveClass = data.leaveActiveClass;
41144152
var beforeLeave = data.beforeLeave;
@@ -4165,7 +4203,7 @@ function leave(vnode, rm) {
41654203
nextFrame(function () {
41664204
removeTransitionClass(el, leaveClass);
41674205
if (!cb.cancelled && !userWantsControl) {
4168-
whenTransitionEnds(el, cb);
4206+
whenTransitionEnds(el, type, cb);
41694207
}
41704208
});
41714209
}
@@ -4377,6 +4415,7 @@ var transitionProps = {
43774415
appear: Boolean,
43784416
css: Boolean,
43794417
mode: String,
4418+
type: String,
43804419
enterClass: String,
43814420
leaveClass: String,
43824421
enterActiveClass: String,

0 commit comments

Comments
 (0)