Matches all header elements (h1, ..., h6):: >>> from pyquery import PyQuery >>> d = PyQuery(' title ') >>> d(':header') [ ] ..
(self, xpath)
| 324 | return xpath |
| 325 | |
| 326 | def xpath_header_pseudo(self, xpath): |
| 327 | """Matches all header elements (h1, ..., h6):: |
| 328 | |
| 329 | >>> from pyquery import PyQuery |
| 330 | >>> d = PyQuery('<div><h1>title</h1></div>') |
| 331 | >>> d(':header') |
| 332 | [<h1>] |
| 333 | |
| 334 | .. |
| 335 | """ |
| 336 | # this seems kind of brute-force, is there a better way? |
| 337 | xpath.add_condition(( |
| 338 | "(name(.) = 'h1' or name(.) = 'h2' or name (.) = 'h3') " |
| 339 | "or (name(.) = 'h4' or name (.) = 'h5' or name(.) = 'h6')")) |
| 340 | return xpath |
| 341 | |
| 342 | def xpath_parent_pseudo(self, xpath): |
| 343 | """Match all elements that contain other elements:: |
nothing calls this directly
no outgoing calls
no test coverage detected