changeset 25:da483ce3832d

Fix selector for rel attributes The rel attribute may contain a list of words to describe link relationships, thus use the corect selector for that.
author Guido Berhoerster <guido+feed-preview@berhoerster.name>
date Fri, 28 Dec 2018 12:27:16 +0100
parents ff0393719d57
children f0c4a458869c
files content_scripts/feed-probe.js js/feed-parser.js
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/content_scripts/feed-probe.js	Sun Dec 16 10:29:19 2018 +0100
+++ b/content_scripts/feed-probe.js	Fri Dec 28 12:27:16 2018 +0100
@@ -13,7 +13,7 @@
 function getFeeds() {
     let urlsFeeds = new Map();
     let elements = document.querySelectorAll(':-moz-any(link, a)[href]' +
-            '[rel=alternate]:-moz-any([type="application/atom+xml"], ' +
+            '[rel~=alternate]:-moz-any([type="application/atom+xml"], ' +
             '[type="application/rss+xml"])');
 
     for (let element of elements) {
--- a/js/feed-parser.js	Sun Dec 16 10:29:19 2018 +0100
+++ b/js/feed-parser.js	Fri Dec 28 12:27:16 2018 +0100
@@ -341,7 +341,7 @@
         }
 
         let linkElement = feedQueryXPath(this.document, entryElement,
-                './atom03:link[@href][@rel="alternate"]');
+                './atom03:link[@href][@rel~="alternate"]');
         if (linkElement !== null) {
             link = parseURL(linkElement.getAttribute('href'), this.url);
         }
@@ -515,7 +515,7 @@
         }
 
         let linkElement = feedQueryXPath(this.document, entryElement,
-                './atom:link[@href][not(@rel) or @rel="alternate"]');
+                './atom:link[@href][not(@rel) or @rel~="alternate"]');
         if (linkElement !== null) {
             link = parseURL(linkElement.getAttribute('href'), this.url);
         }
@@ -540,7 +540,7 @@
         }
 
         for (let enclosureElement of feedQueryXPathAll(this.document,
-                entryElement, './atom:link[@href][@rel="enclosure"]')) {
+                entryElement, './atom:link[@href][@rel~="enclosure"]')) {
             try {
                 let entryFile = this.parseAtomEntryFile(enclosureElement);
                 files.push(entryFile);