Beispiel #1
0
 internal CssSimpleSelectorSequence(ICssSelectorSequence sequence, CssPseudoElement pseudoElement)
     : base(CalculateSpecificity(sequence, pseudoElement))
 {
     ArgChecker.AssertIsTrue <ArgumentException>(sequence.Subject.PseudoElement == null, "Selector sequence cannot contain more than one pseudo-element.");
     _typeSelector   = sequence.TypeSelector;
     _otherSelectors = sequence.OtherSelectors;
     _pseudoElement  = pseudoElement;
 }
Beispiel #2
0
 public override void VisitPseudoElement(CssPseudoElement element)
 {
     element.ToString(_sb);
 }
 /// <summary>
 /// Creates a new <see cref="CssSimpleSelectorSequence"/> consisting of a given sequence with an additional pseudo-element appended.
 /// </summary>
 /// <param name="sequence">A <see cref="CssTypeSelector"/> or <see cref="CssSimpleSelectorSequence"/> instance.</param>
 /// <param name="pseudoElement">The pseudo-element to append.</param>
 /// <returns>a new <see cref="CssSimpleSelectorSequence"/> consisting of the original <paramref name="sequence"/> followed
 /// by the <paramref name="pseudoElement"/>.</returns>
 public static ICssSelectorSequence Add(this ICssSelectorSequence sequence, CssPseudoElement pseudoElement)
 {
     return(new CssSimpleSelectorSequence(sequence, pseudoElement));
 }
 public virtual void VisitPseudoElement(CssPseudoElement element)
 {
 }
Beispiel #5
0
 private static CssSpecificity CalculateSpecificity(ICssSelectorSequence sequence, CssPseudoElement pseudoElement)
 {
     ArgChecker.AssertArgNotNull(sequence, nameof(sequence));
     ArgChecker.AssertArgNotNull(pseudoElement, nameof(pseudoElement));
     return(sequence.Specificity + new CssSpecificity(1, 0, 0));
 }