minor #18212 [DomCrawler] Use XML_ELEMENT_NODE in nodeType check (rvanlaak)
This PR was merged into the 2.3 branch.
Discussion
----------
[DomCrawler] Use XML_ELEMENT_NODE in nodeType check
| Q | A
| ------------- | ---
| Branch? | 2.3+
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Making use of the predefined dom constant `XML_ELEMENT_NODE` (which value is `1`) makes more sense while interpreting `parents()` it's functionality. See http://php.net/manual/en/dom.constants.php
Commits
-------
cffea91
Use XML_ELEMENT_NODE in nodeType check
This commit is contained in:
commit
a5d941479e
@ -455,7 +455,7 @@ class Crawler extends \SplObjectStorage
|
|||||||
$nodes = array();
|
$nodes = array();
|
||||||
|
|
||||||
while ($node = $node->parentNode) {
|
while ($node = $node->parentNode) {
|
||||||
if (1 === $node->nodeType) {
|
if (XML_ELEMENT_NODE === $node->nodeType) {
|
||||||
$nodes[] = $node;
|
$nodes[] = $node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user