addons/firefox-addons/feed-preview

changeset 28:104a1faebd43

Fix XPath query syntax
author Guido Berhoerster <guido+feed-preview@berhoerster.name>
date Mon Jan 21 08:22:52 2019 +0100 (16 months ago)
parents 15b828787c8b
children 688d75e554e0
files js/feed-parser.js
line diff
     1.1 --- a/js/feed-parser.js	Sun Jan 20 17:52:22 2019 +0100
     1.2 +++ b/js/feed-parser.js	Mon Jan 21 08:22:52 2019 +0100
     1.3 @@ -341,7 +341,8 @@
     1.4          }
     1.5  
     1.6          let linkElement = feedQueryXPath(this.document, entryElement,
     1.7 -                './atom03:link[@href][@rel~="alternate"]');
     1.8 +                './atom03:link[@href][contains(concat(" ", ' +
     1.9 +                'normalize-space(@rel), " "), " alternate ")]');
    1.10          if (linkElement !== null) {
    1.11              link = parseURL(linkElement.getAttribute('href'), this.url);
    1.12          }
    1.13 @@ -515,7 +516,8 @@
    1.14          }
    1.15  
    1.16          let linkElement = feedQueryXPath(this.document, entryElement,
    1.17 -                './atom:link[@href][not(@rel) or @rel~="alternate"]');
    1.18 +                './atom:link[@href][not(@rel) or contains(concat(" ", ' +
    1.19 +                'normalize-space(@rel), " "), " alternate ")]');
    1.20          if (linkElement !== null) {
    1.21              link = parseURL(linkElement.getAttribute('href'), this.url);
    1.22          }
    1.23 @@ -540,7 +542,9 @@
    1.24          }
    1.25  
    1.26          for (let enclosureElement of feedQueryXPathAll(this.document,
    1.27 -                entryElement, './atom:link[@href][@rel~="enclosure"]')) {
    1.28 +                entryElement, './atom:link[@href]' +
    1.29 +                '[contains(concat(" ", normalize-space(@rel), " "), ' +
    1.30 +                '" enclosure ")]')) {
    1.31              try {
    1.32                  let entryFile = this.parseAtomEntryFile(enclosureElement);
    1.33                  files.push(entryFile);