How to use the postcss-selector-parser.isPseudo function in postcss-selector-parser

To help you get started, we’ve selected a few postcss-selector-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lttb / reshadow / packages / postcss / transform.js View on Github external
const addMod = node => {
        let {attribute, value = ''} = node;

        let prev = node.prev();

        while (
            prev &&
            !(parser.isTag(prev) || parser.isIdentifier(prev)) &&
            !parser.isCombinator(prev)
        ) {
            const curr = prev;
            prev = curr.prev();

            if (parser.isPseudo(curr)) {
                continue;
            } else if (!parser.isAttribute(curr)) {
                continue;
            }
        }

        const tag = (prev && prev.value) || '__common__';

        value = value.replace(/^['"]/, '').replace(/['"]$/, '');

        let name;
        let type;

        const elem = addElem(tag);

        if (node.namespace) {
github lttb / reshadow / packages / postcss / transform.js View on Github external
const isPseudo = node => {
    return parser.isSelector(node) && parser.isPseudo(node.parent);
};