File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,18 @@ Call an anonymous function on each node of the list::
252252The anonymous function receives the node (as a Crawler) and the position as arguments.
253253The result is an array of values returned by the anonymous function calls.
254254
255+ When using nested crawler, beware that ``filterXPath() `` is evaluated in the
256+ context of the crawler::
257+
258+ $crawler->filterXPath('parent')->each(function (Crawler $parentCrawler, $i) {
259+ // DON'T DO THIS: direct child can not be found
260+ $subCrawler = $parentCrawler->filterXPath('sub-tag/sub-child-tag');
261+
262+ // DO THIS: specify the parent tag too
263+ $subCrawler = $parentCrawler->filterXPath('parent/sub-tag/sub-child-tag');
264+ $subCrawler = $parentCrawler->filterXPath('node()/sub-tag/sub-child-tag');
265+ });
266+
255267Adding the Content
256268~~~~~~~~~~~~~~~~~~
257269
You can’t perform that action at this time.
0 commit comments