>>> d = PyQuery(' Hi Bye ') >>> d('p').parents() [ ] >>> d('.hello').parents('span') [ ] >>> d('.hello').parents('p') []
(self, selector=None)
| 524 | return self._filter_only(selector, self._prev_all() + self._next_all()) |
| 525 | |
| 526 | def parents(self, selector=None): |
| 527 | """ |
| 528 | >>> d = PyQuery('<span><p class="hello">Hi</p><p>Bye</p></span>') |
| 529 | >>> d('p').parents() |
| 530 | [<span>] |
| 531 | >>> d('.hello').parents('span') |
| 532 | [<span>] |
| 533 | >>> d('.hello').parents('p') |
| 534 | [] |
| 535 | """ |
| 536 | return self._filter_only( |
| 537 | selector, |
| 538 | [e for e in self._traverse_parent_topdown()], |
| 539 | unique=True |
| 540 | ) |
| 541 | |
| 542 | def children(self, selector=None): |
| 543 | """Filter elements that are direct children of self using optional |
nothing calls this directly
no test coverage detected