+2006-01-18 Konstantin Triger <kostat@mainsoft.com>
+
+ * HtmlTextWriter.cs: perform case insensitive compare;
+ return correct key in default case.
+
2006-01-11 Chris Toshok <toshok@ximian.com>
* ClientScriptManager.cs (RegisterClientScriptResource):
// 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]
// 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]
// 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;
}
+2006-01-18 Konstantin Triger <kostat@mainsoft.com>
+
+ * HtmlTextWriterTest.cs: Added tests enduring case insensitivity of
+ attributes and correctness of HtmlTextWriterAttribute
+
2005-12-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* ControlTest.cs: new tests to prove that Control uses its own
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 ();
+ }
}
}