gss / engine

GSS engine
http://gss.github.io
MIT License
2.86k stars 105 forks source link

Constraint ignored in ruleset, but respected as standalone. #198

Closed oslego closed 9 years ago

oslego commented 9 years ago

Trying to constrain an element width to be half of another container's width. Defining the constraint in a ruleset is ignored, but it is accepted when defined as standalone constraint.

#lead {
    /* This does not work as expected */
    width: == #hero[width] / 2;
}

/* This works as expected. */
#lead[width] == #hero[width] / 2;

See example: http://codepen.io/oslego/pen/eNavPP

paulyoung commented 9 years ago

I believe this is a result of how scoped selectors work. The first ruleset is looking for and element with the ID of hero inside of an element with the ID of lead.

#lead {
    /* This may work depending on your markup */
    width: == ^#hero[width] / 2;
}
oslego commented 9 years ago

Ah, I missed that. Indeed, unintended nesting was the problem. Thanks for the clarification, @paulyoung!