[Sie-announce] SIEコード [2135] cloneNodeメソッドをimportNodeメソッドを使って修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 11月 11日 (木) 23:30:42 JST


Revision: 2135
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2135
Author:   dhrname
Date:     2010-11-11 23:30:42 +0900 (Thu, 11 Nov 2010)

Log Message:
-----------
cloneNodeメソッドをimportNodeメソッドを使って修正

Modified Paths:
--------------
    branches/06x/063/org/w3c/core.js

Modified: branches/06x/063/org/w3c/core.js
===================================================================
--- branches/06x/063/org/w3c/core.js	2010-11-10 12:16:08 UTC (rev 2134)
+++ branches/06x/063/org/w3c/core.js	2010-11-11 14:30:42 UTC (rev 2135)
@@ -326,25 +326,11 @@
  *ノードのコピーを作る。引数は、子ノードのコピーも作るかどうか。コピー機能。
  */
 /*Node*/ cloneNode : function( /*boolean*/ deep) {
-  var s;
-  switch (this.nodeType) {
-  case Node.ELEMENT_NODE:
-    s = new Element();
-    s.tagName = this.tagName;
-    s.attributes._copyNode(this.attributes,false); //NamedNodeMapのコピーを行う
-  break;
-  case Node.DOCUMENT_NODE:
-    s = new Document();
-  break;
-  default:
+  if ("ownerDocument" in this) {
+    var s = this.ownerDocument.importNode(this, deep);
+  } else {
     s = new Node();
-  break;
   }
-  s.parentNode = null;
-  s.nodeType = this.nodeType; s.nodeValue = this.nodeValue; s.nodeName = this.nodeName; s.namespaceURI = this.namespaceURI; s.localName = this.localName; s.prefix = this.prefix;
-  if (deep) {
-    s.childNodes._copyNode(this.childNodes,true);
-  }
   return s;
 },
 /*normalizeメソッド




Sie-announce メーリングリストの案内
Back to archive index