1. Luke Plant
  2. pyquery

Commits

Scott Smerchek  committed 18ba6c4

added support for :button and :radio selectors

  • Participants
  • Parent commits 02f17b6
  • Branches default

Comments (0)

Files changed (2)

File pyquery/cssselectpatch.py

View file
         + "or (name(.) = 'textarea' or name(.) = 'button')")
         return xpath
 
+    def _xpath_button(self, xpath):
+        """Matches all input elements.
+        """
+        xpath.add_condition("(@type = 'button' and name(.) = 'input') "
+            + "or name(.) = 'button'")
+        return xpath
+
+    def _xpath_radio(self, xpath):
+        """Matches all radio input elements.
+        """
+        xpath.add_condition("@type = 'radio' and name(.) = 'input'")
+        return xpath
+
 cssselect.Pseudo = JQueryPseudo
 
 class JQueryFunction(Function):

File pyquery/test.py

View file
         assert len(e(':checked')) == 1
         assert len(e(':file')) == 1
         assert len(e(':input')) == 7
+        assert len(e(':radio')) == 3
 
 class TestTraversal(unittest.TestCase):
     klass = pq