summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2013-05-07 10:58:27 -0400
committerLeonard Richardson <leonardr@segfault.org>2013-05-07 10:58:27 -0400
commit1cd5ad49b15d17fac017543876ec5d0a67b57b69 (patch)
tree2b56628a4a16c53d654df0d7478ebcbc50ee5db4 /doc/source
parent431e078fbdb54adeb3875cb8c5cc75d6722de2bd (diff)
Added support for the "nth-of-type" CSS selector. The CSS selector ">" can now find a tag by means other than the tag name. Code by Sven Slootweg.
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/index.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst
index bfaa4d5..03d4824 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -1613,6 +1613,9 @@ You can find tags::
soup.select("title")
# [<title>The Dormouse's story</title>]
+ soup.select("p nth-of-type(3)")
+ # [<p class="story">...</p>]
+
Find tags beneath other tags::
soup.select("body a")
@@ -1633,6 +1636,12 @@ Find tags `directly` beneath other tags::
# <a class="sister" href="http://example.com/lacie" id="link2">Lacie</a>,
# <a class="sister" href="http://example.com/tillie" id="link3">Tillie</a>]
+ soup.select("p > a:nth-of-type(2)")
+ # [<a class="sister" href="http://example.com/lacie" id="link2">Lacie</a>]
+
+ soup.select("p > #link1")
+ # [<a class="sister" href="http://example.com/elsie" id="link1">Elsie</a>]
+
soup.select("body > a")
# []