/// <summary> /// Copies the attributes from the source element to the target /// element. Each attribute will be recreated on the target. /// </summary> /// <param name="source">The source of the attributes.</param> /// <param name="target"> /// The target where to create the attributes. /// </param> protected static void CopyAttributes(Element source, Element target) { foreach (var attribute in source._attributes) { var attr = new Attr(attribute.Prefix, attribute.LocalName, attribute.Value, attribute.NamespaceUri); target._attributes.FastAddItem(attr); } }
internal void RaiseChangedEvent(Attr attr, String newValue, String oldValue) { var element = default(Element); if (_owner.TryGetTarget(out element)) { element.AttributeChanged(attr.LocalName, attr.NamespaceUri, oldValue, newValue); } }
/// <summary> /// Adds all given attributes to the element, without any duplicate checks. /// </summary> /// <param name="element">The node with the target attributes.</param> /// <param name="attributes">The attributes to set.</param> public static void SetAttributes(this Element element, List<KeyValuePair<String, String>> attributes) { var container = element.Attributes; for (var i = 0; i < attributes.Count; i++) { var attribute = attributes[i]; var item = new Attr(attribute.Key, attribute.Value); container.FastAddItem(item); } }
protected void CloneElement(Element element, Boolean deep) { CloneNode(element, deep); foreach (var attribute in _attributes) { var attr = new Attr(attribute.Prefix, attribute.LocalName, attribute.Value, attribute.NamespaceUri); element._attributes.FastAddItem(attr); } element.SetupElement(); }
internal void FastAddItem(Attr attr) { _items.Add(attr); }
/// <summary> /// Adds an attribute. /// </summary> /// <param name="attr">The attribute to add.</param> public void AddAttribute(Attr attr) { _attributes.FastAddItem(attr); }