main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 5 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
661 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | var Token = require('../../tokenizer/token');
|
---|
| 2 |
|
---|
| 3 | var serializeAll = require('../../writer/one-time').all;
|
---|
| 4 | var serializeRules = require('../../writer/one-time').rules;
|
---|
| 5 |
|
---|
| 6 | function removeDuplicateMediaQueries(tokens) {
|
---|
| 7 | var candidates = {};
|
---|
| 8 | var candidate;
|
---|
| 9 | var token;
|
---|
| 10 | var key;
|
---|
| 11 | var i, l;
|
---|
| 12 |
|
---|
| 13 | for (i = 0, l = tokens.length; i < l; i++) {
|
---|
| 14 | token = tokens[i];
|
---|
| 15 | if (token[0] != Token.NESTED_BLOCK) {
|
---|
| 16 | continue;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | key = serializeRules(token[1]) + '%' + serializeAll(token[2]);
|
---|
| 20 | candidate = candidates[key];
|
---|
| 21 |
|
---|
| 22 | if (candidate) {
|
---|
| 23 | candidate[2] = [];
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | candidates[key] = token;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | module.exports = removeDuplicateMediaQueries;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.