Skip to content

Commit 3ad68b9

Browse files
committed
[build] 2.0.0
1 parent 89adabf commit 3ad68b9

File tree

8 files changed

+348
-295
lines changed

8 files changed

+348
-295
lines changed

dist/vue.common.js

Lines changed: 123 additions & 110 deletions
Large diffs are not rendered by default.

dist/vue.js

Lines changed: 169 additions & 155 deletions
Large diffs are not rendered by default.

dist/vue.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue-server-renderer/build.js

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,13 @@ var nextTick = (function () {
415415
// "force" the microtask queue to be flushed by adding an empty timer.
416416
if (isIOS) { setTimeout(noop) }
417417
}
418-
} else if (typeof MutationObserver !== 'undefined' && isNative(MutationObserver)) {
418+
} else if (typeof MutationObserver !== 'undefined' && (
419+
isNative(MutationObserver) ||
420+
// PhantomJS and iOS 7.x
421+
MutationObserver.toString() === '[object MutationObserverConstructor]'
422+
)) {
419423
// use MutationObserver where native Promise is not available,
420-
// e.g. IE11, iOS7, Android 4.4
424+
// e.g. PhantomJS IE11, iOS7, Android 4.4
421425
var counter = 1
422426
var observer = new MutationObserver(nextTickHandler)
423427
var textNode = document.createTextNode(String(counter))
@@ -1652,7 +1656,7 @@ function normalizeChildren (
16521656
applyNS(c, ns)
16531657
}
16541658
// default key for nested array children (likely generated by v-for)
1655-
if (c.key == null && nestedIndex != null) {
1659+
if (c.tag && c.key == null && nestedIndex != null) {
16561660
c.key = "__vlist_" + nestedIndex + "_" + i + "__"
16571661
}
16581662
res.push(c)
@@ -1884,7 +1888,7 @@ function lifecycleMixin (Vue) {
18841888
}
18851889
// resolve slots + force update if has children
18861890
if (hasChildren) {
1887-
vm$$1.$slots = resolveSlots(renderChildren)
1891+
vm$$1.$slots = resolveSlots(renderChildren, vm$$1._renderContext)
18881892
vm$$1.$forceUpdate()
18891893
}
18901894
}
@@ -2039,13 +2043,15 @@ function createFunctionalComponent (
20392043
}
20402044
return Ctor.options.render.call(
20412045
null,
2042-
context.$createElement,
2046+
// ensure the createElement function in functional components
2047+
// gets a unique context - this is necessary for correct named slot check
2048+
bind(createElement, { _self: Object.create(context) }),
20432049
{
20442050
props: props,
20452051
data: data,
20462052
parent: context,
20472053
children: normalizeChildren(children),
2048-
slots: function () { return resolveSlots(children); }
2054+
slots: function () { return resolveSlots(children, context); }
20492055
}
20502056
)
20512057
}
@@ -2300,7 +2306,8 @@ function initRender (vm$$1) {
23002306
vm$$1.$vnode = null // the placeholder node in parent tree
23012307
vm$$1._vnode = null // the root of the child tree
23022308
vm$$1._staticTrees = null
2303-
vm$$1.$slots = resolveSlots(vm$$1.$options._renderChildren)
2309+
vm$$1._renderContext = vm$$1.$options._parentVnode && vm$$1.$options._parentVnode.context
2310+
vm$$1.$slots = resolveSlots(vm$$1.$options._renderChildren, vm$$1._renderContext)
23042311
// bind the public createElement fn to this instance
23052312
// so that we get proper render context inside it.
23062313
vm$$1.$createElement = bind(createElement, vm$$1)
@@ -2500,7 +2507,8 @@ function renderMixin (Vue) {
25002507
}
25012508

25022509
function resolveSlots (
2503-
renderChildren
2510+
renderChildren,
2511+
context
25042512
) {
25052513
var slots = {}
25062514
if (!renderChildren) {
@@ -2511,8 +2519,10 @@ function resolveSlots (
25112519
var name, child
25122520
for (var i = 0, l = children.length; i < l; i++) {
25132521
child = children[i]
2514-
if (child.data && (name = child.data.slot)) {
2515-
delete child.data.slot
2522+
// named slots should only be respected if the vnode was rendered in the
2523+
// same context.
2524+
if (child.context === context &&
2525+
child.data && (name = child.data.slot)) {
25162526
var slot = (slots[name] || (slots[name] = []))
25172527
if (child.tag === 'template') {
25182528
slot.push.apply(slot, child.children)
@@ -3986,12 +3996,12 @@ function parse (
39863996
processFor(element)
39873997
processIf(element)
39883998
processOnce(element)
3999+
processKey(element)
39894000

39904001
// determine whether this is a plain element after
39914002
// removing structural attributes
39924003
element.plain = !element.key && !attrs.length
39934004

3994-
processKey(element)
39954005
processRef(element)
39964006
processSlot(element)
39974007
processComponent(element)
@@ -4129,6 +4139,9 @@ function processRawAttrs (el) {
41294139
function processKey (el) {
41304140
var exp = getBindingAttr(el, 'key')
41314141
if (exp) {
4142+
if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
4143+
warn$1("<template> cannot be keyed. Place the key on real elements instead.")
4144+
}
41324145
el.key = exp
41334146
}
41344147
}
@@ -4587,7 +4600,7 @@ function genFor (el) {
45874600
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''
45884601
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''
45894602
el.forProcessed = true // avoid recursion
4590-
return "(" + exp + ")&&_l((" + exp + ")," +
4603+
return "_l((" + exp + ")," +
45914604
"function(" + alias + iterator1 + iterator2 + "){" +
45924605
"return " + (genElement(el)) +
45934606
'})'

packages/vue-server-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-server-renderer",
3-
"version": "2.0.0-rc.8",
3+
"version": "2.0.0",
44
"description": "server renderer for Vue 2.0",
55
"main": "index.js",
66
"repository": {

packages/vue-template-compiler/build.js

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,13 @@ var nextTick = (function () {
289289
// "force" the microtask queue to be flushed by adding an empty timer.
290290
if (isIOS) { setTimeout(noop) }
291291
}
292-
} else if (typeof MutationObserver !== 'undefined' && isNative(MutationObserver)) {
292+
} else if (typeof MutationObserver !== 'undefined' && (
293+
isNative(MutationObserver) ||
294+
// PhantomJS and iOS 7.x
295+
MutationObserver.toString() === '[object MutationObserverConstructor]'
296+
)) {
293297
// use MutationObserver where native Promise is not available,
294-
// e.g. IE11, iOS7, Android 4.4
298+
// e.g. PhantomJS IE11, iOS7, Android 4.4
295299
var counter = 1
296300
var observer = new MutationObserver(nextTickHandler)
297301
var textNode = document.createTextNode(String(counter))
@@ -1526,7 +1530,7 @@ function normalizeChildren (
15261530
applyNS(c, ns)
15271531
}
15281532
// default key for nested array children (likely generated by v-for)
1529-
if (c.key == null && nestedIndex != null) {
1533+
if (c.tag && c.key == null && nestedIndex != null) {
15301534
c.key = "__vlist_" + nestedIndex + "_" + i + "__"
15311535
}
15321536
res.push(c)
@@ -1758,7 +1762,7 @@ function lifecycleMixin (Vue) {
17581762
}
17591763
// resolve slots + force update if has children
17601764
if (hasChildren) {
1761-
vm.$slots = resolveSlots(renderChildren)
1765+
vm.$slots = resolveSlots(renderChildren, vm._renderContext)
17621766
vm.$forceUpdate()
17631767
}
17641768
}
@@ -1913,13 +1917,15 @@ function createFunctionalComponent (
19131917
}
19141918
return Ctor.options.render.call(
19151919
null,
1916-
context.$createElement,
1920+
// ensure the createElement function in functional components
1921+
// gets a unique context - this is necessary for correct named slot check
1922+
bind(createElement, { _self: Object.create(context) }),
19171923
{
19181924
props: props,
19191925
data: data,
19201926
parent: context,
19211927
children: normalizeChildren(children),
1922-
slots: function () { return resolveSlots(children); }
1928+
slots: function () { return resolveSlots(children, context); }
19231929
}
19241930
)
19251931
}
@@ -2174,7 +2180,8 @@ function initRender (vm) {
21742180
vm.$vnode = null // the placeholder node in parent tree
21752181
vm._vnode = null // the root of the child tree
21762182
vm._staticTrees = null
2177-
vm.$slots = resolveSlots(vm.$options._renderChildren)
2183+
vm._renderContext = vm.$options._parentVnode && vm.$options._parentVnode.context
2184+
vm.$slots = resolveSlots(vm.$options._renderChildren, vm._renderContext)
21782185
// bind the public createElement fn to this instance
21792186
// so that we get proper render context inside it.
21802187
vm.$createElement = bind(createElement, vm)
@@ -2374,7 +2381,8 @@ function renderMixin (Vue) {
23742381
}
23752382

23762383
function resolveSlots (
2377-
renderChildren
2384+
renderChildren,
2385+
context
23782386
) {
23792387
var slots = {}
23802388
if (!renderChildren) {
@@ -2385,8 +2393,10 @@ function resolveSlots (
23852393
var name, child
23862394
for (var i = 0, l = children.length; i < l; i++) {
23872395
child = children[i]
2388-
if (child.data && (name = child.data.slot)) {
2389-
delete child.data.slot
2396+
// named slots should only be respected if the vnode was rendered in the
2397+
// same context.
2398+
if (child.context === context &&
2399+
child.data && (name = child.data.slot)) {
23902400
var slot = (slots[name] || (slots[name] = []))
23912401
if (child.tag === 'template') {
23922402
slot.push.apply(slot, child.children)
@@ -3825,12 +3835,12 @@ function parse (
38253835
processFor(element)
38263836
processIf(element)
38273837
processOnce(element)
3838+
processKey(element)
38283839

38293840
// determine whether this is a plain element after
38303841
// removing structural attributes
38313842
element.plain = !element.key && !attrs.length
38323843

3833-
processKey(element)
38343844
processRef(element)
38353845
processSlot(element)
38363846
processComponent(element)
@@ -3968,6 +3978,9 @@ function processRawAttrs (el) {
39683978
function processKey (el) {
39693979
var exp = getBindingAttr(el, 'key')
39703980
if (exp) {
3981+
if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
3982+
warn$1("<template> cannot be keyed. Place the key on real elements instead.")
3983+
}
39713984
el.key = exp
39723985
}
39733986
}
@@ -4426,7 +4439,7 @@ function genFor (el) {
44264439
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''
44274440
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''
44284441
el.forProcessed = true // avoid recursion
4429-
return "(" + exp + ")&&_l((" + exp + ")," +
4442+
return "_l((" + exp + ")," +
44304443
"function(" + alias + iterator1 + iterator2 + "){" +
44314444
"return " + (genElement(el)) +
44324445
'})'

packages/vue-template-compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-template-compiler",
3-
"version": "2.0.0-rc.8",
3+
"version": "2.0.0",
44
"description": "template compiler for Vue 2.0",
55
"main": "index.js",
66
"repository": {

src/core/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Object.defineProperty(Vue.prototype, '$isServer', {
88
get: () => config._isServer
99
})
1010

11-
Vue.version = '2.0.0-rc.8'
11+
Vue.version = '2.0.0'
1212

1313
export default Vue

0 commit comments

Comments
 (0)