CssData

TheArtOfDev.HtmlRenderer.Core

Holds parsed stylesheet css blocks arranged by media and classes.

Konstruktoren

CssData()

Init.

Eigenschaften

MediaBlocks : IDictionary<string, Dictionary<string, List<CssBlock>>>

dictionary of media type to dictionary of css class name to the cssBlocks collection with all the data

Methoden

AddCssBlock(string, CssBlock)

Add the given css block to the css data, merging to existing block if required.

media
the media type to add the CSS to
cssBlock
the css block to add
Clone() : CssData

Create deep copy of the css data with cloned css blocks.

Rückgabe: cloned object

Combine(CssData)

Combine this CSS data blocks with CSS blocks for each media. Merge blocks if exists in both.

other
the CSS data to combine with
ContainsCssBlock(string, string) : bool

Check if there are css blocks for the given class selector.

className
the class selector to check for css blocks by
media
optional: the css media type (default - all)

Rückgabe: true - has css blocks for the class, false - otherwise

GetCssBlock(string, string) : IEnumerable<CssBlock>

Get collection of css blocks for the requested class selector. the can be: class name, html element name, html element and class name (elm.class), hash tag with element id (#id). returned all the blocks that word on the requested class selector, it can contain simple selector or hierarchy selector.

className
the class selector to get css blocks by
media
optional: the css media type (default - all)

Rückgabe: collection of css blocks, empty collection if no blocks exists (never null)

Parse(RAdapter, string, bool) : CssData

Parse the given stylesheet to CssData object. If is true the parsed css blocks are added to the default css data (as defined by W3), merged if class name already exists. If false only the data in the given stylesheet is returned.

adapter
Platform adapter
stylesheet
the stylesheet source to parse
combineWithDefault
true - combine the parsed css data with default css data, false - return only the parsed css data

Rückgabe: the parsed css data

Felder

_emptyArray : List<CssBlock>

used to return empty array

_mediaBlocks : Dictionary<string, Dictionary<string, List<CssBlock>>>

dictionary of media type to dictionary of css class name to the cssBlocks collection with all the data.