本文整理汇总了C#中ParseItem.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# ParseItem.Accept方法的具体用法?C# ParseItem.Accept怎么用?C# ParseItem.Accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseItem
的用法示例。
在下文中一共展示了ParseItem.Accept方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateCache
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);
}
}
示例2: UpdateCache
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);
}
}
}
示例3: UpdateCache
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);
}
}
}
示例4: UpdateDeclarationCache
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);
}
}
示例5: UpdateDeclarationCache
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 images = rule.Declarations.Where(d => d.PropertyName.Text.Contains("background"));
foreach (Declaration image in images)
{
if (!Cache.Contains(image))
Cache.Add(image);
}
rules.Add(rule);
}
}