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

Commitb3fdbee

Browse files
committed
minor#15845 [DomCrawler] Document innerText() method (javiereguiluz)
This PR was merged into the 5.4 branch.Discussion----------[DomCrawler] Document innerText() methodFixes#15836.Commits-------cc062a9 [DomCrawler] Document innerText() method
2 parentsf5a666f +cc062a9 commitb3fdbee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎components/dom_crawler.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ Access the value of the first node of the current selection::
230230
// pass FALSE as the second argument to return the original text unchanged
231231
$crawler->filterXPath('//body/p')->text('Default text content', false);
232232

233+
// innerText() is similar to text() but returns only the text that is
234+
// the direct descendent of the current node, excluding any child nodes
235+
$text = $crawler->filterXPath('//body/p')->innerText();
236+
// if content is <p>Foo <span>Bar</span></p>
237+
// innerText() returns 'Foo' and text() returns 'Foo Bar'
238+
239+
..versionadded::5.4
240+
241+
The ``innerText()`` method was introduced in Symfony 5.4.
242+
233243
Access the attribute value of the first node of the current selection::
234244

235245
$class = $crawler->filterXPath('//body/p')->attr('class');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp