Urara-Blog/node_modules/.pnpm-store/v3/files/fd/43baa3eba47f43f4d945a36b999efa437d230cd4f8fd1d3ebf0782e020d6da88d0742e3e5d72c2bd4e28fbf1cfc2eb225f80512b065a4606e7bda2ced94d44-exec
2022-08-14 01:14:53 +08:00

36 lines
892 B
Text
Executable file

'use strict';
const BasePlugin = require('../plugin');
const isMixin = require('../isMixin');
const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
const { SELECTOR } = require('../dictionary/identifiers');
const { RULE } = require('../dictionary/postcss');
module.exports = class TrailingSlashComma extends BasePlugin {
/** @param {import('postcss').Result=} result */
constructor(result) {
super([IE_5_5, IE_6, IE_7], [RULE], result);
}
/**
* @param {import('postcss').Rule} rule
* @return {void}
*/
detect(rule) {
if (isMixin(rule)) {
return;
}
const { selector } = rule;
const trim = selector.trim();
if (
trim.lastIndexOf(',') === selector.length - 1 ||
trim.lastIndexOf('\\') === selector.length - 1
) {
this.push(rule, {
identifier: SELECTOR,
hack: selector,
});
}
}
};