Skip to content

Commit

Permalink
Fix a loop if silliness
Browse files Browse the repository at this point in the history
  • Loading branch information
Inviz committed Nov 17, 2011
1 parent 146d565 commit 12e34f4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Source/Module/Ambient/Selectors.js
Expand Up @@ -166,30 +166,31 @@ for (var name in Combinators) Slick.defineCombinator(name, Combinators[name]);
var Pseudos = LSD.Module.Selectors.Pseudos = {
'first-of-class': function(klass){
var bits = ' ' + klass + ' ';
if ((' ' + this.className + ' ').indexOf(bits) == -1) return;
for (var node = this.previousSibling; node = node.previousSibling;)
if ((' ' + node.className + ' ').indexOf(bits) > -1)
if ((' ' + this.className + ' ').indexOf(bits) == -1) return false;
for (var node = this; node = node.previousSibling;)
if (node.nodeType == 1 && (' ' + node.className + ' ').indexOf(bits) > -1)
return false;
return true;
},

'last-of-class': function(klass){
var bits = ' ' + klass + ' ';
if ((' ' + this.className + ' ').indexOf(bits) == -1) return;
for (var node = this.nextSibling; node = node.nextSibling;)
if ((' ' + node.className + ' ').indexOf(bits) > -1)
if ((' ' + this.className + ' ').indexOf(bits) == -1) return false;
for (var node = this; node = node.nextSibling;)
if (node.nodeType == 1 && (' ' + node.className + ' ').indexOf(bits) > -1)
return false;

return true;
},

'only-of-class': function(klass){
var bits = ' ' + klass + ' ';
if ((' ' + this.className + ' ').indexOf(bits) == -1) return;
if ((' ' + this.className + ' ').indexOf(bits) == -1) return false;
for (var node = this; node = node.previousSibling;)
if ((' ' + node.className + ' ').indexOf(bits) > -1)
if (node.nodeType == 1 && (' ' + node.className + ' ').indexOf(bits) > -1)
return false;
for (var node = this; node = node.nextSibling;)
if ((' ' + node.className + ' ').indexOf(bits) > -1)
if (node.nodeType == 1 && (' ' + node.className + ' ').indexOf(bits) > -1)
return false;
return true;
}
Expand Down

0 comments on commit 12e34f4

Please sign in to comment.