Skip to content

Commit 4257597

Browse files
committed
check for all elementDirectives for fragment instances
1 parent 31565cc commit 4257597

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/compiler/transclude.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ function transcludeTemplate (el, options) {
7070
frag.childNodes.length > 1 ||
7171
// non-element template
7272
replacer.nodeType !== 1 ||
73-
// when root node is <content>, <partial>, <component>
74-
// or has v-repeat, the instance could end up having
75-
// multiple top-level nodes, thus becoming a block
76-
// instance.
77-
tag === 'content' ||
78-
tag === 'partial' ||
73+
// when root node is <component>, is an element
74+
// directive, or has v-repeat, the instance could
75+
// end up having multiple top-level nodes, thus
76+
// becoming a block instance.
7977
tag === 'component' ||
78+
_.resolveAsset(options, 'elementDirectives', tag) ||
8079
replacer.hasAttribute(config.prefix + 'repeat')
8180
) {
8281
return frag

test/unit/specs/compiler/transclude_spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var transclude = require('../../../../src/compiler').transclude
2+
var Vue = require('../../../../src/vue')
23
var _ = require('../../../../src/util')
34

45
if (_.inBrowser) {
@@ -7,7 +8,7 @@ if (_.inBrowser) {
78
var el, options
89
beforeEach(function () {
910
el = document.createElement('div')
10-
options = {}
11+
options = _.extend({}, Vue.options)
1112
spyOn(_, 'warn')
1213
})
1314

@@ -75,4 +76,4 @@ if (_.inBrowser) {
7576
})
7677

7778
})
78-
}
79+
}

0 commit comments

Comments
 (0)