File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,16 @@ Access the value of the first node of the current selection::
226226 // pass FALSE as the second argument to return the original text unchanged
227227 $crawler->filterXPath('//body/p')->text('Default text content', false);
228228
229+ // innerText() is similar to text() but returns only the text that is
230+ // the direct descendent of the current node, excluding any child nodes
231+ $text = $crawler->filterXPath('//body/p')->innerText();
232+ // if content is <p>Foo <span>Bar</span></p>
233+ // innerText() returns 'Foo' and text() returns 'Foo Bar'
234+
235+ .. versionadded :: 5.4
236+
237+ The ``innerText() `` method was introduced in Symfony 5.4.
238+
229239Access the attribute value of the first node of the current selection::
230240
231241 $class = $crawler->filterXPath('//body/p')->attr('class');
You can’t perform that action at this time.
0 commit comments