Esempio n. 1
0
        public static HtmlImageElement CreateHtmlImageElement(this HtmlDocument doc, Decorate <HtmlImageElement> dec = null)
        {
            var elem = new HtmlImageElement(
                doc,
                0,             //null=> 0
                doc.AddStringIfNotExists("img"));

            dec?.Invoke(elem);
            return(elem);
        }
Esempio n. 2
0
        public static HtmlElement CreateHtmlSpan(this HtmlDocument doc, Decorate <HtmlElement> dec = null)
        {
            var elem = new HtmlElement(
                doc,
                0,
                doc.AddStringIfNotExists("span"));

            dec?.Invoke(elem);
            return(elem);
        }
Esempio n. 3
0
        public static HtmlElement CreateHtmlElement(this HtmlDocument doc, string prefix, string localName)
        {
            //wellknown name?
            HtmlElement htmlElement;

            switch (localName)
            {
            case "img":
            {
                htmlElement = new HtmlImageElement(
                    doc,
                    doc.AddStringIfNotExists(prefix),
                    doc.AddStringIfNotExists(localName));
            }
            break;

            case "input":
            {
                //input type
                htmlElement = new HtmlInputElement(
                    doc,
                    doc.AddStringIfNotExists(prefix),
                    doc.AddStringIfNotExists(localName));
            }
            break;

            case "option":
            {
                htmlElement = new HtmlOptionElement(
                    doc,
                    doc.AddStringIfNotExists(prefix),
                    doc.AddStringIfNotExists(localName));
            }
            break;

            default:
            {
                htmlElement = new HtmlElement(doc,
                                              doc.AddStringIfNotExists(prefix),
                                              doc.AddStringIfNotExists(localName));
                htmlElement.WellknownElementName = WellKnownDomNodeMap.EvaluateTagName(htmlElement.LocalName);
            }
            break;
            }
            return(htmlElement);
        }