Commits

Scott Smerchek committed 02f17b6

added support for :input selector

Comments (0)

Files changed (2)

pyquery/cssselectpatch.py

         xpath.add_condition("@type = 'file' and name(.) = 'input'")
         return xpath
 
+    def _xpath_input(self, xpath):
+        """Matches all input elements.
+        """
+        xpath.add_condition("(name(.) = 'input' or name(.) = 'select') "
+        + "or (name(.) = 'textarea' or name(.) = 'button')")
+        return xpath
+
 cssselect.Pseudo = JQueryPseudo
 
 class JQueryFunction(Function):
         assert len(e(':selected')) == 1
         assert len(e(':checked')) == 1
         assert len(e(':file')) == 1
+        assert len(e(':input')) == 7
 
 class TestTraversal(unittest.TestCase):
     klass = pq