CssBlock

TheArtOfDev.HtmlRenderer.Core.Entities

Represents a block of CSS property values. Contains collection of key-value pairs that are CSS properties for specific css class. Css class can be either custom or html tag name.

Constructors

CssBlock(string, Dictionary<string, string>, List<CssBlockSelectorItem>, bool)

Creates a new block from the block's source

class
the name of the css class of the block
properties
the CSS block properties and values
selectors
optional: additional selectors to used in hierarchy
hover
optional: is the css block has :hover pseudo-class

Properties

Class : string

the name of the css class of the block

Hover : bool

is the css block has :hover pseudo-class

Properties : IDictionary<string, string>

Gets the CSS block properties and its values

Selectors : List<CssBlockSelectorItem>

additional selectors to used in hierarchy (p className1 > className2)

Methods

Clone() : CssBlock

Create deep copy of the CssBlock.

Returns: new CssBlock with same data

Equals(CssBlock) : bool

Check if the two css blocks are the same (same class, selectors and properties).

other
the other block to compare to

Returns: true - the two blocks are the same, false - otherwise

Equals(object) : bool

Check if the two css blocks are the same (same class, selectors and properties).

obj
the other block to compare to

Returns: true - the two blocks are the same, false - otherwise

EqualsSelector(CssBlock) : bool

Check if the selectors of the css blocks is the same.

other
the other block to compare to

Returns: true - the selectors on blocks are the same, false - otherwise

GetHashCode() : int

Serves as a hash function for a particular type.

Returns: A hash code for the current Object.

Merge(CssBlock)

Merge the other block properties into this css block. Other block properties can overwrite this block properties.

other
the css block to merge with
ToString() : string

Returns a String that represents the current Object.

Fields

_class : string

the name of the css class of the block

_hover : bool

is the css block has :hover pseudo-class

_properties : Dictionary<string, string>

the CSS block properties and values

_selectors : List<CssBlockSelectorItem>

additional selectors to used in hierarchy (p className1 > className2)