class Components::CSS::Engine::Rule

Overview

Represents a single CSS rule

Defined in:

components/css/engine/css_rule.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(selector : String, priority : Int32 = 0) #

[View source]

Instance Method Detail

def add_declaration(property : String, value : String) #

Add a declaration


[View source]
def attribute_selector : String | Nil #

[View source]
def container_query : String | Nil #

[View source]
def declarations : Hash(String, String) #

[View source]
def full_selector : String #

Get the full selector (with pseudo class and attribute selector)


[View source]
def matches_class?(class_name : String) : Bool #

Check if this rule matches a class name


[View source]
def media_query : String | Nil #

[View source]
def priority : Int32 #

[View source]
def pseudo_class : String | Nil #

[View source]
def render : String #

Render to CSS


[View source]
def selector : String #

[View source]
def set_attribute_selector(selector : String) : self #

Set attribute selector directly


[View source]
def with_attribute(attr : String, value : String) : self #

Set attribute selector with value (e.g., [aria-expanded="true"])


[View source]
def with_attribute_present(attr : String) : self #

Set attribute presence selector (e.g., [data-disabled])


[View source]
def with_complex_pseudo(selector : String) : self #

Set a complex pseudo selector (e.g., ":is([inert], [inert] *)")


[View source]
def with_container(query : String) : self #

Set container query


[View source]
def with_media(query : String) : self #

Set media query


[View source]
def with_pseudo(pseudo : String) : self #

Set pseudo class


[View source]