Skip to content

Commit

Permalink
[build] 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Oct 13, 2016
1 parent 3f8fa43 commit 1e6a8f5
Show file tree
Hide file tree
Showing 8 changed files with 435 additions and 402 deletions.
182 changes: 94 additions & 88 deletions dist/vue.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Vue.js v2.0.2
* Vue.js v2.0.3
* (c) 2014-2016 Evan You
* Released under the MIT License.
*/
Expand Down Expand Up @@ -1481,85 +1481,25 @@ function cloneVNodes (vnodes) {

/* */

function normalizeChildren (
children,
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
}
if (Array.isArray(children)) {
var res = [];
for (var i = 0, l = children.length; i < l; i++) {
var c = children[i];
var last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns, i));
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else if (c instanceof VNode) {
if (c.text && last && last.text) {
last.text += c.text;
} else {
// inherit parent namespace
if (ns) {
applyNS(c, ns);
}
// default key for nested array children (likely generated by v-for)
if (c.tag && c.key == null && nestedIndex != null) {
c.key = "__vlist_" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
}

function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}

function applyNS (vnode, ns) {
if (vnode.tag && !vnode.ns) {
vnode.ns = ns;
if (vnode.children) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
applyNS(vnode.children[i], ns);
}
}
}
}

function getFirstComponentChild (children) {
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
}

function mergeVNodeHook (def$$1, hookKey, hook, key) {
function mergeVNodeHook (def, hookKey, hook, key) {
key = key + hookKey;
var injectedHash = def$$1.__injected || (def$$1.__injected = {});
var injectedHash = def.__injected || (def.__injected = {});
if (!injectedHash[key]) {
injectedHash[key] = true;
var oldHook = def$$1[hookKey];
var oldHook = def[hookKey];
if (oldHook) {
def$$1[hookKey] = function () {
def[hookKey] = function () {
oldHook.apply(this, arguments);
hook.apply(this, arguments);
};
} else {
def$$1[hookKey] = hook;
def[hookKey] = hook;
}
}
}

/* */

function updateListeners (
on,
oldOn,
Expand Down Expand Up @@ -1629,6 +1569,72 @@ function fnInvoker (o) {

/* */

function normalizeChildren (
children,
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
}
if (Array.isArray(children)) {
var res = [];
for (var i = 0, l = children.length; i < l; i++) {
var c = children[i];
var last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else if (c instanceof VNode) {
if (c.text && last && last.text) {
last.text += c.text;
} else {
// inherit parent namespace
if (ns) {
applyNS(c, ns);
}
// default key for nested array children (likely generated by v-for)
if (c.tag && c.key == null && nestedIndex != null) {
c.key = "__vlist" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
}

function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}

function applyNS (vnode, ns) {
if (vnode.tag && !vnode.ns) {
vnode.ns = ns;
if (vnode.children) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
applyNS(vnode.children[i], ns);
}
}
}
}

/* */

function getFirstComponentChild (children) {
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
}

/* */

var activeInstance = null;

function initLifecycle (vm) {
Expand Down Expand Up @@ -1810,6 +1816,8 @@ function lifecycleMixin (Vue) {
if (vm.$el) {
vm.$el.__vue__ = null;
}
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null);
};
}

Expand Down Expand Up @@ -1930,9 +1938,11 @@ function createFunctionalComponent (
slots: function () { return resolveSlots(children, context); }
}
);
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
if (vnode instanceof VNode) {
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
}
Expand Down Expand Up @@ -3370,7 +3380,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', {
get: function () { return config._isServer; }
});

Vue$2.version = '2.0.2';
Vue$2.version = '2.0.3';

/* */

Expand Down Expand Up @@ -3928,12 +3938,6 @@ function createPatchFunction (backend) {
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
}
if (isDef(i = vnode.child) && (
!data.keepAlive ||
vnode.context._isBeingDestroyed
)) {
invokeDestroyHook(i._vnode);
}
if (isDef(i = vnode.children)) {
for (j = 0; j < vnode.children.length; ++j) {
invokeDestroyHook(vnode.children[j]);
Expand Down Expand Up @@ -4185,6 +4189,11 @@ function createPatchFunction (backend) {
}

return function patch (oldVnode, vnode, hydrating, removeOnly) {
if (!vnode) {
if (oldVnode) { invokeDestroyHook(oldVnode); }
return
}

var elm, parent;
var isInitialPatch = false;
var insertedVnodeQueue = [];
Expand Down Expand Up @@ -4342,23 +4351,17 @@ function normalizeDirectives$1 (
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
res[getRawDirName(dir)] = dir;
if (!dir.modifiers) {
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
return res
}

function getRawDirName (dir) {
return dir.rawName || (
dir.name + (
dir.modifiers
? '.' + Object.keys(dir.modifiers).join('.')
: ''
)
)
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}

function callHook$1 (dir, hook, vnode, oldVnode) {
Expand Down Expand Up @@ -5098,7 +5101,10 @@ var model = {
if (isIE || isEdge) {
setTimeout(cb, 0);
}
} else if (vnode.tag === 'textarea' || el.type === 'text') {
} else if (
(vnode.tag === 'textarea' || el.type === 'text') &&
!binding.modifiers.lazy
) {
if (!isAndroid) {
el.addEventListener('compositionstart', onCompositionStart);
el.addEventListener('compositionend', onCompositionEnd);
Expand All @@ -5118,7 +5124,7 @@ var model = {
// option in the DOM.
var needReset = el.multiple
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
: hasNoMatchingOption(binding.value, el.options);
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
if (needReset) {
trigger(el, 'change');
}
Expand Down
Loading

0 comments on commit 1e6a8f5

Please sign in to comment.