[Lxml-checkins] r44808 - lxml/branch/html/src/lxml/html
ianb at codespeak.net
ianb at codespeak.net
Fri Jul 6 20:38:49 CEST 2007
Author: ianb
Date: Fri Jul 6 20:38:48 2007
New Revision: 44808
Modified:
lxml/branch/html/src/lxml/html/__init__.py
Log:
Add cssselect method
Modified: lxml/branch/html/src/lxml/html/__init__.py
==============================================================================
--- lxml/branch/html/src/lxml/html/__init__.py (original)
+++ lxml/branch/html/src/lxml/html/__init__.py Fri Jul 6 20:38:48 2007
@@ -4,6 +4,7 @@
import copy
from lxml import etree
from lxml.html import defs
+from lxml import cssselect
__all__ = ['HTML', 'tostring', 'Element', 'defs',
'find_rel_links', 'find_class', 'make_links_absolute',
@@ -105,6 +106,17 @@
"""
return _collect_string_content(self)
+ def cssselect(self, expr):
+ """
+ Run the CSS expression on this element and its children,
+ returning a list of the results.
+
+ Equivalent to lxml.cssselect.CSSSelect(expr)(self) -- note
+ that pre-compiling the expression can provide a substantial
+ speedup.
+ """
+ return cssselect.CSSSelect(expr)(self)
+
########################################
## Link functions
########################################
More information about the lxml-checkins
mailing list