Skip to content

Commit aa25ce8

Browse files
chrisvfritzyyx990803
authored andcommitted
update to 2.0.0-beta.5
1 parent 6040967 commit aa25ce8

File tree

1 file changed

+96
-33
lines changed

1 file changed

+96
-33
lines changed

themes/vue/source/js/vue.js

Lines changed: 96 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,7 @@
12671267
this.child = undefined;
12681268
this.parent = undefined;
12691269
this.raw = false;
1270+
this.isStatic = false;
12701271
// apply construct hook.
12711272
// this is applied during render, before patch happens.
12721273
// unlike other hooks, this is applied on both client and server.
@@ -1662,15 +1663,21 @@
16621663
if (typeof _ret === "object") return _ret.v;
16631664
}
16641665

1665-
// merge component management hooks onto the placeholder node
1666-
mergeHooks(data);
1667-
16681666
// extract listeners, since these needs to be treated as
16691667
// child component listeners instead of DOM listeners
16701668
var listeners = data.on;
16711669
// replace with listeners with .native modifier
16721670
data.on = data.nativeOn;
16731671

1672+
if (Ctor.options.abstract) {
1673+
// abstract components do not keep anything
1674+
// other than props & listeners
1675+
data = {};
1676+
}
1677+
1678+
// merge component management hooks onto the placeholder node
1679+
mergeHooks(data);
1680+
16741681
// return a placeholder vnode
16751682
var name = Ctor.options.name || tag;
16761683
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 });
@@ -1980,9 +1987,14 @@
19801987
// number conversion
19811988
Vue.prototype._n = toNumber;
19821989

1983-
//
1990+
// render static tree by index
19841991
Vue.prototype._m = function renderStatic(index) {
1985-
return this._staticTrees[index] || (this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy));
1992+
var tree = this._staticTrees[index];
1993+
if (!tree) {
1994+
tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
1995+
tree.isStatic = true;
1996+
}
1997+
return tree;
19861998
};
19871999

19882000
// filter resolution helper
@@ -7183,7 +7195,7 @@ var template = Object.freeze({
71837195
}
71847196
});
71857197

7186-
Vue.version = '2.0.0-beta.4';
7198+
Vue.version = '2.0.0-beta.5';
71877199

