Ejemplo n.º 1
0
 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;
             }
         }
 }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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;
                    }
                }
            }
        }