Skip to content

[DomCrawler] Replace parents() by ancestors() #21031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions testing/dom_crawler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Traversing

Like jQuery, the Crawler has methods to traverse the DOM of an HTML/XML
document. For example, the following finds all ``input[type=submit]`` elements,
selects the last one on the page, and then selects its immediate parent element::
selects the last one on the page, and then selects its immediate ancestor element::

$newCrawler = $crawler->filter('input[type=submit]')
->last()
->parents()
->ancestors()
->first()
;

Expand All @@ -36,8 +36,8 @@ Many other methods are also available:
All following siblings.
``previousAll()``
All preceding siblings.
``parents()``
Returns the parent nodes.
``ancestors()``
Returns the ancestor nodes.
``children()``
Returns children nodes.
``reduce($lambda)``
Expand Down
Loading