Exemple #1
0
        /// <summary>
        /// Takes a string and transforms it into a selector object.
        /// </summary>
        public ISelector ParseSelector(String selectorText)
        {
            var source      = new StringSource(selectorText);
            var tokenizer   = new CssTokenizer(source);
            var constructor = new CssSelectorConstructor(tokenizer, _attribute, _pseudoClass, _pseudoElement);

            return(constructor.Parse());
        }
Exemple #2
0
        private CssTokenizer CreateTokenizer(TextSource source)
        {
            var tokenizer = new CssTokenizer(source);

            if (HasEventListener(EventNames.Error))
            {
                tokenizer.Error += (_, ev) => InvokeEventListener(ev);
            }

            return(tokenizer);
        }
 public CssSelectorConstructor(CssTokenizer tokenizer, IAttributeSelectorFactory attributeSelector, IPseudoClassSelectorFactory pseudoClassSelector, IPseudoElementSelectorFactory pseudoElementSelector, Boolean invoked = false)
 {
     _tokenizer             = tokenizer;
     _invoked               = invoked;
     _combinators           = new Stack <CssCombinator>();
     _attributeSelector     = attributeSelector;
     _pseudoClassSelector   = pseudoClassSelector;
     _pseudoElementSelector = pseudoElementSelector;
     _attrOp          = String.Empty;
     _attrInsensitive = false;
     _state           = State.Data;
     _valid           = true;
     _ready           = true;
 }
 public CssBuilder(CssParserOptions options, CssTokenizer tokenizer, IBrowsingContext context)
 {
     _tokenizer = tokenizer;
     _options   = options;
     _context   = context;
 }