Browse files

FIXED #31 -- Skip the QSA override when !contextIsDocument and there …

…are multiple expressions in the selector since we currently only fix non-document rooted QSA for single expression selectors OR the expression begins with a + or ~ combinator since non-document rooted QSA can't access nodes that aren't descendants of the context
  • Loading branch information...
1 parent 30df972 commit fec5d1024e40dc8fa7ecceedc6f093ec14ffd29c @subtleGradient subtleGradient committed Mar 26, 2011
Showing with 16 additions and 3 deletions.
  1. +16 −3 Source/Slick.Finder.js
View
19 Source/Slick.Finder.js
@@ -329,9 +329,22 @@ local.search = function(context, expression, append, first){
/*<query-selector-override>*/
querySelector: if (context.querySelectorAll) {
- if (!this.isHTMLDocument || this.brokenMixedCaseQSA || qsaFailExpCache[expression] ||
- (this.brokenCheckedQSA && expression.indexOf(':checked') > -1) ||
- (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) || Slick.disableQSA) break querySelector;
+ if (!this.isHTMLDocument
+ || qsaFailExpCache[expression]
+ //TODO: only skip when expression is actually mixed case
+ || this.brokenMixedCaseQSA
+ || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
+ || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
+ || (!contextIsDocument && (//Abort when !contextIsDocument and...
+ // there are multiple expressions in the selector
+ // since we currently only fix non-document rooted QSA for single expression selectors
+ expression.indexOf(',') > -1
+ // and the expression begins with a + or ~ combinator
+ // since non-document rooted QSA can't access nodes that aren't descendants of the context
+ || (/\s*[~+]/).test(expression)
+ ))
+ || Slick.disableQSA
+ ) break querySelector;
var _expression = expression;
if (!contextIsDocument){

0 comments on commit fec5d10

Please sign in to comment.