MCPcopy Create free account
hub / github.com/gawel/pyquery / xpath_selected_pseudo

Method xpath_selected_pseudo

pyquery/cssselectpatch.py:118–129  ·  view source on GitHub ↗

Matches all elements that are selected:: >>> from pyquery import PyQuery >>> d = PyQuery(' ') >>> d('option:selected') [ ] ..

(self, xpath)

Source from the content-addressed store, hash-verified

116 return xpath
117
118 def xpath_selected_pseudo(self, xpath):
119 """Matches all elements that are selected::
120
121 >>> from pyquery import PyQuery
122 >>> d = PyQuery('<select><option selected="selected"/></select>')
123 >>> d('option:selected')
124 [<option>]
125
126 ..
127 """
128 xpath.add_condition("@selected and name(.) = 'option'")
129 return xpath
130
131 def _format_disabled_xpath(self, disabled=True):
132 """Format XPath condition for :disabled or :enabled pseudo-classes

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected