⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact 2a79f0af88d9003397406ed362b1afe7cca5e791c7534857b0d7e5212eb2587f:


0000: 2f 2a 2a 0a 20 2a 20 53 68 6f 72 74 65 72 20 61  /**. * Shorter a
0010: 6e 64 20 66 61 73 74 20 77 61 79 20 74 6f 20 73  nd fast way to s
0020: 65 6c 65 63 74 20 61 20 73 69 6e 67 6c 65 20 6e  elect a single n
0030: 6f 64 65 20 69 6e 20 74 68 65 20 44 4f 4d 0a 20  ode in the DOM. 
0040: 2a 20 40 70 61 72 61 6d 20 20 20 7b 20 53 74 72  * @param   { Str
0050: 69 6e 67 20 7d 20 73 65 6c 65 63 74 6f 72 20 2d  ing } selector -
0060: 20 75 6e 69 71 75 65 20 64 6f 6d 20 73 65 6c 65   unique dom sele
0070: 63 74 6f 72 0a 20 2a 20 40 70 61 72 61 6d 20 20  ctor. * @param  
0080: 20 7b 20 4f 62 6a 65 63 74 20 7d 20 63 74 78 20   { Object } ctx 
0090: 2d 20 44 4f 4d 20 6e 6f 64 65 20 77 68 65 72 65  - DOM node where
00a0: 20 74 68 65 20 74 61 72 67 65 74 20 6f 66 20 6f   the target of o
00b0: 75 72 20 73 65 61 72 63 68 20 77 69 6c 6c 20 69  ur search will i
00c0: 73 20 6c 6f 63 61 74 65 64 0a 20 2a 20 40 72 65  s located. * @re
00d0: 74 75 72 6e 73 20 7b 20 4f 62 6a 65 63 74 20 7d  turns { Object }
00e0: 20 64 6f 6d 20 6e 6f 64 65 20 66 6f 75 6e 64 0a   dom node found.
00f0: 20 2a 2f 0a 65 78 70 6f 72 74 20 64 65 66 61 75   */.export defau
0100: 6c 74 20 66 75 6e 63 74 69 6f 6e 20 24 28 73 65  lt function $(se
0110: 6c 65 63 74 6f 72 2c 20 63 74 78 29 20 7b 0a 20  lector, ctx) {. 
0120: 20 72 65 74 75 72 6e 20 28 63 74 78 20 7c 7c 20   return (ctx || 
0130: 64 6f 63 75 6d 65 6e 74 29 2e 71 75 65 72 79 53  document).queryS
0140: 65 6c 65 63 74 6f 72 28 73 65 6c 65 63 74 6f 72  elector(selector
0150: 29 0a 7d                                         ).}