MCPcopy Create free account
hub / github.com/gawel/pyquery / xpath_empty_pseudo

Method xpath_empty_pseudo

pyquery/cssselectpatch.py:355–366  ·  view source on GitHub ↗

Match all elements that do not contain other elements:: >>> from pyquery import PyQuery >>> d = PyQuery(' title ') >>> d(':empty') [ ] ..

(self, xpath)

Source from the content-addressed store, hash-verified

353 return xpath
354
355 def xpath_empty_pseudo(self, xpath):
356 """Match all elements that do not contain other elements::
357
358 >>> from pyquery import PyQuery
359 >>> d = PyQuery('<div><h1><span>title</span></h1><h2/></div>')
360 >>> d(':empty')
361 [<h2>]
362
363 ..
364 """
365 xpath.add_condition("not(node())")
366 return xpath
367
368 def xpath_eq_function(self, xpath, function):
369 """Matches a single element by its index::

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected