Total Complexity | 9 |
Complexity/F | 1.8 |
Lines of Code | 34 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | castor._appendTo = function( el, tag, attributes ) { |
||
|
|||
2 | var newEl = castor._createEl( tag, attributes ); |
||
3 | el.appendChild( newEl ); |
||
4 | return newEl; |
||
5 | }; |
||
6 | |||
7 | castor._createEl = function( tag, attributes ) { |
||
8 | var el = ( typeof tag === 'string' ) ? document.createElement( tag ) : tag; |
||
9 | attributes = attributes || {}; |
||
10 | for( var key in attributes ) { |
||
11 | if( !attributes.hasOwnProperty( key ))continue; |
||
12 | el.setAttribute( key, attributes[ key ] ); |
||
13 | } |
||
14 | return el; |
||
15 | }; |
||
16 | |||
17 | castor._insertAfter = function( el, tag, attributes ) { |
||
18 | var newEl = castor._createEl( tag, attributes ); |
||
19 | el.parentNode.insertBefore( newEl, el.nextSibling ); |
||
20 | return newEl; |
||
21 | }; |
||
22 | |||
23 | castor._insertBefore = function( el, tag, attributes ) { |
||
24 | var newEl = castor._createEl( tag, attributes ); |
||
25 | el.parentNode.insertBefore( newEl, el ); |
||
26 | return newEl; |
||
27 | }; |
||
28 | |||
29 | castor._removeEl = function( selector, parent ) { |
||
30 | var el = parent.querySelector( selector ); |
||
31 | if( el !== null ) { |
||
32 | el.parentNode.removeChild( el ); |
||
33 | } |
||
34 | }; |
||
35 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.