Exemple #1
0
        public void handles_unknown_inline_tags()
        {
            string       h      = "<p><cust>Test</cust></p><p><cust><cust>Test</cust></cust></p>";
            HtmlDocument doc    = HtmlParser.ParseBodyFragment(h, null);
            string       output = doc.Body.InnerHtml;

            Assert.Equal(h, TextUtil.StripNewLines(output));
        }
Exemple #2
0
        public void parses_body_fragment()
        {
            string       h   = "<!-- comment --><p><a href='foo'>One</a></p>";
            HtmlDocument doc = HtmlParser.ParseBodyFragment(h, new Uri("http://example.com"));

            Assert.Equal("<body><!-- comment --><p><a href=\"foo\">One</a></p></body>", TextUtil.StripNewLines(doc.Body.OuterHtml));
            var a = doc.QuerySelector("a");

            Assert.Equal(new Uri("http://example.com/foo"), new Uri(a.BaseUri, a.Attribute("href")));
        }
Exemple #3
0
        public HtmlElement Prepend(string html)
        {
            if (html == null)
            {
                throw new ArgumentNullException("html");
            }

            var nodes = HtmlParser.ParseFragment(html, this, this.BaseUri);

            Prepend(nodes.ToArray());
            return(this);
        }
Exemple #4
0
        // TODO Requires f-web-dom upgrade to include DomReader/HtmlReader
        public HtmlElement Append(string html)
        {
            if (html == null)
            {
                throw new ArgumentNullException("html");
            }

            IList <DomNode> nodes = HtmlParser.ParseFragment(html, this, BaseUri);

            Append(nodes.ToArray());
            return(this);
        }