Web Development

Reversed Combinators in Slick

In previous post I have explained introduced slick to you. You can find this post here.

In this post I will explain the Reversed combination using slick. Reversed combination is the one of the major advantage of the Slick.

Reversed Combinators are a classification of combinators that are the reverse of their original. They redirect the flow of selectors and combinators to travel up the node tree rather than down. Slick implements these by prepending ! to a selector or combinator.

This is the new way of selecting elements.

Here are some examples for that:

Matches a .chapter that is a direct parent of a paragraph

[cc lang=”javascript”]p !> .chapter[/cc]

Matches all the divs that are parents of paragraphs

[cc lang=”javascript”]p ! div[/cc]

Matches all paragraphs that are direct previous siblings of another paragraph

[cc lang=”javascript”]p !+ p[/cc]

Matches all paragraphs that are previous siblings of another paragraph

[cc lang=”javascript”]p !~ p[/cc]

Wanting for you responses on this.

Shares:

Leave a Reply

Your email address will not be published. Required fields are marked *