public static IEnumerable<Declaration> GetMatchingVendorEntriesInRule(Declaration declaration, RuleBlock rule, ICssSchemaInstance schema) { foreach (Declaration d in rule.Declarations.Where(d => d.IsValid && d.IsVendorSpecific())) foreach (string prefix in GetPrefixes(schema)) { if (d.PropertyName.Text == prefix + declaration.PropertyName.Text) { yield return d; break; } } }
public MixinDefinition(Selector selector, IEnumerable <MixinParameterBase> parameters, RuleBlock block, MixinGuard guard) { // Combinators (descendant selectors etc.) do not count in mixin calls. // E.g. #id > .class is equivalent to #id .class this.Selector = selector.DropCombinators(); this.parameters = parameters.ToList(); this.block = block; this.guard = guard; this.IsDefaultOverload = guard is DefaultMixinGuard; var varargsCount = this.parameters.OfType <VarargsParameter>().Count(); if (varargsCount > 1 || varargsCount == 1 && !(this.parameters.Last() is VarargsParameter)) { throw new ParserException("Only one varargs parameter at the end of the parameter list is allowed"); } }
private static int AdjustLength(RuleBlock rule, int start, int length) { var inner = new CssItemCollector<RuleSet>(); rule.Accept(inner); if (inner.Items.Count > 0) { length = inner.Items[0].Start - start; } return length; }
public static IEnumerable <Declaration> GetMatchingVendorEntriesInRule(Declaration declaration, RuleBlock rule, ICssSchemaInstance schema) { foreach (Declaration d in rule.GetDeclarations().Where(d => d.IsValid && d.IsVendorSpecific())) { foreach (string prefix in GetPrefixes(schema)) { if (d.PropertyName.Text == prefix + declaration.PropertyName.Text) { yield return(d); break; } } } }