|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
594 bytes
|
| Line | |
|---|
| 1 | var MODIFIER_PATTERN = /--.+$/;
|
|---|
| 2 |
|
|---|
| 3 | function rulesOverlap(rule1, rule2, bemMode) {
|
|---|
| 4 | var scope1;
|
|---|
| 5 | var scope2;
|
|---|
| 6 | var i, l;
|
|---|
| 7 | var j, m;
|
|---|
| 8 |
|
|---|
| 9 | for (i = 0, l = rule1.length; i < l; i++) {
|
|---|
| 10 | scope1 = rule1[i][1];
|
|---|
| 11 |
|
|---|
| 12 | for (j = 0, m = rule2.length; j < m; j++) {
|
|---|
| 13 | scope2 = rule2[j][1];
|
|---|
| 14 |
|
|---|
| 15 | if (scope1 == scope2) {
|
|---|
| 16 | return true;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | if (bemMode && withoutModifiers(scope1) == withoutModifiers(scope2)) {
|
|---|
| 20 | return true;
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | return false;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | function withoutModifiers(scope) {
|
|---|
| 29 | return scope.replace(MODIFIER_PATTERN, '');
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | module.exports = rulesOverlap;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.