示例#1
0
        public override Node Evaluate(Env env)
        {
            var newExact = new List<Selector>();
            foreach (var e in Exact)
            {
                var childContext = env.CreateChildEnv(new Stack<Ruleset>(env.Frames.Reverse()));
                e.AppendCSS(childContext);
                newExact.Add(new Selector(new []{new Element(e.Elements.First().Combinator,childContext.Output.ToString().Trim())}));
            }

            var newPartial = new List<Selector>();
            foreach (var e in Partial)
            {
                var childContext = env.CreateChildEnv(new Stack<Ruleset>(env.Frames.Reverse()));
                e.AppendCSS(childContext);
                newPartial.Add(new Selector(new[] { new Element(e.Elements.First().Combinator, childContext.Output.ToString().Trim()) }));
            }

            return new Extend(newExact,newPartial);
        }
示例#2
0
        public override Node Evaluate(Env env)
        {
            var newExact = new List<Selector>();
            foreach (var e in Exact)
            {
                var childContext = env.CreateChildEnv();
                e.AppendCSS(childContext);
                var selector = new Selector(new []{new Element(e.Elements.First().Combinator,childContext.Output.ToString().Trim())});
                selector.IsReference = IsReference;
                newExact.Add(selector);
            }

            var newPartial = new List<Selector>();
            foreach (var e in Partial)
            {
                var childContext = env.CreateChildEnv();
                e.AppendCSS(childContext);
                var selector = new Selector(new[] { new Element(e.Elements.First().Combinator, childContext.Output.ToString().Trim()) });
                selector.IsReference = IsReference;
                newPartial.Add(selector);
            }

            return new Extend(newExact,newPartial) { IsReference = IsReference, Location = Location };
        }