Funções de Seletor Sass

Funções de Seletor Sass

Selector functions are used to check and manipulate selectors.

The following table lists all selector functions in Sass:

Function Description & examples
is-superselector(super, sub)

Check super Whether the selector matches sub All elements matched.

Exemplo:

is-superselector("div", "div.myInput")

result: true

is-superselector("div.myInput", "div")

result: false

is-superselector("div", "div")

result: true

selector-append(seletores)

Appends the second (and third/fourth, etc.) selector to the first selector.

Exemplo:

selector-append("div", ".myInput")

result: div.myInput

selector-append(".warning", "__a")

result: .warning__a

selector-extend(selector, extendee, extender)
selector-nest(seletores)

Returns a new selector containing a nested list of CSS selectors based on the provided list.

Exemplo:

selector-nest("ul", "li")

result: ul li

selector-nest(".warning", "alert", "div")

result: .warning div, alert div

selector-parse(selector)

Returns a list of strings contained in the selector using the same format as the parent selector.

Exemplo:

selector-parse("h1 .myInput .warning")

result: ('h1' '.myInput' '.warning')

selector-replace(selector, original, substituição)

retorna um novo seletor usando substituição o seletor especificado substitui original o seletor especificado.

Exemplo:

selector-replace("p.warning", "p", "div")

Resultados: div.warning

selector-unify(selector1, selector2)

retorna um novo seletor que coincide apenas com selector1 e selector2 elementos que coincidem.

Exemplo:

selector-unify("myInput", ".disabled")

Resultados: myInput.disabled

selector-unify("p", "h1")

Resultados: null

simple-selectors(seletores)

Retorna seletores lista de todos os seletores.

Exemplo:

simple-selectors("div.myInput")

Resultados: div, .myInput

simple-selectors("div.myInput:before")

Resultados: div, .myInput, :before