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:
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlElement.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs8
1 files changed, 3 insertions, 5 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
index a74d801671c..f506853124d 100644
--- a/mcs/class/System.XML/System.Xml/XmlElement.cs
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -115,13 +115,11 @@ namespace System.Xml
}
set {
// Why its behavior (of MS FCL) is different from InnerXml...?
- if (FirstChild != null && FirstChild.NodeType == XmlNodeType.Text)
+ if (ChildNodes != null && ChildNodes.Count == 1 && FirstChild.NodeType == XmlNodeType.Text)
FirstChild.Value = value;
else {
- if (FirstChild != null) {
- for (int i = 0; i < ChildNodes.Count; i++)
- this.RemoveChild (ChildNodes [i]);
- }
+ while (FirstChild != null)
+ this.RemoveChild (FirstChild);
// creates new Text node
AppendChild (OwnerDocument.CreateTextNode (value));
}