aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/selector.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/selector.js b/src/selector.js
index ea7a7b591..badb3dd6c 100644
--- a/src/selector.js
+++ b/src/selector.js
@@ -226,8 +226,11 @@ function find( selector, context, results, seed ) {
// descendant combinators, which is not what we want.
// In such cases, we work around the behavior by prefixing every selector in the
// list with an ID selector referencing the scope context.
+ // The technique has to be used as well when a leading combinator is used
+ // as such selectors are not recognized by querySelectorAll.
// Thanks to Andrew Dupont for this technique.
- if ( nodeType === 1 && rdescend.test( selector ) ) {
+ if ( nodeType === 1 &&
+ ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
// Expand context for sibling selectors
newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||