Skip to content

Commit

Permalink
Merge pull request #2759 from SomMeri/master
Browse files Browse the repository at this point in the history
Fixed extend leaking through nested parent selector.
  • Loading branch information
SomMeri committed Dec 16, 2015
2 parents 51ae9c6 + c247775 commit 52281b6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/less/tree/ruleset.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,11 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {

//put together the parent selectors after the join (e.g. the rest of the parent)
if (addPath.length > 1) {
newSelectorPath = newSelectorPath.concat(addPath.slice(1));
var restOfPath = addPath.slice(1);
restOfPath = restOfPath.map(function (selector) {
return selector.createDerived(selector.elements, []);
});
newSelectorPath = newSelectorPath.concat(restOfPath);
}
return newSelectorPath;
}
Expand Down
7 changes: 7 additions & 0 deletions test/css/extend-selector.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ div.ext7,
.footer .footer-nav:before {
background: blue;
}
.issue-2586-bordered,
.issue-2586-somepage .content {
border: solid 1px black;
}
.issue-2586-somepage .content > span {
margin-bottom: 10px;
}
13 changes: 12 additions & 1 deletion test/less/extend-selector.less
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,15 @@ div.ext5,
.footer-nav {
&:extend( .header .header-nav all );
}
}
}

.issue-2586-bordered {
border: solid 1px black;
}
.issue-2586-somepage {
.content:extend(.issue-2586-bordered) {
&>span {
margin-bottom: 10px;
}
}
}

0 comments on commit 52281b6

Please sign in to comment.