Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chris@dronelabs.com>2008-10-08 03:41:53 +0400
committerChristian Hergert <chris@dronelabs.com>2008-10-08 03:41:53 +0400
commit3eb3075f1194258ea080c2868eb2cea26c88d07c (patch)
treebe992aebb8e56e05e7034646983ac874bfe0619b /mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
parenteceef02fa9a02620161ab1bbe9cb946d08f247c3 (diff)
2008-10-07 Christian Hergert <christian.hergert@gmail.com>
* System.Web.UI.HtmlControls/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. * Test/System.Web.UI.HtmlControls/HtmlImageTest.cs: Add test to make sure the src attribute is not rendered when it is empty. svn path=/trunk/mcs/; revision=115158
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs')
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
index e72ba3e93af..7bf0cdff035 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
@@ -201,6 +201,15 @@ namespace System.Web.UI.HtmlControls
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