Method: Sass::Script::Functions#is_superselector

Defined in:
lib/sass/script/functions.rb

#is_superselector($super, $sub) ⇒ Sass::Script::Value::Bool

Returns whether $super is a superselector of $sub. This means that $super matches all the elements that $sub matches, as well as possibly additional elements. In general, simpler selectors tend to be superselectors of more complex oned.

Examples:

is-superselector(".foo", ".foo.bar") => true
is-superselector(".foo.bar", ".foo") => false
is-superselector(".bar", ".foo .bar") => true
is-superselector(".foo .bar", ".bar") => false

Returns Whether $selector1 is a superselector of $selector2.

Parameters:

Returns:



2883
2884
2885
2886
2887
# File 'lib/sass/script/functions.rb', line 2883

def is_superselector(sup, sub)
  sup = parse_selector(sup, :super)
  sub = parse_selector(sub, :sub)
  bool(sup.superselector?(sub))
end