MCPcopy
hub / github.com/ionic-team/ionicons / isValid

Function isValid

src/components/icon/validate.ts:30–50  ·  view source on GitHub ↗
(elm: HTMLElement)

Source from the content-addressed store, hash-verified

28};
29
30export const isValid = (elm: HTMLElement) => {
31 if (elm.nodeType === 1) {
32 if (elm.nodeName.toLowerCase() === 'script') {
33 return false;
34 }
35
36 for (let i = 0; i < elm.attributes.length; i++) {
37 const name = elm.attributes[i].name;
38 if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {
39 return false;
40 }
41 }
42
43 for (let i = 0; i < elm.childNodes.length; i++) {
44 if (!isValid(elm.childNodes[i] as any)) {
45 return false;
46 }
47 }
48 }
49 return true;
50};
51
52export const isSvgDataUrl = (url: string) => url.startsWith('data:image/svg+xml');
53export const isEncodedDataUrl = (url: string) => url.indexOf(';utf8,') !== -1;

Callers 2

validate.spec.tsFile · 0.90
validateContentFunction · 0.85

Calls 1

isStrFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…