|
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
|
| Rev | Line | |
|---|
| [9af201e] | 1 | 'use strict';
|
|---|
| 2 | const BasePlugin = require('../plugin');
|
|---|
| 3 | const isMixin = require('../isMixin');
|
|---|
| 4 | const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
|
|---|
| 5 | const { SELECTOR } = require('../dictionary/identifiers');
|
|---|
| 6 | const { RULE } = require('../dictionary/postcss');
|
|---|
| 7 |
|
|---|
| 8 | module.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.