Exemplo n.º 1
0
        /// <summary>
        /// Returns a list of the elements within the document (using depth-first pre-order traversal
        /// of the document's nodes) that matches the selector.
        /// </summary>
        /// <param name="elements">The elements to take as source.</param>
        /// <param name="selector">A selector object.</param>
        /// <returns>A HTMLCollection with all elements that match the selection.</returns>
        public static HtmlElementCollection QuerySelectorAll(this INodeList elements, ISelector selector)
        {
            var result = new List <IElement>();

            elements.QuerySelectorAll(selector, result);
            return(new HtmlElementCollection(result));
        }
Exemplo n.º 2
0
        public static IList <IElement> QuerySelectorAll(this INodeList elements, ISelector selector)
        {
            List <IElement> list = new List <IElement>();

            elements.QuerySelectorAll(selector, list);

            return(list);
        }
 /// <summary>
 /// Returns a list of the elements within the rendered fragment or component under test,
 /// (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors.
 /// </summary>
 /// <param name="selector">The group of selectors to use.</param>
 /// <param name="nodelist">The elements to search within</param>
 public static IHtmlCollection <IElement> FindAll(this INodeList nodelist, string selector)
 {
     if (nodelist is null)
     {
         throw new ArgumentNullException(nameof(nodelist));
     }
     return(nodelist.QuerySelectorAll(selector));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a list of the elements within the document (using depth-first pre-order traversal
 /// of the document's nodes) that match the specified group of selectors.
 /// </summary>
 /// <param name="elements">The elements to take as source.</param>
 /// <param name="selectors">A string containing one or more CSS selectors separated by commas.</param>
 /// <returns>A HTMLCollection with all elements that match the selection.</returns>
 public static HtmlCollection<IElement> QuerySelectorAll(this INodeList elements, String selectors)
 {
     var sg = CssParser.Default.ParseSelector(selectors);
     Validate(sg);
     var result = new List<IElement>();
     elements.QuerySelectorAll(sg, result);
     return new HtmlCollection<IElement>(result);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Returns a list of the elements within the document (using depth-first pre-order traversal
        /// of the document's nodes) that match the specified group of selectors.
        /// </summary>
        /// <param name="elements">The elements to take as source.</param>
        /// <param name="selectors">A string containing one or more CSS selectors separated by commas.</param>
        /// <returns>A HTMLCollection with all elements that match the selection.</returns>
        public static HtmlElementCollection QuerySelectorAll(this INodeList elements, String selectors)
        {
            var sg = CssParser.ParseSelector(selectors);

            if (sg == null)
            {
                throw new DomException(ErrorCode.Syntax);
            }

            var result = new List <IElement>();

            elements.QuerySelectorAll(sg, result);
            return(new HtmlElementCollection(result));
        }
Exemplo n.º 6
0
        public static IList <IElement> QuerySelectorAll(this INodeList elements, string selectors, CssParser parser)
        {
            var selector = parser.ParseSelector(selectors);

            if (selector == null)
            {
                throw new DomException(DomError.Syntax);
            }

            var list = new List <IElement>();

            elements.QuerySelectorAll(selector, list);

            return(list);
        }