Sha256: 012b452692f03dbb1216bd09fd5a61f21336a667a3f4506c89c14ad958a8215e

Contents?: true

Size: 1.27 KB

Versions: 41

Compression:

Stored size: 1.27 KB

Contents

module.exports = {
    name: 'Nth',
    structure: {
        nth: ['AnPlusB', 'Identifier'],
        selector: ['SelectorList', null]
    },
    parse: function(allowOfClause) {
        this.scanner.skipSC();

        var start = this.scanner.tokenStart;
        var end = start;
        var selector = null;
        var query;

        if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
            query = this.Identifier();
        } else {
            query = this.AnPlusB();
        }

        this.scanner.skipSC();

        if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
            this.scanner.next();

            selector = this.SelectorList();

            if (this.needPositions) {
                end = this.getLastListNode(selector.children).loc.end.offset;
            }
        } else {
            if (this.needPositions) {
                end = query.loc.end.offset;
            }
        }

        return {
            type: 'Nth',
            loc: this.getLocation(start, end),
            nth: query,
            selector: selector
        };
    },
    generate: function(node) {
        this.node(node.nth);
        if (node.selector !== null) {
            this.chunk(' of ');
            this.node(node.selector);
        }
    }
};

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