private void UpdateDeclarationCache(ParseItem item)
        {
            var visitor = new CssItemCollector <Declaration>(true);

            item.Accept(visitor);

            HashSet <RuleBlock> rules = new HashSet <RuleBlock>();

            foreach (Declaration dec in visitor.Items)
            {
                RuleBlock rule = dec.Parent as RuleBlock;
                if (rule == null || rules.Contains(rule))
                {
                    continue;
                }

                var vendors = rule.Declarations.Where(d => d.IsValid && d.IsVendorSpecific());
                foreach (Declaration vendor in vendors)
                {
                    string      name     = GetStandardName(vendor);
                    Declaration standard = rule.Declarations.FirstOrDefault(d => d.IsValid && d.PropertyName.Text == name);

                    if (standard != null)
                    {
                        if (!Cache.Contains(standard))
                        {
                            Cache.Add(standard);
                        }

                        if (GetValueText(standard) == GetValueText(vendor) && !Cache.Contains(vendor))
                        {
                            Cache.Add(vendor);
                        }
                    }
                }

                rules.Add(rule);
            }
        }
Esempio n. 2
0
        private void UpdateCache(ParseItem item)
        {
            var visitor = new CssItemCollector <Declaration>(true);

            item.Accept(visitor);

            foreach (TokenItem token in visitor.Items.Where(d => d.Important != null).Select(d => d.Important))
            {
                if (!_cache.Contains(token))
                {
                    _cache.Add(token);
                }
            }
        }
Esempio n. 3
0
        private void UpdateCache(ParseItem item)
        {
            var visitor = new CssItemCollector <Declaration>(true);

            item.Accept(visitor);

            foreach (Declaration dec in visitor.Items)
            {
                string text = dec.Text;

                if (text.StartsWith("var-", StringComparison.Ordinal))
                {
                    if (!_cache.Contains(dec))
                    {
                        _cache.Add(dec);
                    }
                }
            }
        }
        private void UpdateCache(ParseItem item)
        {
            var visitor = new CssItemCollector <SimpleSelector>(true);

            item.Accept(visitor);

            foreach (SimpleSelector ss in visitor.Items)
            {
                string text = ss.Text;

                if (ModernizrProvider.IsModernizr(text))
                {
                    if (!_cache.Contains(ss))
                    {
                        _cache.Add(ss);
                    }
                }
            }
        }