⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact ef08a0e3535006dd3895a080c8a71ef978187e8090b33ec69ff0f10c0327a622:


0000: 2f 2a 2a 0a 20 2a 20 47 65 74 20 74 68 65 20 76  /**. * Get the v
0010: 61 6c 75 65 20 6f 66 20 61 6e 79 20 44 4f 4d 20  alue of any DOM 
0020: 61 74 74 72 69 62 75 74 65 20 6f 6e 20 61 20 6e  attribute on a n
0030: 6f 64 65 0a 20 2a 20 40 70 61 72 61 6d 20 20 20  ode. * @param   
0040: 7b 20 4f 62 6a 65 63 74 20 7d 20 64 6f 6d 20 2d  { Object } dom -
0050: 20 44 4f 4d 20 6e 6f 64 65 20 77 65 20 77 61 6e   DOM node we wan
0060: 74 20 74 6f 20 70 61 72 73 65 0a 20 2a 20 40 70  t to parse. * @p
0070: 61 72 61 6d 20 20 20 7b 20 53 74 72 69 6e 67 20  aram   { String 
0080: 7d 20 6e 61 6d 65 20 2d 20 6e 61 6d 65 20 6f 66  } name - name of
0090: 20 74 68 65 20 61 74 74 72 69 62 75 74 65 20 77   the attribute w
00a0: 65 20 77 61 6e 74 20 74 6f 20 67 65 74 0a 20 2a  e want to get. *
00b0: 20 40 72 65 74 75 72 6e 73 20 7b 20 53 74 72 69   @returns { Stri
00c0: 6e 67 20 7c 20 75 6e 64 65 66 69 6e 65 64 20 7d  ng | undefined }
00d0: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 6e 6f 64   name of the nod
00e0: 65 20 61 74 74 72 69 62 75 74 65 20 77 68 65 74  e attribute whet
00f0: 68 65 72 20 69 74 20 65 78 69 73 74 73 0a 20 2a  her it exists. *
0100: 2f 0a 65 78 70 6f 72 74 20 64 65 66 61 75 6c 74  /.export default
0110: 20 66 75 6e 63 74 69 6f 6e 20 67 65 74 41 74 74   function getAtt
0120: 72 69 62 75 74 65 28 64 6f 6d 2c 20 6e 61 6d 65  ribute(dom, name
0130: 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 64 6f 6d  ) {.  return dom
0140: 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 6e 61  .getAttribute(na
0150: 6d 65 29 0a 7d                                   me).}