Esempio n. 1
0
 internal CssSimpleSelectorSequence(ICssSelectorSequence sequence, CssSimpleSelector otherSelector)
     : base(CalculateSpecificity(sequence, otherSelector))
 {
     ArgChecker.AssertIsTrue <ArgumentException>(!(otherSelector is CssTypeSelector), "Selector sequence cannot contain more than one type selector.");
     _typeSelector   = sequence.TypeSelector;
     _otherSelectors = sequence.OtherSelectors.Add(otherSelector);
 }
Esempio n. 2
0
 internal CssNegationSelector(CssSimpleSelector operand)
     : base(CalculateSpecificity(operand))
 {
     _operand = operand;
 }
Esempio n. 3
0
 private static CssSpecificity CalculateSpecificity(CssSimpleSelector selector)
 {
     ArgChecker.AssertArgNotNull(selector, nameof(selector));
     return(selector.Specificity);
 }
 /// <summary>
 /// Creates a new <see cref="CssSimpleSelectorSequence"/> consisting of a given sequence with an additional selector appended.
 /// </summary>
 /// <param name="sequence">A <see cref="CssTypeSelector"/> or <see cref="CssSimpleSelectorSequence"/> instance.</param>
 /// <param name="otherSelector">A simple, non-type selector to append to the original sequence.</param>
 /// <returns>a new <see cref="CssSimpleSelectorSequence"/> consisting of the original <paramref name="sequence"/> followed
 /// by <paramref name="otherSelector"/>.</returns>
 public static ICssSelectorSequence Add(this ICssSelectorSequence sequence, CssSimpleSelector otherSelector)
 {
     return(new CssSimpleSelectorSequence(sequence, otherSelector));
 }
Esempio n. 5
0
 private static CssSpecificity CalculateSpecificity(ICssSelectorSequence sequence, CssSimpleSelector otherSelector)
 {
     ArgChecker.AssertArgNotNull(sequence, nameof(sequence));
     ArgChecker.AssertArgNotNull(otherSelector, nameof(otherSelector));
     return(sequence.Specificity + otherSelector.Specificity);
 }