Пример #1
0
        private Node RemoteAndEvalUriSnippet(ElementNode elementNode)
        {
            string attribValue = elementNode.GetAttributeValue(ReplacementSpecification.OriginalAttributeName);

            elementNode.RemoveAttributesByName(ReplacementSpecification.OriginalAttributeName);
            return
                (attribValue.GetCreateUriSnippet(
                     IsTypeReplacement()));
        }
        public void DoReplace(ElementNode node, IList <Node> body)
        {
            string propertyExpression = node.GetAttributeValue("for");
            Node   checkedSnippet     = propertyExpression.GetCheckedSnippet();

            node.RemoveAttributesByName("checked");
            node.Attributes.Add(new AttributeNode("checked", new List <Node>()
            {
                checkedSnippet
            }));
        }
Пример #3
0
        public override void DoReplace(ElementNode node, IList <Node> body)
        {
            IEnumerable <ElementNode> options = GetOptions(body);

            foreach (ElementNode option in options)
            {
                string currentSelectedValue = option.GetAttributeValue("selected");
                string propertyValue        = option.GetAttributeValue("value");
                string propertyExpression   = node.GetAttributeValue(ReplacementSpecification.OriginalAttributeName);
                Node   selectedNode         = propertyExpression.GetSelectedSnippet(currentSelectedValue, propertyValue);
                option.RemoveAttributesByName("selected");
                AddAttribute(option, "selected", selectedNode);
            }
        }
Пример #4
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);
        }