Matches all elements with an index over the given one:: >>> from pyquery import PyQuery >>> d = PyQuery(' ') >>> d('h1:gt(0)') [ ] ..
(self, xpath, function)
| 386 | return xpath |
| 387 | |
| 388 | def xpath_gt_function(self, xpath, function): |
| 389 | """Matches all elements with an index over the given one:: |
| 390 | |
| 391 | >>> from pyquery import PyQuery |
| 392 | >>> d = PyQuery('<div><h1 class="first"/><h1 class="last"/></div>') |
| 393 | >>> d('h1:gt(0)') |
| 394 | [<h1.last>] |
| 395 | |
| 396 | .. |
| 397 | """ |
| 398 | if function.argument_types() != ['NUMBER']: |
| 399 | raise ExpressionError( |
| 400 | "Expected a single integer for :gt(), got %r" % ( |
| 401 | function.arguments,)) |
| 402 | value = int(function.arguments[0].value) |
| 403 | xpath.add_post_condition('position() > %s' % (value + 1)) |
| 404 | return xpath |
| 405 | |
| 406 | def xpath_lt_function(self, xpath, function): |
| 407 | """Matches all elements with an index below the given one:: |
nothing calls this directly
no test coverage detected