diff options
Diffstat (limited to 'src/Nodes/NodeTrait.php')
-rw-r--r-- | src/Nodes/NodeTrait.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Nodes/NodeTrait.php b/src/Nodes/NodeTrait.php index f9bf8f9..5a3cd7f 100644 --- a/src/Nodes/NodeTrait.php +++ b/src/Nodes/NodeTrait.php @@ -2,6 +2,7 @@ namespace andreskrey\Readability\Nodes; +use andreskrey\Readability\Nodes\DOM\DOMDocument; use andreskrey\Readability\Nodes\DOM\DOMElement; use andreskrey\Readability\Nodes\DOM\DOMNode; use andreskrey\Readability\Nodes\DOM\DOMText; @@ -158,7 +159,7 @@ trait NodeTrait $node = $this->parentNode; - while ($node) { + while ($node && !($node instanceof DOMDocument)) { $ancestors[] = $node; $level++; if ($level === $maxLevel) { |