Hi Aaron,
I saw that you added support for the :has selector. Thanks! It seems
to work :-)
I have been busy too. Since I am not too familiar with the Nokogiri
code I started with a JQuery-Nokogiri compatibility testsuite to see
what needs to be done.
If you run the following commands:
git clone git://
github.com/jeroenvandijk/nokogiri_jquery.git
cd nokogiri_jquery
script/server -e cucumber
cucumber
You should be able to see the differences between JQuery and Nokogiri
selectors. It runs JQuery 1.3.2 through HtmlUnit and compares it with
the result of Nokogiri.
I think it would be nice to have at least resolved:
- support for nested selectors in the :not selector, similar to :has
(I think I'm able to do this with your :has example)
- support for :odd, :even, :lt, :empty, :hidden, :visible and the
others I have not yet specified in the feature (I can do this)
The testsuite also indicated some incompatibilities that are more
subtle:
- :eq, :gt, use a different index than JQuery. Nokogiri's index goes
from 1 to n while JQuery goes from 0 to n
- :last seems to be tricked by nested elements i.e. it return the last
element from a nested element instead of the last element in the
document
- li[name!='some value'] only returns something when there is a li
with an name other than 'some value'. JQuery also returns elements
that have no name attribute at all
I couldn't find a CSS3 specification that tells me whether either
JQuery or Nokogiri is wrong. What do you think?
Cheers, Jeroen