1 |
|
2 |
|
3 | 'use strict';
|
4 |
|
5 | const rangeOperators = ['>=', '<=', '>', '<', '='];
|
6 | const styleSearch = require('style-search');
|
7 |
|
8 | module.exports = function (atRule, cb) {
|
9 | if (atRule.name.toLowerCase() !== 'media') {
|
10 | return;
|
11 | }
|
12 |
|
13 | const params = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
|
14 |
|
15 | styleSearch({ source: params, target: rangeOperators }, (match) => {
|
16 | const before = params[match.startIndex - 1];
|
17 |
|
18 | if (before === '>' || before === '<') {
|
19 | return;
|
20 | }
|
21 |
|
22 | cb(match, params, atRule);
|
23 | });
|
24 | };
|