Skip to content

Commit 5d9126f

Browse files
committed
make jshint pass + minor adjustments for vuejs#787
1 parent 9099bd6 commit 5d9126f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/compiler/transclude.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ function transcludeContent (el, raw) {
7979
var i = outlets.length
8080
if (!i) return
8181
var outlet, select, selected, j, main
82+
83+
function isDirectChild (node) {
84+
return node.parentNode === raw
85+
}
86+
8287
// first pass, collect corresponding content
8388
// for each outlet.
8489
while (i--) {
@@ -88,9 +93,10 @@ function transcludeContent (el, raw) {
8893
if (select) { // select content
8994
selected = raw.querySelectorAll(select)
9095
if (selected.length) {
91-
selected = _.toArray(selected).filter(function(node) {
92-
return node.parentNode === raw
93-
})
96+
// according to Shadow DOM spec, `select` can
97+
// only select direct children of the host node.
98+
// enforcing this also fixes #786.
99+
selected = [].filter.call(selected, isDirectChild)
94100
}
95101
outlet.content = selected.length
96102
? selected

0 commit comments

Comments
 (0)