summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-11-16 17:42:16 +0000
committerAndres Rey <[email protected]>2016-11-16 17:42:16 +0000
commitc9c13321f095dd442c4b4a7db140775bc025a14b (patch)
treeb347e9f562e2862e19316fadb0c3d1dd4a5fa419 /src
parent398aa398a682758d3cd47b86807beed335209551 (diff)
Fixed duplication of initialization
Diffstat (limited to 'src')
-rw-r--r--src/HTMLParser.php2
-rw-r--r--src/Readability.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index dc7459b..649a74f 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -378,7 +378,7 @@ class HTMLParser
// Initialize and score ancestors.
/** @var Readability $ancestor */
foreach ($ancestors as $level => $ancestor) {
- $ancestor = $ancestor->initializeNode();
+ // No need to initialize the ancestor since getNodeAncestors() already initializes them.
/*
* Node score divider:
diff --git a/src/Readability.php b/src/Readability.php
index 930e141..addbd0d 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -88,7 +88,7 @@ class Readability extends Element implements ReadabilityInterface
$node = $this->getParent();
while ($node) {
- $ancestors[] = new static($node->node);
+ $ancestors[] = $node;
$level++;
if ($level >= $maxLevel) {
break;