[DomCrawler] Fixed a forgotten case of complex XPath queries
This commit is contained in:
parent
29341fab1b
commit
a9de61e86d
@ -839,6 +839,8 @@ class Crawler extends \SplObjectStorage
|
|||||||
$expression = $nonMatchingExpression;
|
$expression = $nonMatchingExpression;
|
||||||
} elseif (0 === strpos($expression, '//')) {
|
} elseif (0 === strpos($expression, '//')) {
|
||||||
$expression = 'descendant-or-self::' . substr($expression, 2);
|
$expression = 'descendant-or-self::' . substr($expression, 2);
|
||||||
|
} elseif (0 === strpos($expression, './/')) {
|
||||||
|
$expression = 'descendant-or-self::' . substr($expression, 3);
|
||||||
} elseif (0 === strpos($expression, './')) {
|
} elseif (0 === strpos($expression, './')) {
|
||||||
$expression = 'self::' . substr($expression, 2);
|
$expression = 'self::' . substr($expression, 2);
|
||||||
} elseif ('/' === $expression[0]) {
|
} elseif ('/' === $expression[0]) {
|
||||||
|
@ -376,6 +376,8 @@ EOF
|
|||||||
$this->assertCount(0, $crawler->filterXPath('/body'));
|
$this->assertCount(0, $crawler->filterXPath('/body'));
|
||||||
$this->assertCount(1, $crawler->filterXPath('/_root/body'));
|
$this->assertCount(1, $crawler->filterXPath('/_root/body'));
|
||||||
$this->assertCount(1, $crawler->filterXPath('./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(4, $crawler->filterXPath('//form')->filterXPath('//button | //input'));
|
||||||
$this->assertCount(1, $crawler->filterXPath('body'));
|
$this->assertCount(1, $crawler->filterXPath('body'));
|
||||||
$this->assertCount(6, $crawler->filterXPath('//button | //input'));
|
$this->assertCount(6, $crawler->filterXPath('//button | //input'));
|
||||||
|
Reference in New Issue
Block a user