⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact 2c28fbbf07d790462b2cf69987f00a3f45c00fce7f6f7f9ac3afbaa8edd53396:


0000: 69 6d 70 6f 72 74 20 7b 20 53 56 47 5f 4e 53 20  import { SVG_NS 
0010: 7d 20 66 72 6f 6d 20 27 2e 2f 2e 2e 2f 2e 2e 2f  } from './../../
0020: 67 6c 6f 62 61 6c 2d 76 61 72 69 61 62 6c 65 73  global-variables
0030: 27 0a 2f 2a 2a 0a 20 2a 20 43 72 65 61 74 65 20  './**. * Create 
0040: 61 20 67 65 6e 65 72 69 63 20 44 4f 4d 20 6e 6f  a generic DOM no
0050: 64 65 0a 20 2a 20 40 70 61 72 61 6d 20 20 20 7b  de. * @param   {
0060: 20 53 74 72 69 6e 67 20 7d 20 6e 61 6d 65 20 2d   String } name -
0070: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 44 4f 4d   name of the DOM
0080: 20 6e 6f 64 65 20 77 65 20 77 61 6e 74 20 74 6f   node we want to
0090: 20 63 72 65 61 74 65 0a 20 2a 20 40 72 65 74 75   create. * @retu
00a0: 72 6e 73 20 7b 20 4f 62 6a 65 63 74 20 7d 20 44  rns { Object } D
00b0: 4f 4d 20 6e 6f 64 65 20 6a 75 73 74 20 63 72 65  OM node just cre
00c0: 61 74 65 64 0a 20 2a 2f 0a 65 78 70 6f 72 74 20  ated. */.export 
00d0: 64 65 66 61 75 6c 74 20 66 75 6e 63 74 69 6f 6e  default function
00e0: 20 6d 61 6b 65 45 6c 65 6d 65 6e 74 28 6e 61 6d   makeElement(nam
00f0: 65 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e 61  e) {.  return na
0100: 6d 65 20 3d 3d 3d 20 27 73 76 67 27 20 3f 20 64  me === 'svg' ? d
0110: 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c  ocument.createEl
0120: 65 6d 65 6e 74 4e 53 28 53 56 47 5f 4e 53 2c 20  ementNS(SVG_NS, 
0130: 6e 61 6d 65 29 20 3a 20 64 6f 63 75 6d 65 6e 74  name) : document
0140: 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 6e  .createElement(n
0150: 61 6d 65 29 0a 7d                                ame).}