diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index bbcb07152b..54be73a303 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -523,7 +523,7 @@ class Crawler extends \SplObjectStorage /** * Selects links by name or alt value for clickable images. * - * @param string $value The link text + * @param string $value The link text * * @return Crawler A new instance of Crawler with the filtered list of nodes * @@ -540,7 +540,7 @@ class Crawler extends \SplObjectStorage /** * Selects a button by name or alt value for images. * - * @param string $value The button text + * @param string $value The button text * * @return Crawler A new instance of Crawler with the filtered list of nodes * @@ -558,7 +558,7 @@ class Crawler extends \SplObjectStorage /** * Returns a Link object for the first node in the list. * - * @param string $method The method for the link (get by default) + * @param string $method The method for the link (get by default) * * @return Link A Link instance * @@ -597,8 +597,8 @@ class Crawler extends \SplObjectStorage /** * Returns a Form object for the first node in the list. * - * @param array $values An array of values for the form fields - * @param string $method The method for the form + * @param array $values An array of values for the form fields + * @param string $method The method for the form * * @return Form A Form instance * @@ -621,6 +621,28 @@ class Crawler extends \SplObjectStorage return $form; } + /** + * Converts string for XPath expressions. + * + * Escaped characters are: quotes (") and apostrophe ('). + * + * Examples: + * + * echo Crawler::xpathLiteral('foo " bar'); + * //prints 'foo " bar' + * + * echo Crawler::xpathLiteral("foo ' bar"); + * //prints "foo ' bar" + * + * echo Crawler::xpathLiteral('a\'b"c'); + * //prints concat('a', "'", 'b"c') + * + * + * @param string $s String to be escaped + * + * @return string Converted string + * + */ static public function xpathLiteral($s) { if (false === strpos($s, "'")) {