main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
822 bytes
|
Line | |
---|
1 | var specificity = require('./specificity');
|
---|
2 |
|
---|
3 | function specificitiesOverlap(selector1, selector2, cache) {
|
---|
4 | var specificity1;
|
---|
5 | var specificity2;
|
---|
6 | var i, l;
|
---|
7 | var j, m;
|
---|
8 |
|
---|
9 | for (i = 0, l = selector1.length; i < l; i++) {
|
---|
10 | specificity1 = findSpecificity(selector1[i][1], cache);
|
---|
11 |
|
---|
12 | for (j = 0, m = selector2.length; j < m; j++) {
|
---|
13 | specificity2 = findSpecificity(selector2[j][1], cache);
|
---|
14 |
|
---|
15 | if (specificity1[0] === specificity2[0]
|
---|
16 | && specificity1[1] === specificity2[1]
|
---|
17 | && specificity1[2] === specificity2[2]) {
|
---|
18 | return true;
|
---|
19 | }
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | return false;
|
---|
24 | }
|
---|
25 |
|
---|
26 | function findSpecificity(selector, cache) {
|
---|
27 | var value;
|
---|
28 |
|
---|
29 | if (!(selector in cache)) {
|
---|
30 | cache[selector] = value = specificity(selector);
|
---|
31 | }
|
---|
32 |
|
---|
33 | return value || cache[selector];
|
---|
34 | }
|
---|
35 |
|
---|
36 | module.exports = specificitiesOverlap;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.