Skip to content

Conversation

@nex3
Copy link
Contributor

@nex3 nex3 commented Sep 18, 2025

See sass/dart-sass#2645

[skip dart-sass]

Copy link
Member

@Goodwine Goodwine left a comment

Choose a reason for hiding this comment

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

Only one actionable comment, the rest is me trying to understand how @extend works lol. I... think I got it now(?)

Copy link
Member

Choose a reason for hiding this comment

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

Should the file name be in a directory named in_has? (same for in_where)

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe the directory could be called modern_pseudo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like modern_pseudo, good idea.

Copy link
Member

Choose a reason for hiding this comment

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

I'm kind of annoyed that github shows the README after partial_no_op lol

Comment on lines +12 to +13
:is(.a .b) {x: y}
.b.c {@extend .b}
Copy link
Member

Choose a reason for hiding this comment

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

I'm struggling to understand @extend in general 🤣 , can you let me know if this this accurate?

Is it fair to say that, assuming this was a modern browser, the extension is equivalent to replacing .original with :is(.original, .extension)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the intention, modulo some details regarding specificity, yes.

<===>
================================================================================
<===> multiple_options/is/nested/trimmable/input.scss
:is(:is(.a), .b.c) {x: y}
Copy link
Member

Choose a reason for hiding this comment

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

Would :is(.a, .b.c) cause a different result?

If so, my rough understanding is that this would become something like...
:is(:is(.a.d, .a.e), .b.c) Which I guess is equivalent to :is(.a.d, .a.e, .b.c), and if specificity is the same regardless it gets compressed to :is(.a, .b.c), no?

If yes, why is the nested :is() necessary? is it just to test testing? or is it because the behavior is different than if .a wasn't in a nested :is()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're correct except in that the untrimmed generated selector is :is(:is(.a, .a.d, .a.e), .b.c)—the original selector is always retained.

The nested :is() here is to verify that the trimming process will optimize it away. It is semantically equivalent to just including the raw selector.

}

<===> multiple_recursive/output.css
:is(.a :is(.b, .a.mod5, .a.mod6, .mod3.a, .mod4.a, .mod1.a, .mod2.a)) {
Copy link
Member

Choose a reason for hiding this comment

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

I can't imagine how complex this extension gets before it's simplified lol. (assuming it gets extended first, and then simplified)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not as bad as the version that doesn't use :is(), I'll tell you that much :).

@nex3 nex3 merged commit 28dc522 into feature.v2 Sep 22, 2025
12 checks passed
@nex3 nex3 deleted the semi-modern-extend branch September 22, 2025 21:19
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