8000 minor #26485 [DomCrawler] Improve the sprintf() call in selectLink() … · src-run/symfony@b486fda · GitHub
[go: up one dir, main page]

Skip to content

Commit b486fda

Browse files
committed
minor symfony#26485 [DomCrawler] Improve the sprintf() call in selectLink() (dunglas)
This PR was merged into the 4.1-dev branch. Discussion ---------- [DomCrawler] Improve the sprintf() call in selectLink() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? |no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? |no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | n/a Code cleanup and minor performance improvement. Commits ------- e2ab1a4 [DomCrawler] Improve the sprintf() call in selectLink()
2 parents 009b4d2 + e2ab1a4 commit b486fda

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,9 @@ public function filter($selector)
710710
*/
711711
public function selectLink($value)
712712
{
713-
$xpath = sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) ', static::xpathLiteral(' '.$value.' ')).
714-
sprintf('or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)]]', static::xpathLiteral(' '.$value.' '));
715-
716-
return $this->filterRelativeXPath($xpath);
713+
return $this->filterRelativeXPath(
714+
sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %1$s) or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %1$s)]]', static::xpathLiteral(' '.$value.' '))
715+
);
717716
}
718717

719718
/**

0 commit comments

Comments
 (0)
0