diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Nodes/NodeUtility.php | 4 | ||||
-rw-r--r-- | src/Readability.php | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Nodes/NodeUtility.php b/src/Nodes/NodeUtility.php index bb63828..b5f66ba 100644 --- a/src/Nodes/NodeUtility.php +++ b/src/Nodes/NodeUtility.php @@ -45,8 +45,8 @@ class NodeUtility { $next = $node; while ($next - && $next->nodeName !== '#text' - && trim($next->textContent)) { + && $next->nodeType !== XML_ELEMENT_NODE + && preg_match(NodeUtility::$regexps['whitespace'], $next->textContent)) { $next = $next->nextSibling; } diff --git a/src/Readability.php b/src/Readability.php index c7c3d50..3f4d807 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -447,7 +447,7 @@ class Readability return null; } - $curTitle = $originalTitle; + $curTitle = trim($originalTitle); $titleHadHierarchicalSeparators = false; /* @@ -825,7 +825,7 @@ class Readability while ($next) { // If we've hit another <br><br>, we're done adding children to this <p>. if ($next->nodeName === 'br') { - $nextElem = NodeUtility::nextElement($next); + $nextElem = NodeUtility::nextElement($next->nextSibling); if ($nextElem && $nextElem->nodeName === 'br') { break; } |