Beispiel #1
0
        /// <summary>The <see cref="AttribOperatorAndValueNode"/> visit implementation</summary>
        /// <param name="attribOperatorAndValueNode">The attribOperatorAndValue AST node</param>
        /// <returns>The modified AST node if modified otherwise the original node</returns>
        public override AstNode VisitAttribOperatorAndValueNode(AttribOperatorAndValueNode attribOperatorAndValueNode)
        {
            // [ [ PREFIXMATCH |
            // SUFFIXMATCH |
            // SUBSTRINGMATCH |
            // '=' |
            // INCLUDES |
            // DASHMATCH ] S* [ IDENT | STRING ] S*
            // ]?
            if (string.IsNullOrWhiteSpace(attribOperatorAndValueNode.IdentOrString))
            {
                return(attribOperatorAndValueNode);
            }

            // Add the appropriate enum for: [ '=' | INCLUDES | DASHMATCH ]
            switch (attribOperatorAndValueNode.AttribOperatorKind)
            {
            case AttribOperatorKind.Prefix:
                _printerFormatter.Append(CssConstants.PrefixMatch);
                break;

            case AttribOperatorKind.Suffix:
                _printerFormatter.Append(CssConstants.SuffixMatch);
                break;

            case AttribOperatorKind.Substring:
                _printerFormatter.Append(CssConstants.SubstringMatch);
                break;

            case AttribOperatorKind.Equal:
                _printerFormatter.Append(CssConstants.Equal);
                break;

            case AttribOperatorKind.Includes:
                _printerFormatter.Append(CssConstants.Includes);
                break;

            case AttribOperatorKind.DashMatch:
                _printerFormatter.Append(CssConstants.DashMatch);
                break;
            }

            // append for: [ IDENT | STRING ]
            _printerFormatter.Append(attribOperatorAndValueNode.IdentOrString);

            return(attribOperatorAndValueNode);
        }
Beispiel #2
0
 /// <summary>The <see cref="Ast.Selectors.AttribOperatorAndValueNode"/> visit implementation</summary>
 /// <param name="attribOperatorAndValueNode">The attribOperatorAndValue AST node</param>
 /// <returns>The modified AST node if modified otherwise the original node</returns>
 public virtual AstNode VisitAttribOperatorAndValueNode(AttribOperatorAndValueNode attribOperatorAndValueNode)
 {
     return(attribOperatorAndValueNode);
 }
 /// <summary>The <see cref="Ast.Selectors.AttribOperatorAndValueNode"/> visit implementation</summary>
 /// <param name="attribOperatorAndValueNode">The attribOperatorAndValue AST node</param>
 /// <returns>The modified AST node if modified otherwise the original node</returns>
 public override AstNode VisitAttribOperatorAndValueNode(AttribOperatorAndValueNode attribOperatorAndValueNode)
 {
     return(new AttribOperatorAndValueNode(attribOperatorAndValueNode.AttribOperatorKind, attribOperatorAndValueNode.IdentOrString));
 }