示例#1
0
 static CssImportRule NewImportRule(String cssText)
 {
     var parser = new CssParser();
     var rule = new CssImportRule(parser);
     rule.CssText = cssText;
     return rule;
 }
示例#2
0
        public CssRule CreateImport(CssToken current)
        {
            var token = _tokenizer.Get();
            var rule = new CssImportRule(_parser);

            if (token.Is(CssTokenType.String, CssTokenType.Url))
            {
                rule.Href = token.Data;
                token = _tokenizer.Get();
                FillMediaList(rule.Media, CssTokenType.Semicolon, ref token);
            }

            _tokenizer.JumpToNextSemicolon();
            return rule;
        }
示例#3
0
        public CssRule CreateImport(CssToken current)
        {
            var rule = new CssImportRule(_parser);
            var start = current.Position;
            var token = NextToken();
            _nodes.Push(rule);
            CollectTrivia(ref token);

            if (token.Is(CssTokenType.String, CssTokenType.Url))
            {
                rule.Href = token.Data;
                token = NextToken();
                CollectTrivia(ref token);
                FillMediaList(rule.Media, CssTokenType.Semicolon, ref token);
            }

            CollectTrivia(ref token);
            JumpToEnd(ref token);
            rule.SourceCode = CreateView(start, token.Position);
            _nodes.Pop();
            return rule;
        }