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)); }
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"))); }
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); }
// 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); }