-
Notifications
You must be signed in to change notification settings - Fork 28
/
tsimmes.umd.js
35 lines (31 loc) · 1.21 KB
/
tsimmes.umd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
let $ = ((document, s_querySelectorAll, $) => (
($ = (s, context, tsimmes=[]) => (
s && tsimmes.push( // if s is truly then push the following
...(s.dispatchEvent // if arg is node or window,
? [s] // then pass [s]
: "" + s === s // else if arg is a string
? /</.test(s) // if the string contains "<" (if HTML code is passed)
// then parse it and return node.children
// use 'undefined' (HTMLUnknownElement) if context is not presented
? ((context = document.createElement(context)).innerHTML = s
, context.children)
: context // else if context is truly
? ((context = $(context)[0]) // if context element is found
? context[s_querySelectorAll](s) // then select element from context
: tsimmes) // else pass [] (context isn't found)
: document[s_querySelectorAll](s) // else select elements globally
: s)), // else guessing that s variable is array-like Object
tsimmes
)),
($.one = (s, context) => $(s, context)[0]),
$
))(document, 'querySelectorAll');
if (typeof define == 'function' && define.amd) {
define([], () => $);
} else if (typeof module == 'object' && module.exports) {
module.exports = $;
} else {
this.$ = $;
}
};