Merge pull request #1443 from dpalou/MOBILE-2550

MOBILE-2550 core: Fix error when iterating querySelectorAll
main
Juan Leyva 2018-08-21 14:51:10 +01:00 committed by GitHub
commit 6483bff49a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -682,7 +682,7 @@ export class CoreDomUtilsProvider {
const element = this.convertToElement(html); const element = this.convertToElement(html);
// Treat elements with src (img, audio, video, ...). // Treat elements with src (img, audio, video, ...).
media = element.querySelectorAll('img, video, audio, source, track'); media = Array.from(element.querySelectorAll('img, video, audio, source, track'));
media.forEach((media: HTMLElement) => { media.forEach((media: HTMLElement) => {
let newSrc = paths[this.textUtils.decodeURIComponent(media.getAttribute('src'))]; let newSrc = paths[this.textUtils.decodeURIComponent(media.getAttribute('src'))];
@ -700,7 +700,7 @@ export class CoreDomUtilsProvider {
}); });
// Now treat links. // Now treat links.
anchors = element.querySelectorAll('a'); anchors = Array.from(element.querySelectorAll('a'));
anchors.forEach((anchor: HTMLElement) => { anchors.forEach((anchor: HTMLElement) => {
const href = this.textUtils.decodeURIComponent(anchor.getAttribute('href')), const href = this.textUtils.decodeURIComponent(anchor.getAttribute('href')),
newUrl = paths[href]; newUrl = paths[href];