Sha256: 2866e9039c85bfb9cea25c4519d6e77a871ebd45223d2fc6154c68d769802285

Contents?: true

Size: 1.61 KB

Versions: 41

Compression:

Stored size: 1.61 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: 'PseudoClassSelector',
    structure: {
        name: String,
        children: [['Raw'], null]
    },
    parse: function() {
        var start = this.scanner.tokenStart;
        var children = null;
        var name;
        var nameLowerCase;

        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: 'PseudoClassSelector',
            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/PseudoClassSelector.js
optimacms-0.1.61 spec/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.18.0 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.18.2 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.16.1 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.15.2 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.18.4 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.18.1 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.14.0 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
isomorfeus-preact-10.5.7 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
isomorfeus-preact-10.5.6 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
isomorfeus-preact-10.5.5 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
isomorfeus-preact-10.5.4 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
isomorfeus-preact-10.5.3 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
isomorfeus-preact-10.5.2 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
tang-0.2.1 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
tang-0.2.1 spec/tang_app/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/csso/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js