Issue #8 resolved

returns duplicates if context is a PyQuery object

Antti Kaihola
created an issue

Consider this example:



doc = PyQuery('<div><div><p/></div></div>') doc('div p') [<p>] divs = doc('div') divs.class <class 'pyquery.pyquery.PyQuery'> doc('p', divs) [<p>, <p>] }}}

If the context {{{divs}}} was a plain sequence of elements, this would be unavoidable.

But since {{{divs}}} is a {{{PyQuery}}} object, we could modify the code to preserve its selector ("{{{div}}}") and extend it with the filtering selector ("{{{p}}}").

The selector {{{div p}}} would be executed by lxml, and no duplicates would be returned.