Skip to content

Commit 43be6d4

Browse files
author
Avaer Kazmer
committed
Bugfix deep id key path set states
1 parent 7b7410e commit 43be6d4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,25 @@
142142
el = el.childNodes[key] || null;
143143
} else if (typeof key === 'string' && (match = key.match(/^#(.+)$/))) {
144144
const id = match[1];
145-
el = el.childNodes.find(childEl => Array.prototype.some.call(childEl.attributes, attr => attr.name === 'id' && attr.value === id)) || null;
145+
const matchEl = Array.from(el.childNodes).find(childEl => childEl.id === id) || null;
146+
if (matchEl) {
147+
el = matchEl;
148+
} else {
149+
const _findRecursive = el => {
150+
const xrIframes = el.querySelectorAll('xr-iframe');
151+
for (let i = 0; i < xrIframes.length; i++) {
152+
const xrIframe = xrIframes[i];
153+
if (xrIframe.id === id) {
154+
return xrIframe;
155+
} else if (xrIframe.loaded) {
156+
return _findRecursive(xrIframe.contentWindow.iframe.contentDocument);
157+
} else {
158+
return null;
159+
}
160+
}
161+
};
162+
return _findRecursive(el);
163+
}
146164
} else {
147165
el = null;
148166
}

0 commit comments

Comments
 (0)