⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact cd8e1862b7eba0f20fc39edb18fe290e85fd6eec2d296dd6c4971c67a1412412:


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 6d 75 6c 74 69 70 6c 65 20 6e  elect multiple n
0030: 6f 64 65 73 20 69 6e 20 74 68 65 20 44 4f 4d 0a  odes in the DOM.
0040: 20 2a 20 40 70 61 72 61 6d 20 20 20 7b 20 53 74   * @param   { St
0050: 72 69 6e 67 20 7d 20 73 65 6c 65 63 74 6f 72 20  ring } selector 
0060: 2d 20 44 4f 4d 20 73 65 6c 65 63 74 6f 72 0a 20  - DOM selector. 
0070: 2a 20 40 70 61 72 61 6d 20 20 20 7b 20 4f 62 6a  * @param   { Obj
0080: 65 63 74 20 7d 20 63 74 78 20 2d 20 44 4f 4d 20  ect } ctx - DOM 
0090: 6e 6f 64 65 20 77 68 65 72 65 20 74 68 65 20 74  node where the t
00a0: 61 72 67 65 74 73 20 6f 66 20 6f 75 72 20 73 65  argets of our se
00b0: 61 72 63 68 20 77 69 6c 6c 20 69 73 20 6c 6f 63  arch will is loc
00c0: 61 74 65 64 0a 20 2a 20 40 72 65 74 75 72 6e 73  ated. * @returns
00d0: 20 7b 20 4f 62 6a 65 63 74 20 7d 20 64 6f 6d 20   { Object } dom 
00e0: 6e 6f 64 65 73 20 66 6f 75 6e 64 0a 20 2a 2f 0a  nodes found. */.
00f0: 65 78 70 6f 72 74 20 64 65 66 61 75 6c 74 20 66  export default f
0100: 75 6e 63 74 69 6f 6e 20 24 24 28 73 65 6c 65 63  unction $$(selec
0110: 74 6f 72 2c 20 63 74 78 29 20 7b 0a 20 20 72 65  tor, ctx) {.  re
0120: 74 75 72 6e 20 5b 5d 2e 73 6c 69 63 65 2e 63 61  turn [].slice.ca
0130: 6c 6c 28 28 63 74 78 20 7c 7c 20 64 6f 63 75 6d  ll((ctx || docum
0140: 65 6e 74 29 2e 71 75 65 72 79 53 65 6c 65 63 74  ent).querySelect
0150: 6f 72 41 6c 6c 28 73 65 6c 65 63 74 6f 72 29 29  orAll(selector))
0160: 0a 7d                                            .}