private void RemoveElement(IHtmlElement element, IHtmlAttribute attribute) { var classes = attribute.Value(); if (!string.IsNullOrEmpty(classes)) { Regulars.whiteSpaceSeparatorRegex.Split(classes).ForAll(c => RemoveElement(c, element)); } }
private void RemoveElement(IHtmlElement element, IHtmlAttribute attribute) { var id = attribute.Value(); if (id == null) { return; } data.Remove(id); }
public static IDictionary<string, string> ParseExpression( IHtmlAttribute attribute ) { var expression = attribute.Value(); if ( expression == null ) return null; var match = bindingExpressionRegex.Match( expression ); if ( match == null || !match.Success ) return null; return ParseExpression( match ); }
/// <summary> /// 解析属性为绑定表达式 /// </summary> /// <param name="attribute">要解析的属性</param> /// <returns>绑定表达式</returns> public static AttributeExpression ParseExpression( IHtmlAttribute attribute ) { var expression = attribute.Value(); if ( expression == null ) return null; var match = attributeExpressionRegex.Match( expression ); if ( match == null || !match.Success ) return null; return ParseExpression( match ); }
public static IDictionary <string, string> ParseExpression(IHtmlAttribute attribute) { var expression = attribute.Value(); if (expression == null) { return(null); } var match = bindingExpressionRegex.Match(expression); if (match == null || !match.Success) { return(null); } return(ParseExpression(match)); }
/// <summary> /// 解析属性为绑定表达式 /// </summary> /// <param name="attribute">要解析的属性</param> /// <returns>绑定表达式</returns> public static AttributeExpression ParseExpression(IHtmlAttribute attribute) { var expression = attribute.Value(); if (expression == null) { return(null); } var match = attributeExpressionRegex.Match(expression); if (match == null || !match.Success) { return(null); } return(ParseExpression(match)); }
/// <summary> /// 进行属性绑定 /// </summary> /// <param name="attribute">要绑定的属性</param> protected virtual void BindAttribute(IHtmlAttribute attribute) { var expression = BindingExpression.ParseExpression(attribute.Value()); if (expression == null) { return; } var value = GetValue(expression); if (value == null) { attribute.Remove(); } else { attribute.SetValue(value.ToString()); } }