Skip to content

Commit 29c5f84

Browse files
committed
[symfony#2651] Moving and expanding on note
1 parent 6ec09bc commit 29c5f84

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

components/dom_crawler.rst

+13-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ The DomCrawler Component
1010
.. note::
1111

1212
While possible, the DomCrawler component is not designed for manipulation
13-
of the DOM or re-dumping HTML/XML. However the DomCrawler will attempt to
14-
automatically fix your HTML to match the official specification. Take note
15-
about this behaviour as you could be working with a different DOM after it
16-
has been parsed with the DomCrawler.
13+
of the DOM or re-dumping HTML/XML.
1714

1815
Installation
1916
------------
@@ -55,6 +52,16 @@ Specialized :class:`Symfony\\Component\\DomCrawler\\Link` and
5552
:class:`Symfony\\Component\\DomCrawler\\Form` classes are useful for
5653
interacting with html links and forms as you traverse through the HTML tree.
5754

55+
.. note::
56+
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.
60+
This is expected and is part of the HTML5 spec. But if you're getting
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
63+
by :ref:`dumping it<component-dom-crawler-dumping>`.
64+
5865
Node Filtering
5966
~~~~~~~~~~~~~~
6067

@@ -187,6 +194,8 @@ and :phpclass:`DOMNode` objects:
187194
$crawler->addNode($node);
188195
$crawler->add($document);
189196
197+
.. component-dom-crawler-dumping:
198+
190199
.. sidebar:: Manipulating and Dumping a ``Crawler``
191200

192201
These methods on the ``Crawler`` are intended to initially populate your

0 commit comments

Comments
 (0)