Skip to content

Commit

Permalink
Throw an error if the first error to selector.nest() contains & (#1068)
Browse files Browse the repository at this point in the history
Closes #966
  • Loading branch information
nex3 committed Sep 3, 2020
1 parent 330d93c commit 4c0bc7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
## 1.26.11

* **Potentially breaking bug fix:** `selector.nest()` now throws an error
if the first arguments contains the parent selector `&`.

* Fixes a parsing bug with inline comments in selectors.

* Improve some error messages for edge-case parse failures.
Expand Down
7 changes: 6 additions & 1 deletion lib/src/functions/selector.dart
Expand Up @@ -44,8 +44,13 @@ final _nest = _function("nest", r"$selectors...", (arguments) {
"\$selectors: At least one selector must be passed.");
}

var first = true;
return selectors
.map((selector) => selector.assertSelector(allowParent: true))
.map((selector) {
var result = selector.assertSelector(allowParent: !first);
first = false;
return result;
})
.reduce((parent, child) => child.resolveParentSelectors(parent))
.asSassList;
});
Expand Down

0 comments on commit 4c0bc7f

Please sign in to comment.