+2008-10-07 Christian Hergert <christian.hergert@gmail.com>
+
+ * HtmlImage.cs: Do not render the src attribute if it is null or empty.
+ An empty src attribute makes browsers download the current page url as
+ the url of the image.
+
2008-08-29 Marek Habersack <mhabersack@novell.com>
* HtmlHead.cs: call base.OnInit ()
protected override void RenderAttributes (HtmlTextWriter w)
{
PreProcessRelativeReference (w, "src");
+
+ /* MS does not seem to render the src attribute if it
+ * is empty. Firefox, at least, will fetch the current
+ * page as the src="" if other img attributes exist.
+ */
+ string src = Attributes["src"];
+ if (src == null || src.Length == 0)
+ Attributes.Remove ("src");
+
base.RenderAttributes (w);
/* MS closes the HTML element at the end of
+2008-10-07 Christian Hergert <christian.hergert@gmail.com>
+
+ * HtmlImageTest.cs: Add test to make sure the src attribute is not
+ rendered when it is empty.
+
2008-07-27 Dean Brettle <dean@brettle.com>
* HtmlInputButtonTest.cs, HtmlImageTest.cs, HtmlFormTest.cs,
Assert.AreEqual (3, img.Attributes.Count, "Second Attributes Count");
}
+ [Test]
+ public void EmptySrc ()
+ {
+ TestHtmlImage img = new TestHtmlImage ();
+
+ img.Src = String.Empty;
+
+ HtmlTextWriter writer = img.GetWriter ();
+ Assert.AreEqual (" /", writer.InnerWriter.ToString ());
+ }
+
[Test]
[Category ("NunitWeb")]
public void RenderAttributes ()