[code review] Inprogress css selector

Brains are a bit frazzled at the moment Paul.

First off I see what you’re saying if(!results.indexOf(el)) push or whatever. How that fits into the recursive side of things I’m not sure. results is a new array for each recurssive call. Will have to give it some thought.

Would have thought if it was that easy Resig would have possibly explained that? The function I see being used in sizzle is unique.sort. Never know though.

Re nth-child. See table 1 last column
Understanding :nth-child Pseudo-class Expressions

That’s basically what I worked through step by step.

-n+offset. essentially the offset is the starting point and it works backwords.

so -2n+10 would be something like 10 8 6 4 2. without the - it would loop to the other end of the collection 10 12 14… I’m guessing if you wanted to use one loop then the offset could become the length variable instead for -.

As I have commented I might overhaul that method so that it returns a boolean instead.

YUI has implemented it that way. It takes an element, then calls a get siblings function which returns it’s siblings. It then loops through the lot and compares if the supplied node matches a valid position.

It’s more leg work in that it involves about 4* the function calls compared to the way I’ve done it, but it does fit in nicely with first-child, last-child etc. One pseudo function call fits all.