Created attachment 18074[details]
In-progress patch
There are quite a few issues with this patch, so I'm not requesting review yet. It leaks memory, uses NodeList instead of StaticNodeList, and doesn't implement the functions other than querySelectorAll. Other than that it appears to work nicely, though :)

Adding a link to a version of Dean Edward's tests for his cssQuery function modified to tolerate exceptions and use querySelector/querySelectorAll instead of cssQuery. With the latest patch we pass for all selectors WebKit supports.

Created attachment 18098[details]
Fixes selectors with commas
Previously things like a, b { } would fail, since we weren't checking all the selectors. There are now no test failures on the slickspeed test, except those due to webkit not supporting the relevant selector.

Created attachment 18103[details]
Handle null and undefined according to the spec
This also makes it so that if you put in syntactically valid CSS that is not a selector, it throws a syntax error as it should (for example: "@font-face").

Ken Ferry points out that although the CSS spec does define an empty selector as invalid, it's possibly a reasonable interpretation to say that null/undefined are just not selectors at all, valid or invalid. I think we should probably get this clarified. I'm also not convinced that throwing is the best behavior for the spec to dictate in this situation, but that's another matter.