billy-herrington-utils 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -492,16 +492,14 @@ function parseURL(s) {
492
492
  function getPaginationLinks(doc = document, url = location.href, pathnameSelector = /\/(page\/)?\d+\/?$/) {
493
493
  const currentUrl = parseURL(url);
494
494
  currentUrl.pathname = currentUrl.pathname.replace(pathnameSelector, "/");
495
+ const pathnameStrict = doc instanceof Document;
495
496
  const pageLinks = Array.from(
496
497
  doc.querySelectorAll("a[href]") || [],
497
498
  (a) => a.href
498
499
  ).filter((h) => {
499
500
  try {
500
501
  const linkUrl = new URL(h.replace(/#\w*$/, ""), doc.baseURI || currentUrl.origin);
501
- return (
502
- // in case of origin sometimes it's protocols problem cause some links can be not https but http
503
- linkUrl.hostname === currentUrl.hostname && linkUrl.pathname.startsWith(currentUrl.pathname)
504
- );
502
+ return linkUrl.hostname === currentUrl.hostname && (pathnameStrict ? linkUrl.pathname.startsWith(currentUrl.pathname) : true);
505
503
  } catch {
506
504
  return false;
507
505
  }