Sass Selectie Functies

Sass Selectie Functies

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 matched.

Voorbeeld:

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

result: true

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

result: false

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

result: true

selector-append(Selectoren)

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

Voorbeeld:

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

result: div.myInput

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

result: .warning__a

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

Return a new selector that contains a nested list of CSS selectors based on the provided list.

Voorbeeld:

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

result: ul li

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

result: .warning div, alert div

selector-parse(selector)

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

Voorbeeld:

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

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

selector-replace(selector, Origineel, Vervanging)

Retourneert een nieuwe selector, waarbij Vervanging In de opgegeven selector vervangen door Origineel In de opgegeven selector.

Voorbeeld:

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

Resultaat: div.warning

selector-unify(selector1, selector2)

Retourneert een nieuwe selector die alleen overeenkomt met selector1 en selector2 Die overeenkomen met de elementen.

Voorbeeld:

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

Resultaat: myInput.disabled

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

Resultaat: null

simple-selectors(Selectoren)

Terug Selectoren Lijst van verschillende selectoren.

Voorbeeld:

simple-selectors("div.myInput")

Resultaat: div, .myInput

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

Resultaat: div, .myInput, :before