Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Error defining variables off arguments in dynamic mixins #160

Open
alanhogan opened this issue Jun 28, 2010 · 1 comment
Open

Error defining variables off arguments in dynamic mixins #160

alanhogan opened this issue Jun 28, 2010 · 1 comment

Comments

@alanhogan
Copy link

Bug in Less. Confirmed to be in (gem) less 1.2.21 and node.js less v1.0.6.

Defining a variable that uses a value of an argument variable will erroneously always use the argument's default value.

Ex:

.square(@size: 20px) {
    // Will use 20px for @size in calculation, always:
    @border_size: @size / 10; 
    width: @size;
    height: @size;
    border: @border_size solid black;
}

.square-10 {
    .square(10px);
}

produces

 .square-10 { border: 2px; } /* Wrong! Expected 10px / 10 = 1px. */

Test cases: http://alanhogan.com/files/bug.html

@alanhogan
Copy link
Author

Confirmed bug present in both of the latest stable JS and Ruby implementations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant