Matches even elements, zero-indexed:: >>> from pyquery import PyQuery >>> d = PyQuery(' ') >>> d('p:even') [ ] ..
(self, xpath)
| 76 | return xpath |
| 77 | |
| 78 | def xpath_even_pseudo(self, xpath): |
| 79 | """Matches even elements, zero-indexed:: |
| 80 | |
| 81 | >>> from pyquery import PyQuery |
| 82 | >>> d = PyQuery('<div><p></p><p class="last"></p></div>') |
| 83 | >>> d('p:even') |
| 84 | [<p>] |
| 85 | |
| 86 | .. |
| 87 | """ |
| 88 | # the first element is 1 in xpath and 0 in python and js |
| 89 | xpath.add_post_condition('position() mod 2 = 1') |
| 90 | return xpath |
| 91 | |
| 92 | def xpath_odd_pseudo(self, xpath): |
| 93 | """Matches odd elements, zero-indexed:: |
nothing calls this directly
no test coverage detected