diff --git a/source/CsQuery.Tests/Core/OutputFormatters/FormatDefault.cs b/source/CsQuery.Tests/Core/OutputFormatters/FormatDefault.cs new file mode 100644 index 00000000..384137df --- /dev/null +++ b/source/CsQuery.Tests/Core/OutputFormatters/FormatDefault.cs @@ -0,0 +1,22 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; +using Assert = NUnit.Framework.Assert; + +namespace CsQuery.Tests.Core.OutputFormatters_ +{ + [TestFixture, TestClass] + class FormatDefault + { + [Test, TestMethod] + public void RenderLeadingXmlTag() + { + const string XmlTag = @""; + + var formatter = new Output.FormatDefault(); + var comment = new CsQuery.Implementation.DomComment(XmlTag); + var actual = formatter.Render(comment); + + Assert.AreEqual(XmlTag, actual, "FormatDefault should not change leading xml tag."); + } + } +} diff --git a/source/CsQuery.Tests/Csquery.Tests.csproj b/source/CsQuery.Tests/Csquery.Tests.csproj index 4e435cc8..66f300d0 100644 --- a/source/CsQuery.Tests/Csquery.Tests.csproj +++ b/source/CsQuery.Tests/Csquery.Tests.csproj @@ -96,6 +96,7 @@ + diff --git a/source/CsQuery/Output/OutputFormatterDefault.cs b/source/CsQuery/Output/OutputFormatterDefault.cs index b4cb1dc9..6c948817 100644 --- a/source/CsQuery/Output/OutputFormatterDefault.cs +++ b/source/CsQuery/Output/OutputFormatterDefault.cs @@ -430,6 +430,10 @@ protected void RenderCommentNode(IDomObject element, TextWriter writer) { return; } + else if (element.NodeValue.StartsWith("")) + { + writer.Write(element.NodeValue); + } else { writer.Write("");