Method: Sass::Script::Functions#selector_unify
- Defined in:
- lib/sass/script/functions.rb
#selector_unify($selector1, $selector2) ⇒ Sass::Script::Value::List, Sass::Script::Value::Null
Unifies two selectors into a single selector that matches only
elements matched by both input selectors. Returns null if
there is no such selector.
Like the selector unification done for @extend, this doesn't
guarantee that the output selector will match all elements
matched by both input selectors. For example, if .a .b is
unified with .x .y, .a .x .b.y, .x .a .b.y will be returned,
but .a.x .b.y will not. This avoids exponential output size
while matching all elements that are likely to exist in
practice.
2830 2831 2832 2833 2834 2835 |
# File 'lib/sass/script/functions.rb', line 2830
def selector_unify(selector1, selector2)
selector1 = parse_selector(selector1, :selector1)
selector2 = parse_selector(selector2, :selector2)
return null unless (unified = selector1.unify(selector2))
unified.to_sass_script
end
|