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:
Fabien Potencier 2016-03-18 07:07:29 +01:00
commit a5d941479e
1 changed files with 1 additions and 1 deletions

View File

@ -455,7 +455,7 @@ class Crawler extends \SplObjectStorage
$nodes = array();
while ($node = $node->parentNode) {
if (1 === $node->nodeType) {
if (XML_ELEMENT_NODE === $node->nodeType) {
$nodes[] = $node;
}
}