comparison 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
comparison
equal deleted inserted replaced
24:ff0393719d57 25:da483ce3832d
339 if (titleElement !== null) { 339 if (titleElement !== null) {
340 title = titleElement.textContent.trim(); 340 title = titleElement.textContent.trim();
341 } 341 }
342 342
343 let linkElement = feedQueryXPath(this.document, entryElement, 343 let linkElement = feedQueryXPath(this.document, entryElement,
344 './atom03:link[@href][@rel="alternate"]'); 344 './atom03:link[@href][@rel~="alternate"]');
345 if (linkElement !== null) { 345 if (linkElement !== null) {
346 link = parseURL(linkElement.getAttribute('href'), this.url); 346 link = parseURL(linkElement.getAttribute('href'), this.url);
347 } 347 }
348 348
349 let modifiedElement = feedQueryXPath(this.document, entryElement, 349 let modifiedElement = feedQueryXPath(this.document, entryElement,
513 if (titleElement !== null) { 513 if (titleElement !== null) {
514 title = this.parseAtomTextConstruct(titleElement); 514 title = this.parseAtomTextConstruct(titleElement);
515 } 515 }
516 516
517 let linkElement = feedQueryXPath(this.document, entryElement, 517 let linkElement = feedQueryXPath(this.document, entryElement,
518 './atom:link[@href][not(@rel) or @rel="alternate"]'); 518 './atom:link[@href][not(@rel) or @rel~="alternate"]');
519 if (linkElement !== null) { 519 if (linkElement !== null) {
520 link = parseURL(linkElement.getAttribute('href'), this.url); 520 link = parseURL(linkElement.getAttribute('href'), this.url);
521 } 521 }
522 522
523 let updatedElement = feedQueryXPath(this.document, entryElement, 523 let updatedElement = feedQueryXPath(this.document, entryElement,
538 content = this.parseAtomTextConstruct(summaryElement, false); 538 content = this.parseAtomTextConstruct(summaryElement, false);
539 } 539 }
540 } 540 }
541 541
542 for (let enclosureElement of feedQueryXPathAll(this.document, 542 for (let enclosureElement of feedQueryXPathAll(this.document,
543 entryElement, './atom:link[@href][@rel="enclosure"]')) { 543 entryElement, './atom:link[@href][@rel~="enclosure"]')) {
544 try { 544 try {
545 let entryFile = this.parseAtomEntryFile(enclosureElement); 545 let entryFile = this.parseAtomEntryFile(enclosureElement);
546 files.push(entryFile); 546 files.push(entryFile);
547 } catch (e) { 547 } catch (e) {
548 if (!(e instanceof TypeError)) { 548 if (!(e instanceof TypeError)) {