public override Boolean Apply(Element element) { if (!element.HasAttribute(Parent.Name)) element.SetAttribute(Parent.Name, Value); else if (IsFixed) return element.GetAttribute(Parent.Name) == Value; return true; }
public override Boolean Check(Element element) { if (element.HasAttribute(Parent.Name)) { var attr = element.Attributes[Parent.Name]; if (!Names.Contains(attr.Value)) return false; } return true; }
public override Boolean Apply(Element element) { return element.HasAttribute(Parent.Name); }
/// <summary> /// Checks for each attribute on the token if the attribute is already present on the node. /// If it is not, the attribute and its corresponding value is added to the node. /// </summary> /// <param name="elementToken">The token with the source attributes.</param> /// <param name="element">The node with the target attributes.</param> void AppendAttributes(HtmlTagToken elementToken, Element element) { foreach (var attr in elementToken.Attributes) { if (!element.HasAttribute(attr.Key)) element.SetAttribute(attr.Key, attr.Value); } }