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

Commite2f13a4

Browse files
committed
feature#4039 [DomCrawler] Added node name getter (fejese)
This PR was merged into the master branch.Discussion----------[DomCrawler] Added node name getter| Q | A| ------------- | ---| Doc fix? | no| New docs? | yes (symfony/symfony#11426)| Applies to | all| Fixed tickets |Commits-------09c9af4 [DomCrawler] Added node name getter
2 parentsaa70a98 +09c9af4 commite2f13a4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎components/dom_crawler.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,15 @@ Get all the child or parent nodes::
193193
Accessing Node Values
194194
~~~~~~~~~~~~~~~~~~~~~
195195

196+
..versionadded::2.6
197+
The:method:`Symfony\\Component\\DomCrawler\\Crawler::nodeName`
198+
method was introduced in Symfony 2.6.
199+
200+
Access the node name (HTML tag name) of the first node of the current selection (eg. "p" or "div")::
201+
202+
// will return the node name (HTML tag name) of the first child element under <body>
203+
$tag = $crawler->filterXPath('//body/*')->nodeName();
204+
196205
Access the value of the first node of the current selection::
197206

198207
$message = $crawler->filterXPath('//body/p')->text();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp