check MarkupTagElement attributes for comparison as well - hey, should we implement IComparable instead?
This commit is contained in:
parent
3d1c95aca3
commit
1877c20645
@ -132,7 +132,7 @@ namespace UniversalEditor.ObjectModels.Markup
|
||||
if (attID != null) id = attID.Value;
|
||||
}
|
||||
|
||||
if (Elements.Contains(el1.FullName, id))
|
||||
if (Elements.Contains(el1.FullName, id, (el1 is MarkupTagElement ? (el1 as MarkupTagElement).Attributes : null)))
|
||||
{
|
||||
Elements[el1.FullName].Combine(el1);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ namespace UniversalEditor.ObjectModels.Markup
|
||||
item.ParentObjectModel = this._parentObjectModel;
|
||||
base.Add(item);
|
||||
}
|
||||
public bool Contains(string fullName, string id = null)
|
||||
public bool Contains(string fullName, string id = null, MarkupAttribute.MarkupAttributeCollection attributes = null)
|
||||
{
|
||||
MarkupElement el = this[fullName];
|
||||
MarkupTagElement tag = (el as MarkupTagElement);
|
||||
@ -92,6 +92,18 @@ namespace UniversalEditor.ObjectModels.Markup
|
||||
MarkupAttribute attID = tag.Attributes["ID"];
|
||||
if (attID != null) retval &= (id == attID.Value);
|
||||
}
|
||||
|
||||
if (tag != null && attributes != null)
|
||||
{
|
||||
for (int i = 0; i < attributes.Count; i++)
|
||||
{
|
||||
MarkupAttribute att = tag.Attributes[attributes[i].Name];
|
||||
if (att != null && att.Value != attributes[i].Value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
public bool Contains(string fullName, Type elementType)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user