summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2017-11-14 10:17:32 +0000
committerAndres Rey <[email protected]>2017-11-14 10:17:32 +0000
commitafe9d56e3d18b7552d494c7a05a1b995550b2e88 (patch)
treec91de3218ff5fb17ecec0d10c1875377400d599a /src
parent0c80d0cc6d6cc04df5c25c90ce2ea429203bcffe (diff)
Trim strings when detecting hierarchical separators
Diffstat (limited to 'src')
-rw-r--r--src/HTMLParser.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php
index 84d174e..8c864cb 100644
--- a/src/HTMLParser.php
+++ b/src/HTMLParser.php
@@ -585,7 +585,8 @@ class HTMLParser
$match = false;
for ($i = 1; $i <= 2; $i++) {
foreach ($this->dom->getElementsByTagName('h' . $i) as $hTag) {
- if ($hTag->nodeValue === $curTitle) {
+ // Trim texts to avoid having false negatives when the title is surrounded by spaces or tabs
+ if (trim($hTag->nodeValue) === trim($curTitle)) {
$match = true;
}
}