Mercurial > addons > firefox-addons > feed-preview
diff js/feed-parser.js @ 28:104a1faebd43
Fix XPath query syntax
author | Guido Berhoerster <guido+feed-preview@berhoerster.name> |
---|---|
date | Mon, 21 Jan 2019 08:22:52 +0100 |
parents | da483ce3832d |
children | 76e23b361e92 |
line wrap: on
line diff
--- a/js/feed-parser.js Sun Jan 20 17:52:22 2019 +0100 +++ b/js/feed-parser.js Mon Jan 21 08:22:52 2019 +0100 @@ -341,7 +341,8 @@ } let linkElement = feedQueryXPath(this.document, entryElement, - './atom03:link[@href][@rel~="alternate"]'); + './atom03:link[@href][contains(concat(" ", ' + + 'normalize-space(@rel), " "), " alternate ")]'); if (linkElement !== null) { link = parseURL(linkElement.getAttribute('href'), this.url); } @@ -515,7 +516,8 @@ } let linkElement = feedQueryXPath(this.document, entryElement, - './atom:link[@href][not(@rel) or @rel~="alternate"]'); + './atom:link[@href][not(@rel) or contains(concat(" ", ' + + 'normalize-space(@rel), " "), " alternate ")]'); if (linkElement !== null) { link = parseURL(linkElement.getAttribute('href'), this.url); } @@ -540,7 +542,9 @@ } for (let enclosureElement of feedQueryXPathAll(this.document, - entryElement, './atom:link[@href][@rel~="enclosure"]')) { + entryElement, './atom:link[@href]' + + '[contains(concat(" ", normalize-space(@rel), " "), ' + + '" enclosure ")]')) { try { let entryFile = this.parseAtomEntryFile(enclosureElement); files.push(entryFile);