public CssSimpleSelector(CssSimpleSelectorType simpleSelectorType, CssQualifiedName name, CssAttributeSelector[] attributeSelectors, CssPseudoClass[] pseudoClasses) { SimpleSelectorType = simpleSelectorType; Name = name ?? throw new ArgumentNullException(nameof(name)); AttributeSelectors = attributeSelectors ?? throw new ArgumentNullException(nameof(attributeSelectors)); PseudoClasses = pseudoClasses ?? throw new ArgumentNullException(nameof(pseudoClasses)); }
public bool TryReadQualifiedName(out CssQualifiedName qualifiedName) { qualifiedName = null; if (!TryReadIdentifier(out var name1)) { return(false); } if (CurrentChar == '|') { if (TryReadIdentifier(out var name2)) { qualifiedName = new CssQualifiedName(name1, name2); } } else { qualifiedName = new CssQualifiedName("", name1); } return(qualifiedName != null); }
private static bool TryParseSimpleSelector(CssStringStreamReader reader, CssSimpleSelectorType simpleSelectorType, CssQualifiedName name, out CssSimpleSelector selector) { var attributeSelectors = ParseAttributeSelectors(reader); var pseudoClasses = ParsePseudoClasses(reader); if (attributeSelectors == null || pseudoClasses == null) { selector = null; return(false); } selector = new CssSimpleSelector(simpleSelectorType, name, attributeSelectors, pseudoClasses); return(true); }