Class CssData
Holds parsed stylesheet css blocks arranged by media and classes.
CssBlock
Inheritance
Inherited Members
Namespace: TheArtOfDev.HtmlRenderer.Core
Assembly: Telerik.WinControls.RadMap.dll
Syntax
public sealed class CssData
Remarks
To learn more about CSS blocks visit CSS spec: http://www.w3.org/TR/CSS21/syndata.html#block
Methods
AddCssBlock(String, CssBlock)
Add the given css block to the css data, merging to existing block if required.
Declaration
public void AddCssBlock(string media, CssBlock cssBlock)
Parameters
System.String
media
the media type to add the CSS to |
CssBlock
cssBlock
the css block to add |
Remarks
If there is no css blocks for the same class it will be added to data collection.
If there is already css blocks for the same class it will check for each existing block
if the hierarchical selectors match (or not exists). if do the two css blocks will be merged into
one where the new block properties overwrite existing if needed. if the new block doesn't mach any
existing it will be added either to the beginning of the list if it has no hierarchical selectors or at the end.
Css block without hierarchical selectors must be added to the beginning of the list so more specific block
can overwrite it when the style is applied.
Clone()
Create deep copy of the css data with cloned css blocks.
Declaration
public CssData Clone()
Returns
CssData
cloned object |
Combine(CssData)
Combine this CSS data blocks with other
CSS blocks for each media.
Merge blocks if exists in both.
Declaration
public void Combine(CssData other)
Parameters
CssData
other
the CSS data to combine with |
ContainsCssBlock(String, String)
Check if there are css blocks for the given class selector.
Declaration
public bool ContainsCssBlock(string className, string media = "all")
Parameters
System.String
className
the class selector to check for css blocks by |
System.String
media
optional: the css media type (default - all) |
Returns
System.Boolean
true - has css blocks for the class, false - otherwise |
GetCssBlock(String, String)
Get collection of css blocks for the requested class selector.
the className
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.
Declaration
public IEnumerable<CssBlock> GetCssBlock(string className, string media = "all")
Parameters
System.String
className
the class selector to get css blocks by |
System.String
media
optional: the css media type (default - all) |
Returns
System.Collections.Generic.IEnumerable<CssBlock>
collection of css blocks, empty collection if no blocks exists (never null) |
Parse(RAdapter, String, Boolean)
Parse the given stylesheet to CssData object.
If combineWithDefault
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.
Declaration
public static CssData Parse(RAdapter adapter, string stylesheet, bool combineWithDefault = true)
Parameters
RAdapter
adapter
Platform adapter |
System.String
stylesheet
the stylesheet source to parse |
System.Boolean
combineWithDefault
true - combine the parsed css data with default css data, false - return only the parsed css data |
Returns
CssData
the parsed css data |