Selector: CSS selector builder

Description Usage Methods Examples

Description

Based upon a naive reading of https://developer.mozilla.org/en-US/docs/Web/CSS/Reference#Selectors.

Usage

1
2
3
4
5
6
7
8
selector <- Selector$new()
selector <- css_sel()

selector$type(type_name)
selector$class(...)
selector$id(id_name)

new_selector <- selector$copy()

Methods

$type(type_name)

Set the type for the selector

type_name type name
$id(id_name)

Set the id for the selector

id_name id name
$class(...)

Add to the class list for for the selector

... class names
$attr(..., modifier = c('exact', 'choice', 'prefix', 'suffix', 'contains'))

Add attribute matching to the selector. See https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

... name/value pairs for the atributes
modifer by default 'exact' attribute matching, but can select from among the different types of matching
$pseudo_class(...)

Set pseudo classes on the selector.

... Use name = TRUE to set pseudo-classes
$pseudo_element(...)

Set pseudo element on the selector.

... Use name = TRUE to set pseudo-elements
$descendant_of(selector), $parent_of(selector), $child_of(selector), $prior_adjacent(selector), $prior_sibling(selector), $and(selector)

Set relationship with another selector

selector Other selector
$as_character()

Convert Selector to a character string.

$print()

Print Selector to terminal.

$copy()

Copy Selector.

Examples

1
2
3
4
## Not run: 
selector <- css_sel(".marsha")$child_of('carol')

## End(Not run)

coolbutuseless/minicss documentation built on Nov. 4, 2019, 9:13 a.m.