JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5
[ckeditor.git] / _source / core / dom / node.js
index 6611545..a106810 100644 (file)
@@ -107,24 +107,25 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype,
                {\r
                        var $clone = this.$.cloneNode( includeChildren );\r
 \r
-                       if ( !cloneId )\r
+                       var removeIds = function( node )\r
                        {\r
-                               var removeIds = function( node )\r
-                               {\r
-                                       if ( node.nodeType != CKEDITOR.NODE_ELEMENT )\r
-                                               return;\r
+                               if ( node.nodeType != CKEDITOR.NODE_ELEMENT )\r
+                                       return;\r
 \r
-                                       node.removeAttribute( 'id', false ) ;\r
-                                       node.removeAttribute( '_cke_expando', false ) ;\r
+                               if ( !cloneId )\r
+                                       node.removeAttribute( 'id', false );\r
+                               node.removeAttribute( 'data-cke-expando', false );\r
 \r
+                               if ( includeChildren )\r
+                               {\r
                                        var childs = node.childNodes;\r
-                                       for ( var i=0 ; i < childs.length ; i++ )\r
+                                       for ( var i=0; i < childs.length; i++ )\r
                                                removeIds( childs[ i ] );\r
-                               };\r
+                               }\r
+                       };\r
 \r
-                               // The "id" attribute should never be cloned to avoid duplication.\r
-                               removeIds( $clone );\r
-                       }\r
+                       // The "id" attribute should never be cloned to avoid duplication.\r
+                       removeIds( $clone );\r
 \r
                        return new CKEDITOR.dom.node( $clone );\r
                },\r
@@ -243,13 +244,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype,
                 */\r
                getDocument : function()\r
                {\r
-                       var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );\r
-\r
-                       return (\r
-                       this.getDocument = function()\r
-                               {\r
-                                       return document;\r
-                               })();\r
+                       return new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );\r
                },\r
 \r
                getIndex : function()\r