Skip to content

Support the top-level parent selector#2758

Merged
nex3 merged 2 commits intomainfrom
top-level-parent
Apr 2, 2026
Merged

Support the top-level parent selector#2758
nex3 merged 2 commits intomainfrom
top-level-parent

Conversation

@nex3
Copy link
Copy Markdown
Contributor

@nex3 nex3 commented Mar 30, 2026

@nex3 nex3 requested a review from Goodwine March 30, 2026 23:00
@nex3 nex3 marked this pull request as ready for review March 30, 2026 23:00
:var span,
)) {
throw SassException(
'A top-level selector may not contain a parent selector with a '
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we had "&" before, I'm curious why it was removed. Wouldn't it be easier for a user to understand & is the parent selector? Or is it implied that users would know that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Sass exceptions include source span information, and we're careful to ensure that's included in the rendering of the exception everywhere. So this will include a little graphic pointing to the & selector, which means repeating it in prose is less useful than describing it.

pubspec.yaml Outdated
@@ -1,5 +1,5 @@
name: sass
version: 1.99.0
version: 1.100.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.99 has not been released yet

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's probably my mistake. I suppose we might as well roll this into that, then.

emitted as-is in the CSS output, where they're interpreted as [the scoping
root].

[the scoping root]: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Nesting_selector#using_outside_nested_rule
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How stable are MDN links? I'm wondering if it's better to link the spec

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDN links are pretty stable, and crucially they're much more friendly to people who are just looking to understand CSS. The spec is written for an audience of browser implementers, so it tends to be much denser.

The previous versions weren't actually released.
@nex3 nex3 force-pushed the top-level-parent branch from 2b00a26 to 16bf5a5 Compare April 2, 2026 21:03
@nex3 nex3 merged commit 83c39fe into main Apr 2, 2026
76 of 77 checks passed
@nex3 nex3 deleted the top-level-parent branch April 2, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants