Issue #7 resolved

hierarchy selectors not working for 'not_'

Elijah Rutschman
created an issue

{{{

!python

html = """<html> <body> <ul> <li>C</li> <li>D</li> </ul> <div> <ul> <li>E</li> <li>F</li> </ul> </div> </body> </html>"""

import pyquery q = pyquery.PyQuery(html) ul = q.find('ul').not_('div > ul')

print ul

<ul><li>C</li><li>D</li></ul><ul><li>E</li><li>F</li></ul>

should be printing:

<ul><li>C</li><li>D</li></ul>

}}}

Comments (3)

  1. Elijah Rutschman reporter
    print ul.eq(1).is_('div > ul')
    # False
    # should print:
    # True
    

    The scope of this bug is larger than the not_ method; the selected elements' context is lost, so that any further filtering on a PyQuery object cannot be done using selectors that reference parent elements.

  2. Log in to comment