ng-inline-svg
Advanced tools
Comparing version 5.1.3 to 5.1.4
@@ -60,3 +60,4 @@ "use strict"; | ||
var elSvgUse = document.createElementNS('http://www.w3.org/2000/svg', 'use'); | ||
elSvgUse.setAttributeNS('http://www.w3.org/1999/xlink', 'href', this.inlineSVG); | ||
var url = this._svgCache.getAbsoluteUrl(this.inlineSVG); | ||
elSvgUse.setAttributeNS('http://www.w3.org/1999/xlink', 'href', url); | ||
elSvg.appendChild(elSvgUse); | ||
@@ -63,0 +64,0 @@ this._insertEl(elSvg); |
@@ -17,5 +17,5 @@ import { HttpClient } from '@angular/common/http'; | ||
setBaseUrl(config: InlineSVGConfig): void; | ||
private _getAbsoluteUrl(url); | ||
getAbsoluteUrl(url: string): string; | ||
private _svgElementFromString(str); | ||
private _cloneSVG(svg); | ||
} |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (cache === void 0) { cache = true; } | ||
var absUrl = this._getAbsoluteUrl(url); | ||
var absUrl = this.getAbsoluteUrl(url); | ||
if (cache && SVGCacheService._cache.has(absUrl)) { | ||
@@ -55,3 +55,3 @@ return Observable_1.Observable.of(this._cloneSVG(SVGCacheService._cache.get(absUrl))); | ||
}; | ||
SVGCacheService.prototype._getAbsoluteUrl = function (url) { | ||
SVGCacheService.prototype.getAbsoluteUrl = function (url) { | ||
if (SVGCacheService._baseUrl && !/^https?:\/\//i.test(url)) { | ||
@@ -58,0 +58,0 @@ url = SVGCacheService._baseUrl + url; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"SVGCacheService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],null],"parameters":[{"__symbolic":"reference","module":"./inline-svg.config","name":"InlineSVGConfig"},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient"}]}],"getSVG":[{"__symbolic":"method"}],"setBaseUrl":[{"__symbolic":"method"}],"_getAbsoluteUrl":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":14,"character":17},"_baseUrl":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}},{"__symbolic":"module","version":1,"metadata":{"SVGCacheService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],null],"parameters":[{"__symbolic":"reference","module":"./inline-svg.config","name":"InlineSVGConfig"},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient"}]}],"getSVG":[{"__symbolic":"method"}],"setBaseUrl":[{"__symbolic":"method"}],"_getAbsoluteUrl":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":14,"character":17},"_baseUrl":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"SVGCacheService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],null],"parameters":[{"__symbolic":"reference","module":"./inline-svg.config","name":"InlineSVGConfig"},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient"}]}],"getSVG":[{"__symbolic":"method"}],"setBaseUrl":[{"__symbolic":"method"}],"getAbsoluteUrl":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":14,"character":17},"_baseUrl":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}},{"__symbolic":"module","version":1,"metadata":{"SVGCacheService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}],null],"parameters":[{"__symbolic":"reference","module":"./inline-svg.config","name":"InlineSVGConfig"},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient"}]}],"getSVG":[{"__symbolic":"method"}],"setBaseUrl":[{"__symbolic":"method"}],"getAbsoluteUrl":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":14,"character":17},"_baseUrl":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}}] |
{ | ||
"name": "ng-inline-svg", | ||
"version": "5.1.3", | ||
"version": "5.1.4", | ||
"description": "Angular 4+ directive for inserting an SVG inline within an element.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -102,3 +102,4 @@ import { | ||
const elSvgUse = document.createElementNS('http://www.w3.org/2000/svg', 'use'); | ||
elSvgUse.setAttributeNS('http://www.w3.org/1999/xlink', 'href', this.inlineSVG); | ||
const url = this._svgCache.getAbsoluteUrl(this.inlineSVG); | ||
elSvgUse.setAttributeNS('http://www.w3.org/1999/xlink', 'href', url); | ||
elSvg.appendChild(elSvgUse); | ||
@@ -105,0 +106,0 @@ |
@@ -36,3 +36,3 @@ import { Injectable, Optional } from '@angular/core'; | ||
getSVG(url: string, cache: boolean = true): Observable<SVGElement> { | ||
const absUrl = this._getAbsoluteUrl(url); | ||
const absUrl = this.getAbsoluteUrl(url); | ||
@@ -73,3 +73,3 @@ // Return cached copy if it exists | ||
private _getAbsoluteUrl(url: string): string { | ||
getAbsoluteUrl(url: string): string { | ||
// Prepend user-configured base if present and URL doesn't seem to have its own | ||
@@ -76,0 +76,0 @@ if (SVGCacheService._baseUrl && !/^https?:\/\//i.test(url)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54618
857