isSuperselector method

bool isSuperselector(
  1. SimpleSelector other
)
override

Whether this is a superselector of other.

That is, whether this matches every element that other matches, as well as possibly additional elements.

Implementation

bool isSuperselector(SimpleSelector other) {
  if (super.isSuperselector(other)) return true;

  var selector = this.selector;
  if (selector == null) return this == other;
  if (other is PseudoSelector &&
      isElement &&
      other.isElement &&
      normalizedName == 'slotted' &&
      other.name == name) {
    return other.selector.andThen(selector.isSuperselector) ?? false;
  }

  // Fall back to the logic defined in functions.dart, which knows how to
  // compare selector pseudoclasses against raw selectors.
  return CompoundSelector([this], span)
      .isSuperselector(CompoundSelector([other], span));
}