Sass selector functions
- Previous page Sass map
- Next page Sass introspection
Sass selector functions
Selector functions are used to check and manipulate selectors.
The following table lists all selector functions in Sass:
Function | Description & example |
---|---|
is-superselector(super, sub) |
Check super Whether the selector matches sub All elements that match. Example:is-superselector("div", "div.myInput") result: true is-superselector("div.myInput", "div") result: false is-superselector("div", "div") result: true |
selector-append(selectors) |
Attach the second (and third/fourth, etc.) selector to the first selector. Example:selector-append("div", ".myInput") result: div.myInput selector-append(".warning", "__a") result: .warning__a |
selector-extend(selector, extendee, extender) | |
selector-nest(selectors) |
Return a new selector that contains a nested list of CSS selectors based on the provided list. Example:selector-nest("ul", "li") result: ul li selector-nest(".warning", "alert", "div") result: .warning div, alert div |
selector-parse(selector) |
Return a list of strings contained in the selector using the same format as the parent selector. Example:selector-parse("h1 .myInput .warning") result: ('h1' '.myInput' '.warning') |
selector-replace(selector, original, replacement) |
Returns a new selector using replacement specified selector is replaced by original specified selector. Example:selector-replace("p.warning", "p", "div") Result: div.warning |
selector-unify(selector1, selector2) |
Returns a new selector that only matches elements that selector1 and selector2 elements that match both. Example:selector-unify("myInput", ".disabled") Result: myInput.disabled selector-unify("p", "h1") Result: null |
simple-selectors(selectors) |
Return selectors List of various selectors. Example:simple-selectors("div.myInput") Result: div, .myInput simple-selectors("div.myInput:before") Result: div, .myInput, :before |
- Previous page Sass map
- Next page Sass introspection