Ejemplo n.º 1
0
        /// <summary>
        /// Returns the value of the "src" or "href" attribute, depending on the element type. If non
        /// applicable, returns empty string.
        /// </summary>
        ///
        /// <param name="obj">
        /// The obj to act on.
        /// </param>
        ///
        /// <returns>
        /// A string
        /// </returns>

        public static string UrlSource(this IDomObject obj)
        {
            switch (obj.NodeNameID)
            {
            case HtmlData.tagLINK:
            case HtmlData.tagA:
                return(obj.GetAttribute("href"));

            case HtmlData.tagIMG:
            case HtmlData.tagSCRIPT:
                return(obj.GetAttribute("src"));

            default:
                return("");
            }
        }