MCPcopy
hub / github.com/maxwellito/vivus / Pathformer

Function Pathformer

src/pathformer.js:19–42  ·  view source on GitHub ↗

* Class constructor * * @param {DOM|String} element Dom element of the SVG or id of it

(element)

Source from the content-addressed store, hash-verified

17 * @param {DOM|String} element Dom element of the SVG or id of it
18 */
19function Pathformer(element) {
20 // Test params
21 if (typeof element === 'undefined') {
22 throw new Error('Pathformer [constructor]: "element" parameter is required');
23 }
24
25 // Set the element
26 if (element.constructor === String) {
27 element = document.getElementById(element);
28 if (!element) {
29 throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID');
30 }
31 }
32 if (element instanceof window.SVGElement ||
33 element instanceof window.SVGGElement ||
34 /^svg$/i.test(element.nodeName)) {
35 this.el = element;
36 } else {
37 throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement');
38 }
39
40 // Start
41 this.scan(element);
42}
43
44/**
45 * List of tags which can be transformed

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected