A generic utility object that contains functions used throughout
MetacatUI to perform useful functions related to icons, but not used to store or
manipulate any state about the application.
- Since:
- Source:
Methods
fetchIcon(pid) → {string}
Fetches an SVG given a pid, sanitizes it, then returns the SVG string (after
sanitizing it).
Parameters:
Name |
Type |
Description |
pid |
string
|
|
- Source:
Returns:
The icon data.
-
Type
-
string
isSVG(str) → {Boolean}
Simple test to see if a string is an SVG
Parameters:
Name |
Type |
Description |
str |
string
|
The string to check |
- Source:
Returns:
Returns true if the string starts with `
-
Type
-
Boolean
sanitizeIcon(icon) → {string}
Takes an SVG string and returns it with only the allowed tags and attributes
Parameters:
Name |
Type |
Description |
icon |
string
|
The SVG icon string to sanitize |
- Source:
Returns:
Sanitized icon string.
-
Type
-
string