示例#1
0
        private List <Node> SetNodeNameAndValue(ElementNode elementNode, Node valueNode, Node nameNode, IList <Node> body, AttributeNode originalForAttrib)
        {
            List <Node> result = new List <Node>();

            if (elementNode.IsTag("textarea"))
            {
                if (valueNode != null)
                {
                    elementNode.IsEmptyElement = false;
                    body.Add(valueNode);
                }
            }
            else
            {
                string inputType = elementNode.GetAttributeValue("type");
                switch (inputType.ToUpper())
                {
                case "CHECKBOX":
                    elementNode.Attributes.Add(new AttributeNode("value", "true"));
                    // DODGY sorry will figure something decent out soon
                    AddCheckedAttribute(elementNode, originalForAttrib);
                    break;

                default:
                    if (valueNode != null)
                    {
                        elementNode.Attributes.Add(new AttributeNode("value", new List <Node>()
                        {
                            valueNode
                        }));
                    }
                    break;
                }
            }
            elementNode.Attributes.Add(new AttributeNode("name", new List <Node>()
            {
                nameNode
            }));
            return(result);
        }
示例#2
0
 public bool IsMatch(ElementNode node)
 {
     return(node.IsTag(elementName) && node.HasAttribute(originalAttributeName));
 }
 public bool IsMatch(ElementNode node)
 {
     return node.IsTag(this.elementName) && node.HasAttribute(this.originalAttributeName);
 }