⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact a99c32bb39502359a10c46ec36338a32ce9a14110700654a0e926f41d16f68a0:


0000: 2f 2a 2a 0a 20 2a 20 43 68 65 63 6b 20 69 66 20  /**. * Check if 
0010: 61 20 44 4f 4d 20 6e 6f 64 65 20 69 73 20 61 6e  a DOM node is an
0020: 20 73 76 67 20 74 61 67 20 6f 72 20 70 61 72 74   svg tag or part
0030: 20 6f 66 20 61 6e 20 73 76 67 0a 20 2a 20 40 70   of an svg. * @p
0040: 61 72 61 6d 20 20 20 7b 20 48 54 4d 4c 45 6c 65  aram   { HTMLEle
0050: 6d 65 6e 74 20 7d 20 20 65 6c 20 2d 20 6e 6f 64  ment }  el - nod
0060: 65 20 77 65 20 77 61 6e 74 20 74 6f 20 74 65 73  e we want to tes
0070: 74 0a 20 2a 20 40 72 65 74 75 72 6e 73 20 7b 42  t. * @returns {B
0080: 6f 6f 6c 65 61 6e 7d 20 74 72 75 65 20 69 66 20  oolean} true if 
0090: 69 74 27 73 20 61 6e 20 73 76 67 20 6e 6f 64 65  it's an svg node
00a0: 0a 20 2a 2f 0a 65 78 70 6f 72 74 20 64 65 66 61  . */.export defa
00b0: 75 6c 74 20 66 75 6e 63 74 69 6f 6e 20 69 73 53  ult function isS
00c0: 76 67 28 65 6c 29 20 7b 0a 20 20 63 6f 6e 73 74  vg(el) {.  const
00d0: 20 6f 77 6e 65 72 20 3d 20 65 6c 2e 6f 77 6e 65   owner = el.owne
00e0: 72 53 56 47 45 6c 65 6d 65 6e 74 0a 20 20 72 65  rSVGElement.  re
00f0: 74 75 72 6e 20 21 21 6f 77 6e 65 72 20 7c 7c 20  turn !!owner || 
0100: 6f 77 6e 65 72 20 3d 3d 3d 20 6e 75 6c 6c 0a 7d  owner === null.}