Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 60a1a21

Browse files
committed
feat(testability): findBindings and findModels should descend into the ShadowDOM
Note that this won't work for you unless you have a chromedriver build that works with the shadow DOM.
1 parent 75d4064 commit 60a1a21

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/introspection.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ ElementProbe _findProbeWalkingUp(dom.Node node, [dom.Node ascendUntil]) {
2828
while (node != null && node != ascendUntil) {
2929
var probe = elementExpando[node];
3030
if (probe != null) return probe;
31-
node = node.parent;
31+
if (node is dom.ShadowRoot) {
32+
node = (node as dom.ShadowRoot).host;
33+
} else {
34+
node = node.parentNode;
35+
}
3236
}
3337
return null;
3438
}
@@ -40,6 +44,14 @@ _walkProbesInTree(dom.Node node, Function walker) {
4044
for (var child in node.childNodes) {
4145
_walkProbesInTree(child, walker);
4246
}
47+
if (node is dom.Element) {
48+
var shadowRoot = (node as dom.Element).shadowRoot;
49+
if (shadowRoot != null) {
50+
for (var child in shadowRoot.childNodes) {
51+
_walkProbesInTree(child, walker);
52+
}
53+
}
54+
}
4355
}
4456
}
4557

0 commit comments

Comments
 (0)