Skip to content

Commit 5367599

Browse files
committed
fix: prevent * from highlighting the whole page
1 parent f92e15c commit 5367599

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,17 @@ function RemoteFunctions(config = {}) {
755755
*/
756756
function highlightRule(rule) {
757757
hideHighlight();
758+
759+
// Filter out the universal selector (*) from the rule - highlighting everything
760+
// is not useful, similar to how we skip html/body in isElementInspectable.
761+
// The rule can be a comma-separated list of selectors (from multi-cursor),
762+
// so we filter out any standalone * segments and keep valid ones.
763+
rule = rule.split(",").map(s => s.trim()).filter(s => s !== "*").join(",");
764+
if (!rule) {
765+
dismissUIAndCleanupState();
766+
return;
767+
}
768+
758769
const nodes = window.document.querySelectorAll(rule);
759770

760771
// Highlight all matching nodes

0 commit comments

Comments
 (0)