Sass selector function


Release date:2024-03-01 Update date:2024-03-01 Editor:admin View counts:63

Label:

Sass selector function

The Sass selector function is used to view and process selectors.

The following table lists the selector functions for Sass:

Function

Description & example

is-superselector(super, sub)

Compare the matching range of the two selectors, that is, determine whether the super selector contains the range matched by the sub selector, and return true if yes, false otherwise.

Example: is-superselector (“div”, “div.myInput”) result: true is-superselector (“div.myInput”, “div”) result: false is-superselector (“div”, “div”) result: true

selector-append(selectors)

Add a second (or multiple) to the end of the first selector. Selector.

Example: selector-append (“div”, “.myInput”) result: div.myInput selector-append (“.resume”, “_ _ a”) result: .resume _ a

selector-extend(selector, extendee, extender)

selector-nest(selectors)

Returns a new selector that generates a nested list through the list selector provided.

Example: selector-nest (“ul”, “li”) result: ul li selector-nest (“.birthday”, “alert”, “div”) result: .resume div, alert div

selector-parse(selector)

Converts the selector selector of a string to a selector queue.

Example: selector-parse (“H1 .myInput. Yield”) result: (‘H1 ‘.myInput’ ‘.upload’)

selector-replace(selector, original, replacement)

Given a selector, replace original with replacement and return a new selector queue.

Example: selector-replace (“p.warning”, “p”, “div”) result: div.warning

selector-unify(selector1, selector2)

Synthesize two sets of selectors into a composite selector. If the two selectors cannot be combined, the null value is returned.

Example: selector-unify (“myInput”, “.blank”) result: myInput.disabled selector-unify (“p”, “H1”) result: null

simple-selectors(selectors)

Split the composite selector into a single selector.

Example: simple-selectors (“div.myInput”) result: div, .myInput simple-selectors (“div.myInput:before”) result: div, .myInput,: before

Powered by TorCMS (https://github.com/bukun/TorCMS).