File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,11 @@ interacting with html links and forms as you traverse through the HTML tree.
55
55
.. note ::
56
56
57
57
The DomCrawler will attempt to automatically fix your HTML to match the
58
- official specification. For example, if you nest a `` <p>`` tag inside
59
- another `` <p>`` tag, it will be moved to be a sibling of the parent tag.
58
+ official specification. For example, if you nest a ``<p> `` tag inside
59
+ another ``<p> `` tag, it will be moved to be a sibling of the parent tag.
60
60
This is expected and is part of the HTML5 spec. But if you're getting
61
61
unexpected behavior, this could be a cause. And while the DomCrawler
62
- isn't meant to dump content, you can see the "fixed" version if your HTML
62
+ isn't meant to dump content, you can see the "fixed" version of your HTML
63
63
by :ref: `dumping it <component-dom-crawler-dumping >`.
64
64
65
65
Node Filtering
@@ -83,10 +83,12 @@ Anonymous function can be used to filter with more complex criteria::
83
83
use Symfony\Component\DomCrawler\Crawler;
84
84
// ...
85
85
86
- $crawler = $crawler->filter('body > p')->reduce(function (Crawler $node, $i) {
87
- // filter even nodes
88
- return ($i % 2) == 0;
89
- });
86
+ $crawler = $crawler
87
+ ->filter('body > p')
88
+ ->reduce(function (Crawler $node, $i) {
89
+ // filter even nodes
90
+ return ($i % 2) == 0;
91
+ });
90
92
91
93
To remove a node the anonymous function must return false.
92
94
You can’t perform that action at this time.
0 commit comments