From 0320bf29263a3f9fbe0d18261bed103e6cba6cbc Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 25 Jun 2019 20:43:13 +0200 Subject: [PATCH] fix(): dont error --- src/components/icon/icon.tsx | 4 +--- src/components/icon/request.ts | 4 ++-- src/components/icon/validate.ts | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx index 2c365215..aa280f88 100755 --- a/src/components/icon/icon.tsx +++ b/src/components/icon/icon.tsx @@ -119,10 +119,8 @@ export class Icon { if (Build.isBrowser && this.isVisible) { const url = getUrl(this); if (url) { - getSvgContent(this.el.ownerDocument as any, url) + getSvgContent(url) .then(svgContent => this.svgContent = svgContent); - } else { - console.error('icon was not resolved'); } } diff --git a/src/components/icon/request.ts b/src/components/icon/request.ts index 3cb00fea..a59b8fbc 100644 --- a/src/components/icon/request.ts +++ b/src/components/icon/request.ts @@ -4,7 +4,7 @@ import { validateContent } from './validate'; const requests = new Map>(); -export const getSvgContent = (doc: Document, url: string) => { +export const getSvgContent = (url: string) => { // see if we already have a request for this url let req = requests.get(url); @@ -16,7 +16,7 @@ export const getSvgContent = (doc: Document, url: string) => { } return Promise.resolve(null); - }).then(svgContent => validateContent(doc, svgContent)); + }).then(svgContent => validateContent(svgContent)); // cache for the same requests requests.set(url, req); diff --git a/src/components/icon/validate.ts b/src/components/icon/validate.ts index 3ee7a34a..b93ed8a0 100644 --- a/src/components/icon/validate.ts +++ b/src/components/icon/validate.ts @@ -2,11 +2,10 @@ import { isStr } from './utils'; export const validateContent = ( - doc: Document, svgContent: string | null ) => { if (svgContent) { - const div = doc.createElement('div'); + const div = document.createElement('div'); div.innerHTML = svgContent; // setup this way to ensure it works on our buddy IE