I have a Node Duplicating Function.
This function May be Alternate for setHtml problem on IE.
i want to copy Attributes and innerText (for EveryNode).
My Problem Is Every Node Have (May Be)Text+ Some Nodes.
I want to copy Node By Node As Below mentioned condition
1.Current Node’s Text only (not InnerNodes Text)
2.Child Nodes Duplicate With all its Attribute
My Function is below:
function NodeDuplicateCreator(DummyNode, RealNode) {
var XnodefromReal = RealNode.getChildren();
for (var i = 0; i < XnodefromReal.count(); i++) {
if (XnodefromReal.getItem(i).$.nodeType == 1) {
var xnode = XnodefromReal.getItem(i);
var xnodeName = xnode.getName();
var NewNodeGen = DummyNode.getElementsByTag(xnodeName).getItem(0);
if (NewNodeGen == null) {
NewNodeGen = EditorInstance.document.createElement(xnodeName);
NewNodeGen.appendTo(DummyNode);
}
NodeDuplicateCreator(NewNodeGen, xnode);
}
}
}
Please improve it as my requirement…
Try to use
copyAttributes(node)function for attributetry below code to textcontent+childnodes