lxml/lxml — pull request #46 by SimonSapin (2012-04-20 19:25:08+00:00)
Title: External cssselect

This branch removes most of lxml.cssselect and uses the new cssselect project to provide the same functionality.

The new project distinguishes "generic" XML (no assumption is made on the meaning of element names) and HTML (has a more useful implementation of some pseudo-classes like `:link` or `:checked`.) This, the `CSSSelect` class as well as the `cssselect` method now have a `translator` argument that can be 'xml', 'html, 'xhtml', or a Translator object. (See the [documentation](http://packages.python.org/cssselect/).) The translator default to 'html' on HtmlElement.cssselect, 'xml' everywhere else.

The dependency is optional, so importing lxml.cssselect or calling the cssselect() method of elements can cause an ImportError at runtime.

I believe this fixes issues #34, #40, and #41.
#45 is partially addressed: all elements now have a `cssselect` method. However, html5parser still does not make HtmlElement objects so the user may need to pass `translator='html'` explicitly.
#20 is not resolved yet, but cssselect’s [#3](https://github.com/SimonSapin/cssselect/issues/3) is open about the same issue.

cssselect still has a few unresolved issues (filed on github), but the API should be stable now.