Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new selector parser using the different factories.
        /// </summary>
        internal CssSelectorParser(IBrowsingContext context)
        {
            if (context == null)
            {
                context = BrowsingContext.NewFrom <ICssSelectorParser>(this);
            }

            _attribute     = context.GetFactory <IAttributeSelectorFactory>();
            _pseudoClass   = context.GetFactory <IPseudoClassSelectorFactory>();
            _pseudoElement = context.GetFactory <IPseudoElementSelectorFactory>();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new parser with the custom options and the given context.
 /// </summary>
 /// <param name="options">The options to use.</param>
 /// <param name="context">The context to use.</param>
 public HtmlParser(HtmlParserOptions options, IBrowsingContext context)
 {
     _options = options;
     _context = context ?? BrowsingContext.NewFrom <IHtmlParser>(this);
 }