예제 #1
0
        private void RemoveElement(IHtmlElement element, IHtmlAttribute attribute)
        {
            var classes = attribute.Value();

            if (!string.IsNullOrEmpty(classes))
            {
                Regulars.whiteSpaceSeparatorRegex.Split(classes).ForAll(c => RemoveElement(c, element));
            }
        }
예제 #2
0
        private void RemoveElement(IHtmlElement element, IHtmlAttribute attribute)
        {
            var id = attribute.Value();

            if (id == null)
            {
                return;
            }

            data.Remove(id);
        }
예제 #3
0
    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 );
    }
예제 #4
0
        /// <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 );
        }
예제 #5
0
        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));
        }
예제 #6
0
        /// <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));
        }
예제 #7
0
        /// <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());
            }
        }