* Class constructor * * @param {DOM|String} element Dom element of the SVG or id of it
(element)
| 17 | * @param {DOM|String} element Dom element of the SVG or id of it |
| 18 | */ |
| 19 | function 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 |
nothing calls this directly
no outgoing calls
no test coverage detected