MCPcopy Index your code
hub / github.com/Macuyiko/minecraft-python / cloneNode

Function cloneNode

ServerEditorWeb/ace/worker-xml.js:2747–2782  ·  view source on GitHub ↗
(doc,node,deep)

Source from the content-addressed store, hash-verified

2745 return node2;
2746}
2747function cloneNode(doc,node,deep){
2748 var node2 = new node.constructor();
2749 for(var n in node){
2750 var v = node[n];
2751 if(typeof v != 'object' ){
2752 if(v != node2[n]){
2753 node2[n] = v;
2754 }
2755 }
2756 }
2757 if(node.childNodes){
2758 node2.childNodes = new NodeList();
2759 }
2760 node2.ownerDocument = doc;
2761 switch (node2.nodeType) {
2762 case ELEMENT_NODE:
2763 var attrs = node.attributes;
2764 var attrs2 = node2.attributes = new NamedNodeMap();
2765 var len = attrs.length
2766 attrs2._ownerElement = node2;
2767 for(var i=0;i<len;i++){
2768 node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
2769 }
2770 break;;
2771 case ATTRIBUTE_NODE:
2772 deep = true;
2773 }
2774 if(deep){
2775 var child = node.firstChild;
2776 while(child){
2777 node2.appendChild(cloneNode(doc,child,deep));
2778 child = child.nextSibling;
2779 }
2780 }
2781 return node2;
2782}
2783
2784function __set__(object,key,value){
2785 object[key] = value

Callers 1

worker-xml.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected