Skip to content

Commit 5a1b815

Browse files
committed
fix(devtools): highlight matched element when writing queries manually
1 parent 690f071 commit 5a1b815

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

devtools/src/content-script/contentScript.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ function init() {
3939
});
4040

4141
if (data.highlight) {
42+
const selector = result.elements.map((x) => x.cssPath).join(', ');
43+
const nodes =
44+
result.elements.length > 0
45+
? Array.from(document.body.querySelectorAll(selector))
46+
: [];
47+
4248
hook.highlighter.highlight({
43-
nodes: (result.elements || []).map((x) => x.target),
44-
hideAfterTimeout: data.hideAfterTimeout,
49+
nodes,
50+
hideAfterTimeout: data.hideAfterTimeout ?? 1500,
4551
});
4652
}
4753

0 commit comments

Comments
 (0)