コード例 #1
0
        /// <summary>
        /// Returns a set of elements which have all the given class names.
        /// </summary>
        /// <param name="elements">The elements to take as source.</param>
        /// <param name="classNames">A string representing the list of class names to match; class names are separated by whitespace.</param>
        /// <returns>A collection of HTML elements.</returns>
        public static HtmlElementCollection GetElementsByClassName(this INodeList elements, String classNames)
        {
            var result = new List <IElement>();
            var names  = classNames.SplitSpaces();

            if (names.Length > 0)
            {
                elements.GetElementsByClassName(names, result);
            }

            return(new HtmlElementCollection(result));
        }