Skip to content

loop within namespace fails w/ error: "Cannot call method 'concat' of undefined" #2001

@busticated

Description

@busticated

Using LESS v1.70 on node v0.10.28, this fails:

#example {
    .start(@col-count: 4){
         #example > .loop(@col-count);
    }

    .loop(@counter) when (@counter > 0) {
        .box-@{counter} {
            width: 100% / @counter;
        }
        #example > .loop((@counter - 1));
    }
}

#example > .start(); // LESS Syntax error : Cannot call method 'concat' of undefined

but this works fine:

// same namespace & mixin definitions shown above
div {
    #example > .start();
}

as does this:

.start(@col-count: 4){
    .loop(@col-count);
}

.loop(@counter) when (@counter > 0) {
    .box-@{counter} {
        width: 100% / @counter;
    }
    .loop((@counter - 1));
}

.start();

in LESS v1.6.x, all forms shown above worked fine, outputting the following:

.box-4 {
    width: 25%;
}
.box-3 {
    width: 33.333333333333336%;
}
.box-2 {
    width: 50%;
}
.box-1 {
    width: 100%;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions