diff options
author | Andres Rey <[email protected]> | 2017-11-14 10:17:32 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2017-11-14 10:17:32 +0000 |
commit | afe9d56e3d18b7552d494c7a05a1b995550b2e88 (patch) | |
tree | c91de3218ff5fb17ecec0d10c1875377400d599a /src | |
parent | 0c80d0cc6d6cc04df5c25c90ce2ea429203bcffe (diff) |
Trim strings when detecting hierarchical separators
Diffstat (limited to 'src')
-rw-r--r-- | src/HTMLParser.php | 3 |
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; } } |