Skip to content

Commit 8a2a7f3

Browse files
committed
fix content transclusion with replace:true + block instance
1 parent ae90de0 commit 8a2a7f3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/compile/transclude.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function transcludeTemplate (el, options) {
4444
collectRawContent(el)
4545
if (options.replace) {
4646
if (frag.childNodes.length > 1) {
47-
transcludeContent(_.toArray(frag.childNodes))
47+
transcludeContent(frag)
4848
return frag
4949
} else {
5050
var replacer = frag.firstChild
@@ -133,7 +133,7 @@ var concat = [].concat
133133
function getOutlets (el) {
134134
return _.isArray(el)
135135
? concat.apply([], el.map(getOutlets))
136-
: el.nodeType === 1
136+
: el.querySelectorAll
137137
? _.toArray(el.querySelectorAll('content'))
138138
: []
139139
}

test/unit/specs/compile/transclude_spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ if (_.inBrowser) {
8787
it('block instance content transclusion', function () {
8888
el.innerHTML = '<p>hi</p><span>ho</span>'
8989
options.template = '<div></div><content select="p"></content><content select="span"></content>'
90+
options.replace = true
9091
var res = transclude(el, options)
9192
expect(res.firstChild.tagName).toBe('DIV')
9293
expect(res.childNodes[1].tagName).toBe('P')

0 commit comments

Comments
 (0)