Xinf API Reference
Back | Index
class xinf.style.StyleParser
The StyleParser class provides static functions to parse CSS-type style definitions, selectors and rules into xinf types (and intermediate objects).
static function fromObject( s:Dynamic, via:TraitAccess, to:Dynamic ) :Void
From a dynamic object with text values as returned by parseToObject, parse individual style properties as defined by via's traits definitions, and set the resulting typed values on to.
static function parseToObject( text:String ) :Dynamic

Parse a single CSS style definition (as found in a "style" attribute) into an dynamic object. The property values are not parsed, but retained as Strings (use fromObject to parse/type them).

For example, "fill:red,stroke:#f00" will be turned into { style:"red", stroke:"#f00" }.

static function parseRules( text:String ) :Array<StyleRule>
parse CSS style rules, as found in a <style type="text/css"> element.
Back | Index