From 0576f704f900cd836b7cdd788a7488417ed20013 Mon Sep 17 00:00:00 2001 From: Andrew M Date: Fri, 31 Jan 2014 10:27:07 +0200 Subject: [PATCH] Fix typos, minimize horizontal scrolling --- components/dom_crawler.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 4ad121ba061..4a4da289d4f 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -55,11 +55,11 @@ interacting with html links and forms as you traverse through the HTML tree. .. note:: The DomCrawler will attempt to automatically fix your HTML to match the - official specification. For example, if you nest a ``

`` tag inside - another ``

`` tag, it will be moved to be a sibling of the parent tag. + official specification. For example, if you nest a ``

`` tag inside + another ``

`` tag, it will be moved to be a sibling of the parent tag. This is expected and is part of the HTML5 spec. But if you're getting unexpected behavior, this could be a cause. And while the DomCrawler - isn't meant to dump content, you can see the "fixed" version if your HTML + isn't meant to dump content, you can see the "fixed" version of your HTML by :ref:`dumping it `. Node Filtering @@ -83,10 +83,12 @@ Anonymous function can be used to filter with more complex criteria:: use Symfony\Component\DomCrawler\Crawler; // ... - $crawler = $crawler->filter('body > p')->reduce(function (Crawler $node, $i) { - // filter even nodes - return ($i % 2) == 0; - }); + $crawler = $crawler + ->filter('body > p') + ->reduce(function (Crawler $node, $i) { + // filter even nodes + return ($i % 2) == 0; + }); To remove a node the anonymous function must return false.