Skip to content

Commit

Permalink
Fix universal selector unification.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed May 26, 2017
1 parent c1feabf commit 5c9f309
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -178,6 +178,8 @@ Sass to update the reference behavior.

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

14. Universal selector unification is symmetrical. See [issue 2247][].

[issue 1599]: https://github.com/sass/sass/issues/1599
[issue 1126]: https://github.com/sass/sass/issues/1126
[issue 2120]: https://github.com/sass/sass/issues/2120
Expand All @@ -191,5 +193,6 @@ Sass to update the reference behavior.
[issue 2228]: https://github.com/sass/sass/issues/2228
[issue 2245]: https://github.com/sass/sass/issues/2245
[issue 303]: https://github.com/sass/sass/issues/303
[issue 2247]: https://github.com/sass/sass/issues/2247

Disclaimer: this is not an official Google product.
3 changes: 3 additions & 0 deletions lib/src/ast/selector/pseudo.dart
Expand Up @@ -84,6 +84,9 @@ class PseudoSelector extends SimpleSelector {
}

List<SimpleSelector> unify(List<SimpleSelector> compound) {
if (compound.length == 1 && compound.first is UniversalSelector) {
return compound.first.unify([this]);
}
if (compound.contains(this)) return compound;

var result = <SimpleSelector>[];
Expand Down
3 changes: 3 additions & 0 deletions lib/src/ast/selector/simple.dart
Expand Up @@ -56,6 +56,9 @@ abstract class SimpleSelector extends Selector {
/// Returns `null` if unification is impossible—for example, if there are
/// multiple ID selectors.
List<SimpleSelector> unify(List<SimpleSelector> compound) {
if (compound.length == 1 && compound.first is UniversalSelector) {
return compound.first.unify([this]);
}
if (compound.contains(this)) return compound;

var result = <SimpleSelector>[];
Expand Down

0 comments on commit 5c9f309

Please sign in to comment.