Matches the first selected element:: >>> from pyquery import PyQuery >>> d = PyQuery(' ') >>> d('p:first') [ ] ..
(self, xpath)
| 50 | xpathexpr_cls = XPathExpr |
| 51 | |
| 52 | def xpath_first_pseudo(self, xpath): |
| 53 | """Matches the first selected element:: |
| 54 | |
| 55 | >>> from pyquery import PyQuery |
| 56 | >>> d = PyQuery('<div><p class="first"></p><p></p></div>') |
| 57 | >>> d('p:first') |
| 58 | [<p.first>] |
| 59 | |
| 60 | .. |
| 61 | """ |
| 62 | xpath.add_post_condition('position() = 1') |
| 63 | return xpath |
| 64 | |
| 65 | def xpath_last_pseudo(self, xpath): |
| 66 | """Matches the last selected element:: |
nothing calls this directly
no test coverage detected