2009-09-30 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 1 Oct 2009 02:24:00 +0000 (02:24 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 1 Oct 2009 02:24:00 +0000 (02:24 -0000)
* HtmlSelectBuilder.cs: <option> allows the value of the 'selected'
attribute to be a boolean or the string "selected", which is treated
as "true".

svn path=/trunk/mcs/; revision=143105

mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputSubmit.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelectBuilder.cs

index 08272e081f59114a036a11c37cf0ed3a4ab631b4..fcb86148dac48d1f798e37fe3d6710fea0f14b82 100644 (file)
@@ -1,3 +1,9 @@
+2009-09-30 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * HtmlSelectBuilder.cs: <option> allows the value of the 'selected'
+       attribute to be a boolean or the string "selected", which is treated
+       as "true".
+
 2009-06-16  Marek Habersack  <mhabersack@novell.com>
 
        * HtmlHeadBuilder.cs: use faster String.Compare overloads.
index 9430d0d4f03b410652989ea6df7695c157b97426..1fa8621810288e85115f97fadfaced858d605eab 100644 (file)
@@ -51,7 +51,6 @@ namespace System.Web.UI.HtmlControls {
                {
                }
                
-               [MonoTODO ("why our own version?")]
                void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
                {
                        base.RaisePostBackEvent (eventArgument);
index e280dee70d3fa9e17fc5567eb848e1f30f67ec40..0742249cb295d3fd3803ca5226479dc9774d273f 100644 (file)
@@ -49,9 +49,12 @@ namespace System.Web.UI.HtmlControls
 
                public override Type GetChildControlType (string tagName, IDictionary attribs) 
                {
-                       if (System.String.Compare (tagName, "option", true, CultureInfo.InvariantCulture) != 0)
+                       if (String.Compare (tagName, "option", true, CultureInfo.InvariantCulture) != 0)
                                return null;
 
+                       string selected = attribs ["selected"] as string;
+                       if (selected != null && selected.Length > 0 && String.Compare (selected, "selected", true, CultureInfo.InvariantCulture) == 0)
+                               attribs ["selected"] = "true";
                        return typeof (ListItem);
                }
        }