71887200
// attributes that should be using props for binding
71897201
var mustUseProp = makeMap('value,selected,checked,muted');
@@ -7336,9 +7348,10 @@ var template = Object.freeze({
73367348
var isIE9 = UA$1 && UA$1.indexOf('msie 9.0') > 0;
73377349
var isAndroid = UA$1 && UA$1.indexOf('android') > 0;
73387350

7339-
// some browsers, e.g. PhantomJS, encodes attribute values for innerHTML
7351+
// some browsers, e.g. PhantomJS, encodes angular brackets
7352+
// inside attribute values when retrieving innerHTML.
73407353
// this causes problems with the in-browser parser.
7341-
var shouldDecodeAttr = inBrowser ? function () {
7354+
var shouldDecodeTags = inBrowser ? function () {
73427355
var div = document.createElement('div');
73437356
div.innerHTML = '<div a=">">';
73447357
return div.innerHTML.indexOf('&gt;') > 0;
@@ -7435,6 +7448,9 @@ var nodeOps = Object.freeze({
74357448
}
74367449

74377450
function sameVnode(vnode1, vnode2) {
7451+
if (vnode1.isStatic || vnode2.isStatic) {
7452+
return vnode1 === vnode2;
7453+
}
74387454
return vnode1.key === vnode2.key && vnode1.tag === vnode2.tag && !vnode1.data === !vnode2.data;
74397455
}
74407456

@@ -7669,8 +7685,8 @@ var nodeOps = Object.freeze({
76697685
newStartVnode = newCh[++newStartIdx];
76707686
} else {
76717687
if (isUndef(oldKeyToIdx)) oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
7672-
idxInOld = oldKeyToIdx[newStartVnode.key];
7673-
if (isUndef(idxInOld)) {
7688+
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : newStartVnode.isStatic ? oldCh.indexOf(newStartVnode) : null;
7689+
if (isUndef(idxInOld) || idxInOld === -1) {
76747690
// New element
76757691
nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
76767692
newStartVnode = newCh[++newStartIdx];
@@ -8240,8 +8256,8 @@ var nodeOps = Object.freeze({
82408256
removeClass(el, cls);
82418257
}
82428258

8243-
function whenTransitionEnds(el, cb) {
8244-
var _getTransitionInfo = getTransitionInfo(el);
8259+
function whenTransitionEnds(el, expectedType, cb) {
8260+
var _getTransitionInfo = getTransitionInfo(el, expectedType);
82458261

82468262
var type = _getTransitionInfo.type;
82478263
var timeout = _getTransitionInfo.timeout;
@@ -8269,22 +8285,42 @@ var nodeOps = Object.freeze({
82698285

82708286
var transformRE = /\b(transform|all)(,|$)/;
82718287

8272-
function getTransitionInfo(el) {
8288+
function getTransitionInfo(el, expectedType) {
82738289
var styles = window.getComputedStyle(el);
8274-
var transitionProps = styles[transitionProp + 'Property'];
82758290
var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
82768291
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
8292+
var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
82778293
var animationDelays = styles[animationProp + 'Delay'].split(', ');
82788294
var animationDurations = styles[animationProp + 'Duration'].split(', ');
8279-
var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
82808295
var animationTimeout = getTimeout(animationDelays, animationDurations);
8281-
var timeout = Math.max(transitionTimeout, animationTimeout);
8282-
var type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
8296+
8297+
var type = void 0;
8298+
var timeout = 0;
8299+
var propCount = 0;
8300+
/* istanbul ignore if */
8301+
if (expectedType === TRANSITION) {
8302+
if (transitionTimeout > 0) {
8303+
type = TRANSITION;
8304+
timeout = transitionTimeout;
8305+
propCount = transitionDurations.length;
8306+
}
8307+
} else if (expectedType === ANIMATION) {
8308+
if (animationTimeout > 0) {
8309+
type = ANIMATION;
8310+
timeout = animationTimeout;
8311+
propCount = animationDurations.length;
8312+
}
8313+
} else {
8314+
timeout = Math.max(transitionTimeout, animationTimeout);
8315+
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
8316+
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
8317+
}
8318+
var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
82838319
return {
82848320
type: type,
82858321
timeout: timeout,
8286-
propCount: type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0,
8287-
hasTransform: type === TRANSITION && transformRE.test(transitionProps)
8322+
propCount: propCount,
8323+
hasTransform: hasTransform
82888324
};
82898325
}
82908326

@@ -8318,6 +8354,7 @@ var nodeOps = Object.freeze({
83188354
}
83198355

83208356
var css = data.css;
8357+
var type = data.type;
83218358
var enterClass = data.enterClass;
83228359
var enterActiveClass = data.enterActiveClass;
83238360
var appearClass = data.appearClass;
@@ -8384,7 +8421,7 @@ var nodeOps = Object.freeze({
83848421
nextFrame(function () {
83858422
removeTransitionClass(el, startClass);
83868423
if (!cb.cancelled && !userWantsControl) {
8387-
whenTransitionEnds(el, cb);
8424+
whenTransitionEnds(el, type, cb);
83888425
}
83898426
});
83908427
}
@@ -8414,6 +8451,7 @@ var nodeOps = Object.freeze({
84148451
}
84158452

84168453
var css = data.css;
8454+
var type = data.type;
84178455
var leaveClass = data.leaveClass;
84188456
var leaveActiveClass = data.leaveActiveClass;
84198457
var beforeLeave = data.beforeLeave;
@@ -8470,7 +8508,7 @@ var nodeOps = Object.freeze({
84708508
nextFrame(function () {
84718509
removeTransitionClass(el, leaveClass);
84728510
if (!cb.cancelled && !userWantsControl) {
8473-
whenTransitionEnds(el, cb);
8511+
whenTransitionEnds(el, type, cb);
84748512
}
84758513
});
84768514
}
@@ -8682,6 +8720,7 @@ var nodeOps = Object.freeze({
86828720
appear: Boolean,
86838721
css: Boolean,
86848722
mode: String,
8723+
type: String,
86858724
enterClass: String,
86868725
leaveClass: String,
86878726
enterActiveClass: String,
@@ -8959,10 +8998,7 @@ var nodeOps = Object.freeze({
89598998

89608999
var decoder = document.createElement('div');
89619000

8962-
function decodeHTML(html, asAttribute) {
8963-
if (asAttribute) {
8964-
html = html.replace(/</g, '&lt;').replace(/>/g, '&gt;');
8965-
}
9001+
function decodeHTML(html) {
89669002
decoder.innerHTML = html;
89679003
return decoder.textContent;
89689004
}
@@ -8998,11 +9034,23 @@ var nodeOps = Object.freeze({
89989034

89999035
var reCache = {};
90009036

9037+
var ampRE = /&amp;/g;
9038+
var ltRE = /&lt;/g;
9039+
var gtRE = /&gt;/g;
9040+
9041+
function decodeAttr(value, shouldDecodeTags) {
9042+
if (shouldDecodeTags) {
9043+
value = value.replace(ltRE, '<').replace(gtRE, '>');
9044+
}
9045+
return value.replace(ampRE, '&');
9046+
}
9047+
90019048
function parseHTML(html, options) {
90029049
var stack = [];
90039050
var expectHTML = options.expectHTML;
90049051
var isUnaryTag = options.isUnaryTag || no;
9005-
var shouldDecodeAttr = options.shouldDecodeAttr;
9052+
var isFromDOM = options.isFromDOM;
9053+
var shouldDecodeTags = options.shouldDecodeTags;
90069054
var index = 0;
90079055
var last = void 0,
90089056
lastTag = void 0;
@@ -9160,7 +9208,7 @@ var nodeOps = Object.freeze({
91609208
var value = args[3] || args[4] || args[5] || '';
91619209
attrs[i] = {
91629210
name: args[1],
9163-
value: shouldDecodeAttr ? decodeHTML(value, true) : value
9211+
value: isFromDOM ? decodeAttr(value, shouldDecodeTags) : value
91649212
};
91659213
}
91669214

@@ -9443,7 +9491,9 @@ var nodeOps = Object.freeze({
94439491
var warn$1 = void 0;
94449492
var platformGetTagNamespace = void 0;
94459493
var platformMustUseProp = void 0;
9494+
var preTransforms = void 0;
94469495
var transforms = void 0;
9496+
var postTransforms = void 0;
94479497
var delimiters = void 0;
94489498

94499499
/**
@@ -9453,7 +9503,9 @@ var nodeOps = Object.freeze({
94539503
warn$1 = options.warn || baseWarn;
94549504
platformGetTagNamespace = options.getTagNamespace || no;
94559505
platformMustUseProp = options.mustUseProp || no;
9506+
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
94569507
transforms = pluckModuleFunction(options.modules, 'transformNode');
9508+
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
94579509
delimiters = options.delimiters;
94589510
var stack = [];
94599511
var preserveWhitespace = options.preserveWhitespace !== false;
@@ -9464,7 +9516,8 @@ var nodeOps = Object.freeze({
94649516
parseHTML(template, {
94659517
expectHTML: options.expectHTML,
94669518
isUnaryTag: options.isUnaryTag,
9467-
shouldDecodeAttr: options.shouldDecodeAttr,
9519+
isFromDOM: options.isFromDOM,
9520+
shouldDecodeTags: options.shouldDecodeTags,
94689521
start: function start(tag, attrs, unary) {
94699522
// check namespace.
94709523
// inherit parent ns if there is one
@@ -9493,6 +9546,11 @@ var nodeOps = Object.freeze({
94939546
"development" !== 'production' && warn$1('Templates should only be responsbile for mapping the state to the ' + 'UI. Avoid placing tags with side-effects in your templates, such as ' + ('<' + tag + '>.'));
94949547
}
94959548

9549+
// apply pre-transforms
9550+
for (var i = 0; i < preTransforms.length; i++) {
9551+
preTransforms[i](element, options);
9552+
}
9553+
94969554
if (!inPre) {
94979555
processPre(element);
94989556
if (element.pre) {
@@ -9514,8 +9572,8 @@ var nodeOps = Object.freeze({
95149572
processRef(element);
95159573
processSlot(element);
95169574
processComponent(element);
9517-
for (var i = 0; i < transforms.length; i++) {
9518-
transforms[i](element, options);
9575+
for (var _i = 0; _i < transforms.length; _i++) {
9576+
transforms[_i](element, options);
95199577
}
95209578
processAttrs(element);
95219579
}
@@ -9548,6 +9606,10 @@ var nodeOps = Object.freeze({
95489606
currentParent = element;
95499607
stack.push(element);
95509608
}
9609+
// apply post-transforms
9610+
for (var _i2 = 0; _i2 < postTransforms.length; _i2++) {
9611+
postTransforms[_i2](element, options);
9612+
}
95519613
},
95529614
end: function end() {
95539615
// remove trailing whitespace
@@ -10585,9 +10647,10 @@ var nodeOps = Object.freeze({
1058510647
}
1058610648
if (template) {
1058710649
var _compileToFunctions = compileToFunctions(template, {
10588-
shouldDecodeAttr: isFromDOM && shouldDecodeAttr,
10589-
delimiters: options.delimiters,
10590-
warn: warn
10650+
warn: warn,
10651+
isFromDOM: isFromDOM,
10652+
shouldDecodeTags: shouldDecodeTags,
10653+
delimiters: options.delimiters
1059110654
}, this);
1059210655

1059310656
Vue.version = '1.0.26';

0 commit comments

Comments
 (0)