Skip to content

Commit ba9a836

Browse files
danieldiekmeieryyx990803
authored andcommitted
Fixes recognition of Root elements if they are in the shadow dom (vuejs#232)
1 parent 43c9072 commit ba9a836

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,18 @@ function scan () {
125125

126126
function walk (node, fn) {
127127
if (node.childNodes) {
128-
Array.prototype.forEach.call(node.childNodes, function (node) {
128+
node.childNodes.forEach(function (node) {
129+
const stop = fn(node)
130+
if (!stop) {
131+
walk(node, fn)
132+
}
133+
})
134+
}
135+
136+
// This code is duplicated because there doesn't seem to be
137+
// a reasonable way to concat NodeLists
138+
if (node.shadowRoot && node.shadowRoot.childNodes) {
139+
node.shadowRoot.childNodes.forEach(function (node) {
129140
const stop = fn(node)
130141
if (!stop) {
131142
walk(node, fn)

0 commit comments

Comments
 (0)