The HtmlFormElement class provides the base implementation of an element in a HTML form.
Inheritance: HtmlElement
コード例 #1
0
        /// <summary>
        /// Determines whether the item matches the specified value.
        /// </summary>
        /// <param name="item">
        /// The item.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// <c>true</c> if the item matches the value; otherwise <c>false</c>.
        /// </returns>
        private static bool MatchesItem(HtmlFormElement item, string value)
        {
            if (item == null)
            {
                return(false);
            }

            if (item.Value == null)
            {
                if (string.IsNullOrEmpty(value))
                {
                    return(true);
                }
            }
            else if (item.Value.Equals(value, StringComparison.Ordinal))
            {
                return(true);
            }

            if (item.Text == null)
            {
                if (string.IsNullOrEmpty(value))
                {
                    return(true);
                }
            }
            else if (item.Text.Equals(value, StringComparison.Ordinal))
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: HtmlList.cs プロジェクト: roryprimrose/Headless
        /// <summary>
        /// Determines whether the item matches the specified value.
        /// </summary>
        /// <param name="item">
        /// The item.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// <c>true</c> if the item matches the value; otherwise <c>false</c>.
        /// </returns>
        private static bool MatchesItem(HtmlFormElement item, string value)
        {
            if (item == null)
            {
                return false;
            }

            if (item.Value == null)
            {
                if (string.IsNullOrEmpty(value))
                {
                    return true;
                }
            }
            else if (item.Value.Equals(value, StringComparison.Ordinal))
            {
                return true;
            }

            if (item.Text == null)
            {
                if (string.IsNullOrEmpty(value))
                {
                    return true;
                }
            }
            else if (item.Text.Equals(value, StringComparison.Ordinal))
            {
                return true;
            }

            return false;
        }