Sean Chambers
unread,Aug 11, 2010, 11:59:46 AM8/11/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Spark View Engine Dev
I am attempt to add a disabled attribute to an input ElementNode from
VisitNode in a custom ISparkExtension. This is code I am currently
trying but after adding the attribute to the tree and called
visitor.Accept(body), the attribute is not being written out at the
time of rendering.
var inputTags = body.Where(n => n is ElementNode && ((ElementNode)
n).Name == "input").Select(n => n as ElementNode);
AttributeNode disabledAttributeNode = new AttributeNode("disabled",
new List<Node>{new TextNode("disabled")});
inputTags.ForEach(inputNode =>
inputNode.Attributes.Add(disabledAttributeNode));
body.Insert( 0, _node );
body.Add( new EndElementNode( _node.Name ) );
visitor.Accept( body );
Is there something I am missing here if I alter the contents of body
after entering the VisitNode method? I'm assuming whatever is in the
tree at that time, prior to being passed to the visitor is fair game.
Thanks
Sean