示例#1
0
        public NodeList Find(Selector selector, Ruleset self)
        {
            self = self ?? this;
              var rules = new NodeList();
              var key = selector.ToCSS();

              if (_lookups.ContainsKey(key))
            return _lookups[key];

              foreach (var rule in Rulesets().Where(rule => rule != self))
              {
            if (rule.Selectors && rule.Selectors.Any(selector.Match))
            {
              if (selector.Elements.Count > 1)
              {
            var remainingSelectors = new Selector(new NodeList<Element>(selector.Elements.Skip(1)));
            rules.AddRange(rule.Find(remainingSelectors, self));
              }
              else
            rules.Add(rule);
            }
              }
              return _lookups[key] = rules;
        }
示例#2
0
 public Call(NodeList<Element> elements, NodeList<Expression> arguments)
 {
     Selector = new Selector(elements);
     Arguments = arguments;
 }
示例#3
0
 public bool Match(Selector other)
 {
     return Elements[0].Value == other.Elements[0].Value;
 }