Merge pull request #429 from da2x/patch-2

Use query selector to better detect feed links
This commit is contained in:
Brent Simmons 2018-09-04 17:24:26 -07:00 committed by GitHub
commit db238e8aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -42,18 +42,14 @@ function scanForSyndicationFeeds() {
// variables to empty instead of null. // variables to empty instead of null.
thisPageLinkObjects = [] thisPageLinkObjects = []
thisPageLinks = document.getElementsByTagName("link"); thisPageLinks = document.querySelectorAll("link[href][rel~='alternate'][type]");
for (thisLinkIndex = 0; thisLinkIndex < thisPageLinks.length; thisLinkIndex++) for (thisLinkIndex = 0; thisLinkIndex < thisPageLinks.length; thisLinkIndex++)
{ {
var thisLink = thisPageLinks[thisLinkIndex]; var thisLink = thisPageLinks[thisLinkIndex];
var thisLinkRel = thisLink.getAttribute("rel"); if (isValidFeedLink(thisLink))
if (thisLinkRel == "alternate")
{ {
if (isValidFeedLink(thisLink)) thisPageLinkObjects.push(objectFromLink(thisLink));
{
thisPageLinkObjects.push(objectFromLink(thisLink));
}
} }
} }
} }