protected ICssStyleDeclaration CreateStyle() { const NodeFlags TargetFlags = NodeFlags.HtmlMember | NodeFlags.SvgMember; if ((Flags & TargetFlags) != NodeFlags.None) { var document = Owner; var config = document.Options; var context = document.Context; var engine = config.GetCssStyleEngine(); if (engine != null) { var source = this.GetOwnAttribute(AttributeNames.Style); var options = new StyleOptions(context) { Element = this }; var style = engine.ParseDeclaration(source, options); var bindable = style as IBindable; if (bindable != null) { bindable.Changed += value => UpdateAttribute(AttributeNames.Style, value); } return(style); } } return(null); }
protected ICssStyleDeclaration CreateStyle() { if (_attributes.HasHandler(AttributeNames.Style)) { var config = Owner.Options; var engine = config.GetCssStyleEngine(); if (engine != null) { var source = this.GetOwnAttribute(AttributeNames.Style); var options = new StyleOptions { Element = this, Configuration = config }; var style = engine.ParseDeclaration(source, options); var bindable = style as IBindable; if (bindable != null) { bindable.Changed += value => UpdateAttribute(AttributeNames.Style, value); } return(style); } } return(null); }
/// <summary> /// Creates a new MediaQueryList object representing the parsed results /// of the specified media query string. /// </summary> /// <param name="mediaText">The query string.</param> /// <returns>The MediaQueryList instance.</returns> public IMediaQueryList MatchMedia(String mediaText) { var config = _document.Options; var options = new StyleOptions(_document.Context); var media = config.GetCssStyleEngine().ParseMedia(mediaText, options); return(new CssMediaQueryList(this, media)); }