Skip to content

Commit 1e6a8f5

Browse files
committed
[build] 2.0.3
1 parent 3f8fa43 commit 1e6a8f5

File tree

8 files changed

+435
-402
lines changed

8 files changed

+435
-402
lines changed

dist/vue.common.js

Lines changed: 94 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v2.0.2
2+
* Vue.js v2.0.3
33
* (c) 2014-2016 Evan You
44
* Released under the MIT License.
55
*/
@@ -1481,85 +1481,25 @@ function cloneVNodes (vnodes) {
14811481

14821482
/* */
14831483

1484-
function normalizeChildren (
1485-
children,
1486-
ns,
1487-
nestedIndex
1488-
) {
1489-
if (isPrimitive(children)) {
1490-
return [createTextVNode(children)]
1491-
}
1492-
if (Array.isArray(children)) {
1493-
var res = [];
1494-
for (var i = 0, l = children.length; i < l; i++) {
1495-
var c = children[i];
1496-
var last = res[res.length - 1];
1497-
// nested
1498-
if (Array.isArray(c)) {
1499-
res.push.apply(res, normalizeChildren(c, ns, i));
1500-
} else if (isPrimitive(c)) {
1501-
if (last && last.text) {
1502-
last.text += String(c);
1503-
} else if (c !== '') {
1504-
// convert primitive to vnode
1505-
res.push(createTextVNode(c));
1506-
}
1507-
} else if (c instanceof VNode) {
1508-
if (c.text && last && last.text) {
1509-
last.text += c.text;
1510-
} else {
1511-
// inherit parent namespace
1512-
if (ns) {
1513-
applyNS(c, ns);
1514-
}
1515-
// default key for nested array children (likely generated by v-for)
1516-
if (c.tag && c.key == null && nestedIndex != null) {
1517-
c.key = "__vlist_" + nestedIndex + "_" + i + "__";
1518-
}
1519-
res.push(c);
1520-
}
1521-
}
1522-
}
1523-
return res
1524-
}
1525-
}
1526-
1527-
function createTextVNode (val) {
1528-
return new VNode(undefined, undefined, undefined, String(val))
1529-
}
1530-
1531-
function applyNS (vnode, ns) {
1532-
if (vnode.tag && !vnode.ns) {
1533-
vnode.ns = ns;
1534-
if (vnode.children) {
1535-
for (var i = 0, l = vnode.children.length; i < l; i++) {
1536-
applyNS(vnode.children[i], ns);
1537-
}
1538-
}
1539-
}
1540-
}
1541-
1542-
function getFirstComponentChild (children) {
1543-
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
1544-
}
1545-
1546-
function mergeVNodeHook (def$$1, hookKey, hook, key) {
1484+
function mergeVNodeHook (def, hookKey, hook, key) {
15471485
key = key + hookKey;
1548-
var injectedHash = def$$1.__injected || (def$$1.__injected = {});
1486+
var injectedHash = def.__injected || (def.__injected = {});
15491487
if (!injectedHash[key]) {
15501488
injectedHash[key] = true;
1551-
var oldHook = def$$1[hookKey];
1489+
var oldHook = def[hookKey];
15521490
if (oldHook) {
1553-
def$$1[hookKey] = function () {
1491+
def[hookKey] = function () {
15541492
oldHook.apply(this, arguments);
15551493
hook.apply(this, arguments);
15561494
};
15571495
} else {
1558-
def$$1[hookKey] = hook;
1496+
def[hookKey] = hook;
15591497
}
15601498
}
15611499
}
15621500

1501+
/* */
1502+
15631503
function updateListeners (
15641504
on,
15651505
oldOn,
@@ -1629,6 +1569,72 @@ function fnInvoker (o) {
16291569

16301570
/* */
16311571

1572+
function normalizeChildren (
1573+
children,
1574+
ns,
1575+
nestedIndex
1576+
) {
1577+
if (isPrimitive(children)) {
1578+
return [createTextVNode(children)]
1579+
}
1580+
if (Array.isArray(children)) {
1581+
var res = [];
1582+
for (var i = 0, l = children.length; i < l; i++) {
1583+
var c = children[i];
1584+
var last = res[res.length - 1];
1585+
// nested
1586+
if (Array.isArray(c)) {
1587+
res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
1588+
} else if (isPrimitive(c)) {
1589+
if (last && last.text) {
1590+
last.text += String(c);
1591+
} else if (c !== '') {
1592+
// convert primitive to vnode
1593+
res.push(createTextVNode(c));
1594+
}
1595+
} else if (c instanceof VNode) {
1596+
if (c.text && last && last.text) {
1597+
last.text += c.text;
1598+
} else {
1599+
// inherit parent namespace
1600+
if (ns) {
1601+
applyNS(c, ns);
1602+
}
1603+
// default key for nested array children (likely generated by v-for)
1604+
if (c.tag && c.key == null && nestedIndex != null) {
1605+
c.key = "__vlist" + nestedIndex + "_" + i + "__";
1606+
}
1607+
res.push(c);
1608+
}
1609+
}
1610+
}
1611+
return res
1612+
}
1613+
}
1614+
1615+
function createTextVNode (val) {
1616+
return new VNode(undefined, undefined, undefined, String(val))
1617+
}
1618+
1619+
function applyNS (vnode, ns) {
1620+
if (vnode.tag && !vnode.ns) {
1621+
vnode.ns = ns;
1622+
if (vnode.children) {
1623+
for (var i = 0, l = vnode.children.length; i < l; i++) {
1624+
applyNS(vnode.children[i], ns);
1625+
}
1626+
}
1627+
}
1628+
}
1629+
1630+
/* */
1631+
1632+
function getFirstComponentChild (children) {
1633+
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
1634+
}
1635+
1636+
/* */
1637+
16321638
var activeInstance = null;
16331639

16341640
function initLifecycle (vm) {
@@ -1810,6 +1816,8 @@ function lifecycleMixin (Vue) {
18101816
if (vm.$el) {
18111817
vm.$el.__vue__ = null;
18121818
}
1819+
// invoke destroy hooks on current rendered tree
1820+
vm.__patch__(vm._vnode, null);
18131821
};
18141822
}
18151823

@@ -1930,9 +1938,11 @@ function createFunctionalComponent (
19301938
slots: function () { return resolveSlots(children, context); }
19311939
}
19321940
);
1933-
vnode.functionalContext = context;
1934-
if (data.slot) {
1935-
(vnode.data || (vnode.data = {})).slot = data.slot;
1941+
if (vnode instanceof VNode) {
1942+
vnode.functionalContext = context;
1943+
if (data.slot) {
1944+
(vnode.data || (vnode.data = {})).slot = data.slot;
1945+
}
19361946
}
19371947
return vnode
19381948
}
@@ -3370,7 +3380,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', {
33703380
get: function () { return config._isServer; }
33713381
});
33723382

3373-
Vue$2.version = '2.0.2';
3383+
Vue$2.version = '2.0.3';
33743384

33753385
/* */
33763386

@@ -3928,12 +3938,6 @@ function createPatchFunction (backend) {
39283938
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
39293939
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
39303940
}
3931-
if (isDef(i = vnode.child) && (
3932-
!data.keepAlive ||
3933-
vnode.context._isBeingDestroyed
3934-
)) {
3935-
invokeDestroyHook(i._vnode);
3936-
}
39373941
if (isDef(i = vnode.children)) {
39383942
for (j = 0; j < vnode.children.length; ++j) {
39393943
invokeDestroyHook(vnode.children[j]);
@@ -4185,6 +4189,11 @@ function createPatchFunction (backend) {
41854189
}
41864190

41874191
return function patch (oldVnode, vnode, hydrating, removeOnly) {
4192+
if (!vnode) {
4193+
if (oldVnode) { invokeDestroyHook(oldVnode); }
4194+
return
4195+
}
4196+
41884197
var elm, parent;
41894198
var isInitialPatch = false;
41904199
var insertedVnodeQueue = [];
@@ -4342,23 +4351,17 @@ function normalizeDirectives$1 (
43424351
var i, dir;
43434352
for (i = 0; i < dirs.length; i++) {
43444353
dir = dirs[i];
4345-
res[getRawDirName(dir)] = dir;
43464354
if (!dir.modifiers) {
43474355
dir.modifiers = emptyModifiers;
43484356
}
4357+
res[getRawDirName(dir)] = dir;
43494358
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
43504359
}
43514360
return res
43524361
}
43534362

43544363
function getRawDirName (dir) {
4355-
return dir.rawName || (
4356-
dir.name + (
4357-
dir.modifiers
4358-
? '.' + Object.keys(dir.modifiers).join('.')
4359-
: ''
4360-
)
4361-
)
4364+
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
43624365
}
43634366

43644367
function callHook$1 (dir, hook, vnode, oldVnode) {
@@ -5098,7 +5101,10 @@ var model = {
50985101
if (isIE || isEdge) {
50995102
setTimeout(cb, 0);
51005103
}
5101-
} else if (vnode.tag === 'textarea' || el.type === 'text') {
5104+
} else if (
5105+
(vnode.tag === 'textarea' || el.type === 'text') &&
5106+
!binding.modifiers.lazy
5107+
) {
51025108
if (!isAndroid) {
51035109
el.addEventListener('compositionstart', onCompositionStart);
51045110
el.addEventListener('compositionend', onCompositionEnd);
@@ -5118,7 +5124,7 @@ var model = {
51185124
// option in the DOM.
51195125
var needReset = el.multiple
51205126
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
5121-
: hasNoMatchingOption(binding.value, el.options);
5127+
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
51225128
if (needReset) {
51235129
trigger(el, 'change');
51245130
}

0 commit comments

Comments
 (0)