diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index de65978614aaa..558d35b2b6fd9 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -839,6 +839,8 @@ private function relativize($xpath) $expression = $nonMatchingExpression; } elseif (0 === strpos($expression, '//')) { $expression = 'descendant-or-self::' . substr($expression, 2); + } elseif (0 === strpos($expression, './/')) { + $expression = 'descendant-or-self::' . substr($expression, 3); } elseif (0 === strpos($expression, './')) { $expression = 'self::' . substr($expression, 2); } elseif ('/' === $expression[0]) { diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php index 04921f693ce20..fc7524b292307 100644 --- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php @@ -376,6 +376,8 @@ public function testFilterXpathComplexQueries() $this->assertCount(0, $crawler->filterXPath('/body')); $this->assertCount(1, $crawler->filterXPath('/_root/body')); $this->assertCount(1, $crawler->filterXPath('./body')); + $this->assertCount(1, $crawler->filterXPath('.//body')); + $this->assertCount(5, $crawler->filterXPath('.//input')); $this->assertCount(4, $crawler->filterXPath('//form')->filterXPath('//button | //input')); $this->assertCount(1, $crawler->filterXPath('body')); $this->assertCount(6, $crawler->filterXPath('//button | //input')); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy