Permalink
Browse files

Updating slick's version and making a clone of the parsed expression …

…so we can change the cache and it will still work fine.
  • Loading branch information...
fabiomcosta authored and cpojer committed Oct 15, 2010
1 parent 6b2f770 commit 7248d8374f5baf650c9e5fab88b500dcfcb63427
Showing with 5 additions and 4 deletions.
  1. +1 −1 Source/Element/Element.js
  2. +2 −2 Source/Slick/Slick.Finder.js
  3. +2 −1 Source/Slick/Slick.Parser.js
@@ -451,7 +451,7 @@ Object.each(inserters, function(inserter, where){
var injectCombinator = function(expression, combinator){
if (!expression) return combinator;
- expression = Slick.parse(expression);
+ expression = Object.clone(Slick.parse(expression));
var expressions = expression.expressions;
for (var i = expressions.length; i--;)
@@ -614,11 +614,11 @@ var pseudos = {
return this['pseudo:nth-child'](node, '' + index + 1);
},
- 'even': function(node, argument){
+ 'even': function(node){
return this['pseudo:nth-child'](node, '2n');
},
- 'odd': function(node, argument){
+ 'odd': function(node){
return this['pseudo:nth-child'](node, '2n+1');
},
@@ -27,9 +27,10 @@ var parse = function(expression, isReversed){
return parse(this.raw, true);
}};
separatorIndex = -1;
+ var cacheKey = expression;
while (expression != (expression = expression.replace(regexp, parser)));
parsed.length = parsed.expressions.length;
- return currentCache[expression] = (reversed) ? reverse(parsed) : parsed;
+ return currentCache[cacheKey] = (reversed) ? reverse(parsed) : parsed;
};
var reverseCombinator = function(combinator){

0 comments on commit 7248d83

Please sign in to comment.