-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Parent selectors #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
any comments on this? sass has depreciated using the parent selector anywhere but the start of an element. you used to be able to do the following:
this would output:
but now the & must at the front of the element, like:
|
yea, that's how it works in less.js — it's essentially a combinator, like |
you mean that's how it should work in less.js? It didn't work at the point when I ported it to .NET and I haven't seen a commit which fixes it. Did I miss something? |
ok, I remember now: the
will result in:
but
will just become
It's a very simple implementation, and if users want the full fledged thing I'll look into expanding its functionality, but this covers 90% of use-cases. |
Ahh that explains it. That's exactly what I'm seeing. At the moment it covers 1 use case. But I agree, that's probably all 90% of people will use (since less.rb never supported this). Your second example where Thanks |
Yea, but that is the expected behaviour, for now at least. I don't think it makes sense to say
should become:
It's inconsistent otherwise... |
the LESSPHP version does something for this: http://leafo.net/lessphp/docs/#nested_blocks I think the implementation detail is that when the parent selector is present, it's moved up a level or elevated in scope ( dropping ".a " from your ".a .a.a" rule) rather then being considered as a normal nested rule. There'd be overhead maybe on a rule like "& .a" as it'd be the same result as a standard nested rule. |
This doesn't work as expected: .container{ .elem{ .subcontainer & { color: white; } } } the expected output I think should be: .container .subcontainer .elem { color: white; } However, we get: .subcontainer .container .elem { color: white; } |
That's not the expected output, & takes into account all parents |
Parent selectors don't work as expected
This should output something like the following:
The text was updated successfully, but these errors were encountered: