diff js/feed-parser.js @ 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 3fcd2209b39a
children 104a1faebd43
line wrap: on
line diff
--- 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);