Example #1
0
        /// <summary>Gets all inputs from the given element, adding the results to the given list.</summary>
        /// <param name="results">The list that all results are added to.</param>
        /// <param name="element">The element to check.</param>
        public static void GetAllInputs(INodeList results, HtmlElement element, InputSearchMode mode)
        {
            NodeList kids = element.childNodes_;

            if (kids == null)
            {
                return;
            }

            for (int i = 0; i < kids.length; i++)
            {
                HtmlElement child = kids[i] as HtmlElement;

                if (child == null || child.Tag == "form")
                {
                    // Don't go into child forms.
                    continue;
                }

                if (
                    (mode == InputSearchMode.Submittable && child.IsFormSubmittable) ||
                    (mode == InputSearchMode.Listed && child.IsFormListed) ||
                    (mode == InputSearchMode.Resettable && child.IsFormResettable)
                    )
                {
                    results.push(child);
                }
                else
                {
                    GetAllInputs(results, child, mode);
                }
            }
        }
Example #2
0
        /// <summary>Gets all input elements contained within this form.</summary>
        /// <param name='mode'>The form search options.</summary>
        /// <returns>A list of all input elements.</returns>
        public HTMLFormControlsCollection GetAllInputs(InputSearchMode mode)
        {
            HTMLFormControlsCollection results = new HTMLFormControlsCollection();

            GetAllInputs(results, this, mode);
            return(results);
        }