Sha256: 1f354759ce9ee6be7b5e8bc32fea78a8a6d6c64d241c77b60e1f26b35836d3d9

Contents?: true

Size: 1.06 KB

Versions: 19

Compression:

Stored size: 1.06 KB

Contents

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

// special reader for units to avoid adjoined IE hacks (i.e. '1px\9')
function readUnit(scanner) {
    var unit = scanner.getTokenValue();
    var backSlashPos = unit.indexOf('\\');

    if (backSlashPos > 0) {
        // patch token offset
        scanner.tokenStart += backSlashPos;

        // return part before backslash
        return unit.substring(0, backSlashPos);
    }

    // no backslash in unit name
    scanner.next();

    return unit;
}

// number ident
module.exports = {
    name: 'Dimension',
    structure: {
        value: String,
        unit: String
    },
    parse: function() {
        var start = this.scanner.tokenStart;
        var value = this.scanner.consume(NUMBER);
        var unit = readUnit(this.scanner);

        return {
            type: 'Dimension',
            loc: this.getLocation(start, this.scanner.tokenStart),
            value: value,
            unit: unit
        };
    },
    generate: function(node) {
        this.chunk(node.value);
        this.chunk(node.unit);
    }
};

Version data entries

19 entries across 18 versions & 4 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.18.2 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.16.1 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.15.2 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.18.4 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.18.1 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.14.0 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
jester-data-8.0.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
ezii-os-5.2.1 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
ezii-os-2.0.1 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
ezii-os-1.1.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
ezii-os-1.0.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
ezii-os-0.0.0.1.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
ezii-os-0.0.0.0.1 node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/css-tree/lib/syntax/node/Dimension.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js
locomotivecms-3.4.0 app/javascript/node_modules/csso/node_modules/css-tree/lib/syntax/node/Dimension.js