less.js: Extend does not assume nested selectors

It seems the feature “Extend” does not assume nested selectors:

This doesn’t work

body {
   div { color: red; }
   p:extend(div) { background-color: green; }
}

This does work

body {
   div { color: red; }
   p:extend(body div) { background-color: green; }
}

This also does work

div { color: red; }
p:extend(div) { background-color: green; }

please notice that I had to declare body div on the second example for the feature to work where it should assume its inheritance automatically and the first example should work without problem, but unfortunately that doesn’t happen.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 25 (15 by maintainers)

Most upvoted comments

You need to use the all keyword.

p:extend(div all) {
    ...
}