summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Nodes/NodeTrait.php2
-rw-r--r--src/Readability.php6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Nodes/NodeTrait.php b/src/Nodes/NodeTrait.php
index 08aa794..da09f26 100644
--- a/src/Nodes/NodeTrait.php
+++ b/src/Nodes/NodeTrait.php
@@ -476,7 +476,7 @@ trait NodeTrait
(!is_null($this->childNodes) &&
($this->nodeName === 'a' || $this->nodeName === 'del' || $this->nodeName === 'ins') &&
array_reduce(iterator_to_array($this->childNodes), function ($carry, $node) {
- return $carry || $node->isPhrasingContent();
+ return $node->isPhrasingContent() && $carry;
})
);
}
diff --git a/src/Readability.php b/src/Readability.php
index a4eeecd..ab35ca4 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -1276,11 +1276,11 @@ class Readability
/** @var DOMNode $table */
$tbody = $table->hasSingleTagInsideElement('tbody') ? $table->childNodes[0] : $table;
if ($tbody->hasSingleTagInsideElement('tr')) {
- $row = $tbody->childNodes[0];
+ $row = $tbody->firstChild;
if ($row->hasSingleTagInsideElement('td')) {
- $cell = $row->childNodes[0];
+ $cell = $row->firstChild;
$cell = NodeUtility::setNodeTag($cell, (array_reduce(iterator_to_array($cell->childNodes), function ($carry, $node) {
- return $carry || $node->isPhrasingContent();
+ return $node->isPhrasingContent() && $carry;
})) ? 'p' : 'div');
$table->parentNode->replaceChild($cell, $table);
}