source: frontend/node_modules/stylehacks/src/plugins/trailingSlashComma.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 892 bytes
Line 
1'use strict';
2const BasePlugin = require('../plugin');
3const isMixin = require('../isMixin');
4const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
5const { SELECTOR } = require('../dictionary/identifiers');
6const { RULE } = require('../dictionary/postcss');
7
8module.exports = class TrailingSlashComma extends BasePlugin {
9 /** @param {import('postcss').Result=} result */
10 constructor(result) {
11 super([IE_5_5, IE_6, IE_7], [RULE], result);
12 }
13
14 /**
15 * @param {import('postcss').Rule} rule
16 * @return {void}
17 */
18 detect(rule) {
19 if (isMixin(rule)) {
20 return;
21 }
22
23 const { selector } = rule;
24 const trim = selector.trim();
25
26 if (
27 trim.lastIndexOf(',') === selector.length - 1 ||
28 trim.lastIndexOf('\\') === selector.length - 1
29 ) {
30 this.push(rule, {
31 identifier: SELECTOR,
32 hack: selector,
33 });
34 }
35 }
36};
Note: See TracBrowser for help on using the repository browser.