示例#1
0
 public void NormalizeRemovesEmptyTextNodesNested()
 {
     var div = new HTMLDivElement();
     var a = new HTMLAnchorElement();
     a.AppendChild(new TextNode());
     a.AppendChild(new TextNode("Not empty."));
     div.AppendChild(a);
     div.AppendChild(new TextNode());
     div.AppendChild(new HTMLDivElement());
     div.AppendChild(new TextNode("Certainly not empty!"));
     div.AppendChild(new HTMLImageElement());
     div.Normalize();
     Assert.AreEqual(a.ChildNodes.Length, 1);
 }
示例#2
0
 public void NormalizeMergeTextNodes()
 {
     var div = new HTMLDivElement();
     var a = new HTMLAnchorElement();
     a.AppendChild(new TextNode());
     a.AppendChild(new TextNode("Not empty."));
     div.AppendChild(a);
     div.AppendChild(new TextNode());
     div.AppendChild(new HTMLDivElement());
     div.AppendChild(new TextNode("Certainly not empty!"));
     div.AppendChild(new TextNode("Certainly not empty!"));
     div.AppendChild(new TextNode("Certainly not empty!"));
     div.AppendChild(new TextNode("Certainly not empty!"));
     div.AppendChild(new HTMLImageElement());
     div.Normalize();
     Assert.AreEqual(div.ChildNodes.Length, 4);
 }