Skip to content

Commit f9eea33

Browse files
committed
minor #14192 Update dom_crawler.rst (ThomasLandauer)
This PR was submitted for the 3.4 branch but it was merged into the 4.4 branch instead. Discussion ---------- Update dom_crawler.rst Since the expected `empty()` doesn't work, I explained how to check if a filter did find anything. Commits ------- 5a70fcd Update dom_crawler.rst
2 parents e356afe + 5a70fcd commit f9eea33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/dom_crawler.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ To remove a node the anonymous function must return false.
114114
.. note::
115115

116116
All filter methods return a new :class:`Symfony\\Component\\DomCrawler\\Crawler`
117-
instance with filtered content.
117+
instance with the filtered content. To check if the filter actually
118+
found something, use ``$crawler->count() > 0`` on this new crawler.
118119

119120
Both the :method:`Symfony\\Component\\DomCrawler\\Crawler::filterXPath` and
120121
:method:`Symfony\\Component\\DomCrawler\\Crawler::filter` methods work with

0 commit comments

Comments
 (0)