public AttributeSelector(NamespacePrefixToken Namespace, string Attrib, CssToken OperatorToken, string Value) : base(ESimpleSelectorType.AttributeSelector) { this.Namespace = Namespace; this.AttributeName = Attrib; if (Value == null) { Value = string.Empty; } this.Value = Value; if (OperatorToken == null || OperatorToken.Type == ECssTokenType.Delim && (OperatorToken as DelimToken).Value == '>') { this.Operator = ECssAttributeOperator.Isset; } else { switch (OperatorToken.Type) { case ECssTokenType.Delim: { if ((OperatorToken as DelimToken).Value == '=') { this.Operator = ECssAttributeOperator.Equals; } } break; case ECssTokenType.Dash_Match: this.Operator = ECssAttributeOperator.PrefixedWith; break; case ECssTokenType.Include_Match: this.Operator = ECssAttributeOperator.Includes; break; case ECssTokenType.Prefix_Match: this.Operator = ECssAttributeOperator.StartsWith; break; case ECssTokenType.Suffix_Match: this.Operator = ECssAttributeOperator.EndsWith; break; case ECssTokenType.Substring_Match: this.Operator = ECssAttributeOperator.Contains; break; default: throw new CssSelectorException("Attribute selector: operator token-to-enum translation not implemented for (", OperatorToken, ")!"); } } }
/// <summary> /// </summary> /// <param name="Attrib">The attribute name for this selector</param> /// <param name="Operator">String token that defines the method of comparison</param> /// <param name="Value"></param> public AttributeSelector(NamespacePrefixToken Namespace, string Attrib) : base(ESimpleSelectorType.AttributeSelector) { this.Namespace = Namespace; this.AttributeName = Attrib; this.Operator = ECssAttributeOperator.Isset; }