Пример #1
0
        public override CssRule Create(CssToken current)
        {
            var token = _tokenizer.Get();
            var rule = new CssPageRule(_parser);
            rule.Selector = CreateSelector(ref token);

            if (token.Type != CssTokenType.CurlyBracketOpen)
                return SkipDeclarations(token);

            FillDeclarations(rule.Style);
            return rule;
        }
Пример #2
0
        public CssRule CreatePage(CssToken current)
        {
            var rule = new CssPageRule(_parser);
            var start = current.Position;
            var token = NextToken();
            _nodes.Push(rule);
            CollectTrivia(ref token);
            rule.Selector = CreateSelector(ref token);
            CollectTrivia(ref token);

            if (token.Type == CssTokenType.CurlyBracketOpen)
            {
                var end = FillDeclarations(rule.Style);
                rule.SourceCode = CreateView(start, end);
                _nodes.Pop();
                return rule;
            }

            _nodes.Pop();
            return SkipDeclarations(token);
        }