Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ba4fa7

Browse files
committed
minorsymfony#3527 Changes to components domcrawler (ifdattic)
This PR was merged into the 2.3 branch.Discussion----------Changes to components domcrawler| Q | A| ------------- | ---| Doc fix? | yes| New docs? | no| Applies to | 2.3| Fixed tickets |Commits-------0576f70 Fix typos, minimize horizontal scrolling
2 parents8973c81 +0576f70 commit9ba4fa7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎components/dom_crawler.rst‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ interacting with html links and forms as you traverse through the HTML tree.
5555
..note::
5656

5757
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.
6060
This is expected and is part of the HTML5 spec. But if you're getting
6161
unexpected behavior, this could be a cause. And while the DomCrawler
62-
isn't meant to dump content, you can see the "fixed" versionif your HTML
62+
isn't meant to dump content, you can see the "fixed" versionof your HTML
6363
by:ref:`dumping it<component-dom-crawler-dumping>`.
6464

6565
Node Filtering
@@ -83,10 +83,12 @@ Anonymous function can be used to filter with more complex criteria::
8383
use Symfony\Component\DomCrawler\Crawler;
8484
// ...
8585

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+
});
9092

9193
To remove a node the anonymous function must return false.
9294

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp