Skip to content

Commit

Permalink
FIXED mootools#31 -- Skip the QSA override when !contextIsDocument an…
Browse files Browse the repository at this point in the history
…d 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
subtleGradient committed Mar 26, 2011
1 parent 30df972 commit fec5d10
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Source/Slick.Finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit fec5d10

Please sign in to comment.