Skip to content

Commit 0e7ec95

Browse files
committed
Fix universal selector unification.
See sass/sass#2247
1 parent 5a9b110 commit 0e7ec95

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ Sass to update the reference behavior.
178178

179179
13. The reference combinator is not supported. See [issue 303][].
180180

181+
14. Universal selector unification is symmetrical. See [issue 2247][].
182+
181183
[issue 1599]: https://github.com/sass/sass/issues/1599
182184
[issue 1126]: https://github.com/sass/sass/issues/1126
183185
[issue 2120]: https://github.com/sass/sass/issues/2120
@@ -191,5 +193,6 @@ Sass to update the reference behavior.
191193
[issue 2228]: https://github.com/sass/sass/issues/2228
192194
[issue 2245]: https://github.com/sass/sass/issues/2245
193195
[issue 303]: https://github.com/sass/sass/issues/303
196+
[issue 2247]: https://github.com/sass/sass/issues/2247
194197

195198
Disclaimer: this is not an official Google product.

lib/src/ast/selector/pseudo.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ class PseudoSelector extends SimpleSelector {
8484
}
8585

8686
List<SimpleSelector> unify(List<SimpleSelector> compound) {
87+
if (compound.length == 1 && compound.first is UniversalSelector) {
88+
return compound.first.unify([this]);
89+
}
8790
if (compound.contains(this)) return compound;
8891

8992
var result = <SimpleSelector>[];

lib/src/ast/selector/simple.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ abstract class SimpleSelector extends Selector {
5656
/// Returns `null` if unification is impossible—for example, if there are
5757
/// multiple ID selectors.
5858
List<SimpleSelector> unify(List<SimpleSelector> compound) {
59+
if (compound.length == 1 && compound.first is UniversalSelector) {
60+
return compound.first.unify([this]);
61+
}
5962
if (compound.contains(this)) return compound;
6063

6164
var result = <SimpleSelector>[];

0 commit comments

Comments
 (0)