mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Some more documentation
This commit is contained in:
parent
fd002b6680
commit
b10feb7273
@ -85,8 +85,9 @@ class Select(object):
|
||||
|
||||
'''
|
||||
|
||||
This class implements CSS Level 3 selectors on an lxml tree, with caching
|
||||
for performance. To use:
|
||||
This class implements CSS Level 3 selectors
|
||||
(http://www.w3.org/TR/css3-selectors) on an lxml tree, with caching for
|
||||
performance. To use:
|
||||
|
||||
>>> from css_selectors import Select
|
||||
>>> select = Select(root) # Where root is an lxml document
|
||||
@ -108,6 +109,12 @@ class Select(object):
|
||||
other than lxml. Simply override the methods in the ``Tree Integration``
|
||||
block below.
|
||||
|
||||
The caching works by maintaining internal maps from classes/ids/tag
|
||||
names/etc. to node sets. These caches are populated as needed, and used
|
||||
for all subsequent selections. Thus, for best performance you should use
|
||||
the same selector object for finding the matching nodes for multiple
|
||||
queries. Of course, remember not to change the tree in between queries.
|
||||
|
||||
'''
|
||||
|
||||
combinator_mapping = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user