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,21 +42,17 @@ 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 (thisLinkRel == "alternate")
{
if (isValidFeedLink(thisLink)) if (isValidFeedLink(thisLink))
{ {
thisPageLinkObjects.push(objectFromLink(thisLink)); thisPageLinkObjects.push(objectFromLink(thisLink));
} }
} }
} }
}
function subscribeToFeed(theFeed) { function subscribeToFeed(theFeed) {
// Convert the URL to a feed:// scheme because Safari // Convert the URL to a feed:// scheme because Safari