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

Add support for :where() #1662

Merged
merged 5 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 1.49.12
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should bump the minor version, since it's effectively a new feature.


* `@extend` now treats [`:where()`] the same as `:is()`.

[`:where()`]: https://developer.mozilla.org/en-US/docs/Web/CSS/:where

## 1.49.11

* Add support for 64-bit ARM releases on Linux.
Expand Down
5 changes: 3 additions & 2 deletions lib/src/extend/extension_store.dart
Expand Up @@ -831,14 +831,15 @@ class ExtensionStore {
// become `.foo:not(.bar)`. However, this is a narrow edge case and
// supporting it properly would make this code and the code calling it
// a lot more complicated, so it's not supported for now.
if (innerPseudo.normalizedName != 'is' &&
innerPseudo.normalizedName != 'matches') {
if (!{'is', 'matches', 'where'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!{'is', 'matches', 'where'}
if (!const {'is', 'matches', 'where'}

.contains(innerPseudo.normalizedName)) {
return [];
}
return innerSelector.components;

case 'is':
case 'matches':
case 'where':
case 'any':
case 'current':
case 'nth-child':
Expand Down
2 changes: 2 additions & 0 deletions lib/src/extend/functions.dart
Expand Up @@ -24,6 +24,7 @@ import '../utils.dart';
final _subselectorPseudos = {
'is',
'matches',
'where',
'any',
'nth-child',
'nth-last-child'
Expand Down Expand Up @@ -747,6 +748,7 @@ bool _selectorPseudoIsSuperselector(
case 'is':
case 'matches':
case 'any':
case 'where':
var selectors = _selectorPseudoArgs(compound2, pseudo1.name);
return selectors
.any((selector2) => selector1.isSuperselector(selector2)) ||
Expand Down
1 change: 1 addition & 0 deletions lib/src/parse/selector.dart
Expand Up @@ -15,6 +15,7 @@ final _selectorPseudoClasses = {
"not",
"is",
"matches",
"where",
"current",
"any",
"has",
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass_api/CHANGELOG.md
@@ -1,3 +1,7 @@
## 1.0.0-beta.41

* No user-visible changes.

## 1.0.0-beta.40

* No user-visible changes.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sass_api/pubspec.yaml
Expand Up @@ -2,15 +2,15 @@ name: sass_api
# Note: Every time we add a new Sass AST node, we need to bump the *major*
# version because it's a breaking change for anyone who's implementing the
# visitor interface(s).
version: 1.0.0-beta.40
version: 1.0.0-beta.41
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
sass: 1.49.11
sass: 1.49.12

dependency_overrides:
sass: {path: ../..}
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: sass
version: 1.49.11
version: 1.49.12
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down