From 9c1c00e24cb6e06c8678abf8464e61713abfae8d Mon Sep 17 00:00:00 2001 From: "FiveFilters.org" Date: Wed, 25 Aug 2021 03:13:38 +0200 Subject: Renamed nextElement to nextNode https://github.com/mozilla/readability/commit/60af91f15387fcd5e60fe05212bf6fd1a2d9d36d --- src/Nodes/NodeUtility.php | 8 ++++++-- src/Readability.php | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Nodes/NodeUtility.php b/src/Nodes/NodeUtility.php index 88512f2..0e8a3fd 100644 --- a/src/Nodes/NodeUtility.php +++ b/src/Nodes/NodeUtility.php @@ -43,13 +43,17 @@ class NodeUtility ]; /** + * Finds the next node, starting from the given node, and ignoring + * whitespace in between. If the given node is an element, the same node is + * returned. + * * Imported from the Element class on league\html-to-markdown. * * @param $node * - * @return DOMElement + * @return DOMNode */ - public static function nextElement($node) + public static function nextNode($node) { $next = $node; while ($next diff --git a/src/Readability.php b/src/Readability.php index 1089769..5a7363d 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1188,7 +1188,7 @@ class Readability * or non-whitespace. This leaves behind the first
in the chain * (which will be replaced with a

later). */ - while (($next = NodeUtility::nextElement($next)) && ($next->nodeName === 'br')) { + while (($next = NodeUtility::nextNode($next)) && ($next->nodeName === 'br')) { $this->logger->debug('[PrepDocument] Removing chain of BR nodes...'); $replaced = true; @@ -1211,7 +1211,7 @@ class Readability while ($next) { // If we've hit another

, we're done adding children to this

. if ($next->nodeName === 'br') { - $nextElem = NodeUtility::nextElement($next->nextSibling); + $nextElem = NodeUtility::nextNode($next->nextSibling); if ($nextElem && $nextElem->nodeName === 'br') { break; } @@ -1628,7 +1628,7 @@ class Readability $this->_cleanExtraParagraphs($article); foreach (iterator_to_array($article->getElementsByTagName('br')) as $br) { - $next = NodeUtility::nextElement($br->nextSibling); + $next = NodeUtility::nextNode($br->nextSibling); if ($next && $next->nodeName === 'p') { $this->logger->debug('[PrepArticle] Removing br node next to a p node.'); $br->parentNode->removeChild($br); -- cgit v1.2.3