This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DomCrawler
Fabien Potencier 0469ea82b1 bug #13145 [DomCrawler] Fix behaviour with <base> tag (dkop, WouterJ)
This PR was merged into the 2.3 branch.

Discussion
----------

[DomCrawler] Fix behaviour with <base> tag

Finishes https://github.com/symfony/symfony/issues/12283

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12283, #12143, #12144
| License       | MIT
| Doc PR        | -

Commits
-------

91447e8 Make fabbot happy
1d35e48 Clean up testing
61f22d7 [DomCrawler] fixed bug #12143
2014-12-29 11:43:29 +01:00
..
Field [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
Tests bug #13145 [DomCrawler] Fix behaviour with <base> tag (dkop, WouterJ) 2014-12-29 11:43:29 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [DomCrawler] finished the previous merge feature addition 2013-04-22 07:03:23 +02:00
composer.json Test components using their lowest possible deps 2014-12-15 11:45:17 +01:00
Crawler.php bug #13145 [DomCrawler] Fix behaviour with <base> tag (dkop, WouterJ) 2014-12-29 11:43:29 +01:00
Form.php Docblock fixes 2014-11-30 13:33:44 +00:00
FormFieldRegistry.php Docblock fixes 2014-11-30 13:33:44 +00:00
LICENSE update year on licenses 2014-01-07 08:19:25 -05:00
Link.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
phpunit.xml.dist [Tests] Silenced all deprecations in tests for 2.3 2014-12-18 20:00:19 +01:00
README.md [Doc] Use Markdown syntax highlighting 2014-10-01 07:38:33 +02:00

DomCrawler Component

DomCrawler eases DOM navigation for HTML and XML documents.

If you are familiar with jQuery, DomCrawler is a PHP equivalent:

use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filterXPath('descendant-or-self::body/p')->text();

If you are also using the CssSelector component, you can use CSS Selectors instead of XPath expressions:

use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filter('body > p')->text();

Resources

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/DomCrawler/
$ composer.phar install
$ phpunit