Skip to content

Commit 039f2ad

Browse files
authored
Add support for :where() (#1662)
1 parent c7ab426 commit 039f2ad

File tree

7 files changed

+17
-5
lines changed

7 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## 1.50.0
22

3+
* `@extend` now treats [`:where()`] the same as `:is()`.
4+
5+
[`:where()`]: https://developer.mozilla.org/en-US/docs/Web/CSS/:where
6+
37
### Command Line Interface
48

59
* Closing the standard input stream will now cause the `--watch` command to stop

lib/src/extend/extension_store.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,14 +831,15 @@ class ExtensionStore {
831831
// become `.foo:not(.bar)`. However, this is a narrow edge case and
832832
// supporting it properly would make this code and the code calling it
833833
// a lot more complicated, so it's not supported for now.
834-
if (innerPseudo.normalizedName != 'is' &&
835-
innerPseudo.normalizedName != 'matches') {
834+
if (!const {'is', 'matches', 'where'}
835+
.contains(innerPseudo.normalizedName)) {
836836
return [];
837837
}
838838
return innerSelector.components;
839839

840840
case 'is':
841841
case 'matches':
842+
case 'where':
842843
case 'any':
843844
case 'current':
844845
case 'nth-child':

lib/src/extend/functions.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import '../utils.dart';
2424
final _subselectorPseudos = {
2525
'is',
2626
'matches',
27+
'where',
2728
'any',
2829
'nth-child',
2930
'nth-last-child'
@@ -747,6 +748,7 @@ bool _selectorPseudoIsSuperselector(
747748
case 'is':
748749
case 'matches':
749750
case 'any':
751+
case 'where':
750752
var selectors = _selectorPseudoArgs(compound2, pseudo1.name);
751753
return selectors
752754
.any((selector2) => selector1.isSuperselector(selector2)) ||

lib/src/parse/selector.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ final _selectorPseudoClasses = {
1515
"not",
1616
"is",
1717
"matches",
18+
"where",
1819
"current",
1920
"any",
2021
"has",

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.0-beta.41
2+
3+
* No user-visible changes.
4+
15
## 1.0.0-beta.40
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 1.0.0-beta.40
5+
version: 1.0.0-beta.41
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: '>=2.12.0 <3.0.0'
1111

1212
dependencies:
13-
sass: 1.49.11
13+
sass: 1.50.0
1414

1515
dependency_overrides:
1616
sass: {path: ../..}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.50.0-dev
2+
version: 1.50.0
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)