Sha256: 7ea77e4b90da7ac713c5ef76cc4ea7ace62322ded885584cb389cde8fd749d0f

Contents?: true

Size: 1.64 KB

Versions: 41

Compression:

Stored size: 1.64 KB

Contents

var TYPE = require('../../tokenizer').TYPE;

var IDENT = TYPE.Ident;
var FUNCTION = TYPE.Function;
var COLON = TYPE.Colon;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;

// :: [ <ident> | <function-token> <any-value>? ) ]
module.exports = {
    name: 'PseudoElementSelector',
    structure: {
        name: String,
        children: [['Raw'], null]
    },
    parse: function() {
        var start = this.scanner.tokenStart;
        var children = null;
        var name;
        var nameLowerCase;

        this.eat(COLON);
        this.eat(COLON);

        if (this.scanner.tokenType === FUNCTION) {
            name = this.consumeFunctionName();
            nameLowerCase = name.toLowerCase();

            if (this.pseudo.hasOwnProperty(nameLowerCase)) {
                this.scanner.skipSC();
                children = this.pseudo[nameLowerCase].call(this);
                this.scanner.skipSC();
            } else {
                children = this.createList();
                children.push(
                    this.Raw(this.scanner.tokenIndex, null, false)
                );
            }

            this.eat(RIGHTPARENTHESIS);
        } else {
            name = this.consume(IDENT);
        }

        return {
            type: 'PseudoElementSelector',
            loc: this.getLocation(start, this.scanner.tokenStart),
            name: name,
            children: children
        };
    },
    generate: function(node) {
        this.chunk('::');
        this.chunk(node.name);

        if (node.children !== null) {
            this.chunk('(');
            this.children(node);
            this.chunk(')');
        }
    },
    walkContext: 'function'
};

Version data entries

41 entries across 31 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
optimacms-0.1.61 spec/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.18.0 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.18.2 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.16.1 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.15.2 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.18.4 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.18.1 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.14.0 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
isomorfeus-preact-10.5.7 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
isomorfeus-preact-10.5.6 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
isomorfeus-preact-10.5.5 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
isomorfeus-preact-10.5.4 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
isomorfeus-preact-10.5.3 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
isomorfeus-preact-10.5.2 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
tang-0.2.1 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
tang-0.2.1 spec/tang_app/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/csso/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js