Skip to content
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

Throw an error if the first error to selector.nest() contains & #1068

Merged
merged 1 commit into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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