[Groonga-commit] groonga/gcs [master] Return cloned instance correctly

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 26日 (木) 17:12:43 JST


SHIMODA Hiroshi	2012-07-26 17:12:43 +0900 (Thu, 26 Jul 2012)

  New Revision: 1290e11591a9808ef6a1dc44d2f8f6cf16665767
  https://github.com/groonga/gcs/commit/1290e11591a9808ef6a1dc44d2f8f6cf16665767

  Log:
    Return cloned instance correctly

  Modified files:
    lib/xmlbuilder.js

  Modified: lib/xmlbuilder.js (+3 -3)
===================================================================
--- lib/xmlbuilder.js    2012-07-26 16:59:18 +0900 (4682427)
+++ lib/xmlbuilder.js    2012-07-26 17:12:43 +0900 (4aab4da)
@@ -12,13 +12,13 @@ XMLFragment.prototype.importXMLBuilder = function(xmlbuilder) {
 };
 
 XMLFragment.prototype.clone = function(deep) {
-  var fragment = new XMLFragment(this.parent, this.name, this.attributes, this.value);
+  var clonedSelf = new XMLFragment(this.parent, this.name, this.attributes, this.value);
   if (deep) {
     this.children.forEach(function(child) {
       var clonedChild = child.clone(deep);
       clonedChild.parent = fragment;
-      fragment.children.push(clonedChild);
+      clonedSelf.children.push(clonedChild);
     }, this);
   }
-  return this;
+  return clonedSelf;
 };
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
下载 



Groonga-commit メーリングリストの案内
Back to archive index