-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
57 lines (41 loc) · 890 Bytes
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* @module queried
*/
var doc = require('get-doc');
var q = require('./lib/');
/**
* Detect unsupported css4 features, polyfill them
*/
//detect `:scope`
try {
doc.querySelector(':scope');
}
catch (e) {
q.registerFilter('scope', require('./lib/pseudos/scope'));
}
//detect `:has`
try {
doc.querySelector(':has');
}
catch (e) {
q.registerFilter('has', require('./lib/pseudos/has'));
//polyfilled :has requires artificial :not to make `:not(:has(...))`.
q.registerFilter('not', require('./lib/pseudos/not'));
}
//detect `:root`
try {
doc.querySelector(':root');
}
catch (e) {
q.registerFilter('root', require('./lib/pseudos/root'));
}
//detect `:matches`
try {
doc.querySelector(':matches');
}
catch (e) {
q.registerFilter('matches', require('./lib/pseudos/matches'));
}
/** Helper methods */
q.matches = require('./lib/pseudos/matches');
module.exports = q;