Author: kostat
Date: 2006-01-18 03:38:04 -0500 (Wed, 18 Jan 2006)
New Revision: 55708
Modified:
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterTest.cs
Log:
perform case insensitive compare; return correct key in default case
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2006-01-18 08:07:28 UTC
(rev 55707)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2006-01-18 08:38:04 UTC
(rev 55708)
@@ -1,3 +1,8 @@
+2006-01-18 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * HtmlTextWriter.cs: perform case insensitive compare;
+ return correct key in default case.
+
2006-01-11 Chris Toshok <[EMAIL PROTECTED]>
* ClientScriptManager.cs (RegisterClientScriptResource):
Modified: trunk/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs 2006-01-18
08:07:28 UTC (rev 55707)
+++ trunk/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs 2006-01-18
08:38:04 UTC (rev 55708)
@@ -204,11 +204,11 @@
// faster than a linear search?
foreach (HtmlAttribute t in htmlattrs) {
- if (t.name == attrName)
+ if (String.Compare(t.name, attrName, true,
CultureInfo.InvariantCulture) == 0)
return t.key;
}
- return 0;
+ return (HtmlTextWriterAttribute)(-1);
}
[MonoTODO]
@@ -229,11 +229,11 @@
// faster than a linear search?
foreach (HtmlStyle t in htmlstyles) {
- if (t.name == styleName)
+ if (String.Compare(t.name, styleName, true,
CultureInfo.InvariantCulture) == 0)
return t.key;
}
- return 0;
+ return (HtmlTextWriterStyle)(-1);
}
[MonoTODO]
@@ -251,7 +251,7 @@
// faster than a linear search?
foreach (HtmlTag t in tags) {
- if (t.name == tagName)
+ if (String.Compare(t.name, tagName, true,
CultureInfo.InvariantCulture) == 0)
return t.key;
}
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog 2006-01-18
08:07:28 UTC (rev 55707)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog 2006-01-18
08:38:04 UTC (rev 55708)
@@ -1,3 +1,8 @@
+2006-01-18 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * HtmlTextWriterTest.cs: Added tests enduring case insensitivity of
+ attributes and correctness of HtmlTextWriterAttribute
+
2005-12-05 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* ControlTest.cs: new tests to prove that Control uses its own
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterTest.cs
2006-01-18 08:07:28 UTC (rev 55707)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI/HtmlTextWriterTest.cs
2006-01-18 08:38:04 UTC (rev 55708)
@@ -352,5 +352,34 @@
Assert.AreEqual ("<div>\n\n</div>", sw.ToString ());
}
+
+ class MyHttpTextWriter : HtmlTextWriter {
+ int i = 0;
+ public MyHttpTextWriter(TextWriter tw) : base(tw) {
+
+ }
+ protected override bool OnAttributeRender(string name,
string value, HtmlTextWriterAttribute key) {
+ switch (i++) {
+ case 0:
+ case 1:
Assert.AreEqual(HtmlTextWriterAttribute.Border, key);
+ break;
+ case 2:
Assert.AreEqual((HtmlTextWriterAttribute)(-1), key);
+ break;
+ }
+ return base.OnAttributeRender (name, value,
key);
+ }
+
+ }
+
+ [Test]
+ public void TestOnAttributeRender() {
+ MyHttpTextWriter myw = new MyHttpTextWriter (sw);
+
+ myw.AddAttribute ("border", "0");
+ myw.AddAttribute ("BoRDeR", "0");
+ myw.AddAttribute ("error", "0");
+ myw.RenderBeginTag ("div");
+ myw.RenderEndTag ();
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches