We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 504cb64 commit 9103f83Copy full SHA for 9103f83
app.html
@@ -136,9 +136,17 @@
136
}
137
function _findElByKeyPath(el, keyPath) {
138
for (let i = 0; i < keyPath.length; i++) {
139
- el = el.childNodes[keyPath[i]];
140
- if (!el) {
+ const key = keyPath[i];
+ let match;
141
+ if (typeof key === 'number') {
142
+ el = el.childNodes[key] || null;
143
+ } else if (typeof key === 'string' && (match = key.match(/^#(.+)$/))) {
144
+ const id = match[1];
145
+ el = el.childNodes.find(childEl => Array.prototype.some.call(childEl.attributes, attr => attr.name === 'id' && attr.value === id)) || null;
146
+ } else {
147
el = null;
148
+ }
149
+ if (!el) {
150
break;
151
152
0 commit comments