From 582edd5e62253738d68ac9f092e0ed6571774b89 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sat, 8 Apr 2017 10:40:38 -0400 Subject: [PATCH] fix #2519 --- src/js/scriptlets/element-picker.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/js/scriptlets/element-picker.js b/src/js/scriptlets/element-picker.js index 6d43a6df3..9c14dfb2f 100644 --- a/src/js/scriptlets/element-picker.js +++ b/src/js/scriptlets/element-picker.js @@ -1061,6 +1061,15 @@ var candidateFromFilterChoice = function(filterChoice) { } joiner = ' > '; } + + // https://github.com/gorhill/uBlock/issues/2519 + if ( + slot === filters.length && + document.querySelectorAll(selector).length > 1 + ) { + selector = 'body > ' + selector; + } + return '##' + selector; };