Sha256: f5bb4195acf4c10cc68361d36920ed2d7e65d263aa3fda1f3b3f7ff716828ddb

Contents?: true

Size: 870 Bytes

Versions: 5

Compression:

Stored size: 870 Bytes

Contents

var SetTreeVisibilityVisitor = function(visible) {
    this.visible = visible;
};
SetTreeVisibilityVisitor.prototype.run = function(root) {
    this.visit(root);
};
SetTreeVisibilityVisitor.prototype.visitArray = function(nodes) {
    if (!nodes) {
        return nodes;
    }

    var cnt = nodes.length, i;
    for (i = 0; i < cnt; i++) {
        this.visit(nodes[i]);
    }
    return nodes;
};
SetTreeVisibilityVisitor.prototype.visit = function(node) {
    if (!node) {
        return node;
    }
    if (node.constructor === Array) {
        return this.visitArray(node);
    }

    if (!node.blocksVisibility || node.blocksVisibility()) {
        return node;
    }
    if (this.visible) {
        node.ensureVisibility();
    } else {
        node.ensureInvisibility();
    }

    node.accept(this);
    return node;
};
module.exports = SetTreeVisibilityVisitor;

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ilog-0.4.1 node_modules/less/lib/less/visitors/set-tree-visibility-visitor.js
ilog-0.4.0 node_modules/less/lib/less/visitors/set-tree-visibility-visitor.js
ilog-0.3.3 node_modules/less/lib/less/visitors/set-tree-visibility-visitor.js
less-execjs-2.6.0.4 lib/less/js/less/lib/less/visitors/set-tree-visibility-visitor.js
less-execjs-2.6.0.3 lib/less/js/less/lib/less/visitors/set-tree-visibility-visitor.js