Skip to content

Commit 2931e97

Browse files
committed
document the ancestors() method
1 parent cc0256e commit 2931e97

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

components/dom_crawler.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,14 @@ Get the same level nodes after or before the current selection::
187187
$crawler->filter('body > p')->nextAll();
188188
$crawler->filter('body > p')->previousAll();
189189

190-
Get all the child or parent nodes::
190+
Get all the child or ancestor nodes::
191191

192192
$crawler->filter('body')->children();
193-
$crawler->filter('body > p')->parents();
193+
$crawler->filter('body > p')->ancestors();
194+
195+
.. versionadded:: 5.3
196+
197+
The ``ancestors()`` method was introduced in Symfony 5.3.
194198

195199
Get all the direct child nodes matching a CSS selector::
196200

testing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ selects the last one on the page, and then selects its immediate parent element:
713713

714714
$newCrawler = $crawler->filter('input[type=submit]')
715715
->last()
716-
->parents()
716+
->ancestors()
717717
->first()
718718
;
719719

@@ -735,8 +735,8 @@ Many other methods are also available:
735735
All following siblings.
736736
``previousAll()``
737737
All preceding siblings.
738-
``parents()``
739-
Returns the parent nodes.
738+
``ancestors()``
739+
Returns the ancestor nodes.
740740
``children()``
741741
Returns children nodes.
742742
``reduce($lambda)``
@@ -766,7 +766,7 @@ Extracting Information
766766
The Crawler can extract information from the nodes::
767767

768768
use Symfony\Component\DomCrawler\Crawler;
769-
769+
770770
// returns the attribute value for the first node
771771
$crawler->attr('class');
772772

0 commit comments

Comments
 (0)