diff options
author | Andres Rey <[email protected]> | 2017-11-29 23:58:04 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2017-11-29 23:58:04 +0000 |
commit | ad9f7b246fed8f6316274cbde6baa12485da57e1 (patch) | |
tree | 8aa91b8553b3900189e64f7c7f4baf60d07da837 /src | |
parent | 86823e6cb1b1ec4a21824bb36b53a3d810d18203 (diff) |
Remove node comparing function
Diffstat (limited to 'src')
-rw-r--r-- | src/NodeClass/NodeClassTrait.php | 30 | ||||
-rw-r--r-- | src/Readability.php | 2 |
2 files changed, 2 insertions, 30 deletions
diff --git a/src/NodeClass/NodeClassTrait.php b/src/NodeClass/NodeClassTrait.php index b24dd4c..8c045b4 100644 --- a/src/NodeClass/NodeClassTrait.php +++ b/src/NodeClass/NodeClassTrait.php @@ -228,7 +228,7 @@ trait NodeClassTrait } /** - * Returns the next node. First checks for childs (if the flag allows it), then for siblings, and finally + * Returns the next node. First checks for children (if the flag allows it), then for siblings, and finally * for parents. * * @param DOMNode|DOMText $originalNode @@ -267,34 +267,6 @@ trait NodeClassTrait } /** - * Compares nodes. Checks for tag name and text content. - * - * It's a replacement of the original JS code, which looked like this: - * - * $node1 == $node2 - * - * I'm not sure this works the same in PHP, so I created a mock function to check the actual content of the node. - * Should serve the same porpuse as the original comparison. - * - * @param DOMElement $node1 - * @param DOMElement $node2 - * - * @return bool - */ - public function compareNodes($node1, $node2) - { - if ($node1->nodeName !== $node2->nodeName) { - return false; - } - - if ($node1->getTextContent(true) !== $node2->getTextContent(true)) { - return false; - } - - return true; - } - - /** * Creates a new node based on the text content of the original node. * * @param $originalNode DOMElement diff --git a/src/Readability.php b/src/Readability.php index 53bc32d..4b1309c 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -937,7 +937,7 @@ class Readability foreach ($siblings as $sibling) { $append = false; - if ($sibling->compareNodes($sibling, $topCandidate)) { + if ($sibling === $topCandidate) { $append = true; } else { $contentBonus = 0; |